public AjaxRequestBuilder partialSubmit(boolean value, boolean partialSubmitSet, String partialSubmitFilter) { PrimeConfiguration config = PrimeApplicationContext.getCurrentInstance(context).getConfig(); //component can override global setting boolean partialSubmit = partialSubmitSet ? value : config.isPartialSubmitEnabled(); if (partialSubmit) { buffer.append(",ps:true"); if (partialSubmitFilter != null) { buffer.append(",psf:\"").append(partialSubmitFilter).append("\""); } } return this; }
public static void execute(PrimeApplicationContext applicationContext, UIComponent component) throws IOException { if (applicationContext.getConfig().isTransformMetadataEnabled()) { FacesContext context = FacesContext.getCurrentInstance(); if (applicationContext.getConfig().isBeanValidationEnabled()) { BV_INPUT_METADATA_TRANSFORMER.transform(context, applicationContext, component); } if (!METADATA_TRANSFORMERS.isEmpty()) { for (int i = 0; i < METADATA_TRANSFORMERS.size(); i++) { METADATA_TRANSFORMERS.get(i).transform(context, applicationContext, component); } } } }
public AjaxRequestBuilder resetValues(boolean value, boolean resetValuesSet) { PrimeConfiguration config = PrimeApplicationContext.getCurrentInstance(context).getConfig(); //component can override global setting boolean resetValues = resetValuesSet ? value : config.isResetValuesEnabled(); if (resetValues) { buffer.append(",rv:true"); } return this; }
/** * @return Shared WidgetBuilder instance of the current request */ public WidgetBuilder getWidgetBuilder() { if (this.widgetBuilder == null) { this.widgetBuilder = new WidgetBuilder(context, getApplicationContext().getConfig()); } return widgetBuilder; }
return applicationContext.getConfig().isInterpretEmptyStringAsNull();
@SuppressWarnings("deprecation") // the default constructor is deprecated in JSF 2.3 public PrimeFacesContext(FacesContext wrapped) { this.wrapped = wrapped; PrimeRequestContext requestContext = new PrimeRequestContext(wrapped); PrimeRequestContext.setCurrentInstance(requestContext, wrapped); moveScriptsToBottom = requestContext.getApplicationContext().getConfig().isMoveScriptsToBottom(); if (moveScriptsToBottom) { moveScriptsToBottomState = new MoveScriptsToBottomState(); } }
@Override public void decode(FacesContext context, UIComponent component) { if (!context.getExternalContext().getRequestContentType().toLowerCase().startsWith("multipart/")) { return; } FileUpload fileUpload = (FileUpload) component; if (!fileUpload.isDisabled()) { PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context); String uploader = applicationContext.getConfig().getUploader(); boolean isAtLeastJSF22 = applicationContext.getEnvironment().isAtLeastJsf22(); String inputToDecodeId = getSimpleInputDecodeId(fileUpload, context); if (uploader.equals("auto")) { if (isAtLeastJSF22) { NativeFileUploadDecoder.decode(context, fileUpload, inputToDecodeId); } else { CommonsFileUploadDecoder.decode(context, fileUpload, inputToDecodeId); } } else if (uploader.equals("native")) { if (!isAtLeastJSF22) { throw new FacesException("native uploader requires at least a JSF 2.2 runtime"); } NativeFileUploadDecoder.decode(context, fileUpload, inputToDecodeId); } else if (uploader.equals("commons")) { CommonsFileUploadDecoder.decode(context, fileUpload, inputToDecodeId); } } }
applicationContext.getConfig().isInterpolateClientSideValidationMessages();
EditableValueHolder input = (EditableValueHolder) component; Object submittedValue = input.getSubmittedValue(); PrimeConfiguration config = PrimeApplicationContext.getCurrentInstance(context).getConfig(); Class valueType = value.getClass(); if (valueType == String.class && !PrimeApplicationContext.getCurrentInstance(context).getConfig().isStringConverterAvailable()) { return (String) value;
PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context); ProjectStage projectStage = context.getApplication().getProjectStage(); boolean csvEnabled = applicationContext.getConfig().isClientSideValidationEnabled(); String themeParamValue = applicationContext.getConfig().getTheme(); if (applicationContext.getConfig().isFontAwesomeEnabled()) { encodeCSS(context, "primefaces", "fa/font-awesome.css"); encodeValidationResources(context, applicationContext.getConfig().isBeanValidationEnabled()); writer.write("PrimeFaces.settings.validateEmptyFields=" + applicationContext.getConfig().isValidateEmptyFields() + ";"); writer.write("PrimeFaces.settings.considerEmptyStringNull=" + applicationContext.getConfig().isInterpretEmptyStringAsNull() + ";"); if (applicationContext.getConfig().isLegacyWidgetNamespace()) { writer.write("PrimeFaces.settings.legacyWidgetNamespace=true;"); if (applicationContext.getConfig().isEarlyPostParamEvaluation()) { writer.write("PrimeFaces.settings.earlyPostParamEvaluation=true;");
/** * Finds appropriate converter for a given value holder * * @param context FacesContext instance * @param component ValueHolder instance to look converter for * @return Converter */ public static Converter getConverter(FacesContext context, UIComponent component) { if (!(component instanceof ValueHolder)) { return null; } Converter converter = ((ValueHolder) component).getConverter(); if (converter != null) { return converter; } ValueExpression valueExpression = component.getValueExpression("value"); if (valueExpression == null) { return null; } Class<?> converterType = valueExpression.getType(context.getELContext()); if (converterType == null || converterType == Object.class) { // no conversion is needed return null; } if (converterType == String.class && !PrimeApplicationContext.getCurrentInstance(context).getConfig().isStringConverterAvailable()) { return null; } return context.getApplication().createConverter(converterType); }
if (applicationContext.getConfig().isBeanValidationEnabled() && isBeanValidationDefined(input, context)) { state.setRequired(true);
if (PrimeApplicationContext.getCurrentInstance(context).getConfig().isClientSideValidationEnabled()) { writer.writeAttribute("data-global", String.valueOf(globalOnly), null); writer.writeAttribute("data-summary", uiMessages.isShowSummary(), null);
if (PrimeApplicationContext.getCurrentInstance(context).getConfig().isClientSideValidationEnabled()) { writer.writeAttribute("data-display", display, null); writer.writeAttribute("data-target", targetClientId, null);
@Override public Converter getConverter() { Converter converter = super.getConverter(); if (converter == null && PrimeApplicationContext.getCurrentInstance(getFacesContext()).getConfig().isClientSideValidationEnabled()) { DateTimeConverter con = new DateTimeConverter(); con.setPattern(calculatePattern()); con.setTimeZone(CalendarUtils.calculateTimeZone(this.getTimeZone())); con.setLocale(calculateLocale(getFacesContext())); return con; } return converter; } }
styleClass = styleClass == null ? CommandLink.STYLE_CLASS : CommandLink.STYLE_CLASS + " " + styleClass; PrimeRequestContext requestContext = PrimeRequestContext.getCurrentInstance(context); boolean csvEnabled = requestContext.getApplicationContext().getConfig().isClientSideValidationEnabled() && link.isValidateClient();
externalContext.getSessionMap().put(ExceptionInfo.ATTRIBUTE_NAME, info); Map<String, String> errorPages = PrimeApplicationContext.getCurrentInstance(context).getConfig().getErrorPages(); String errorPage = evaluateErrorPage(errorPages, rootCause);
protected String buildRequest(FacesContext context, CommandButton button, String clientId) throws FacesException { PrimeRequestContext requestContext = PrimeRequestContext.getCurrentInstance(context); boolean csvEnabled = requestContext.getApplicationContext().getConfig().isClientSideValidationEnabled() && button.isValidateClient(); String request = null; boolean ajax = button.isAjax(); if (ajax) { request = buildAjaxRequest(context, button); } else { UIForm form = ComponentTraversalUtils.closestForm(context, button); if (form == null) { throw new FacesException("CommandButton : \"" + clientId + "\" must be inside a form element"); } request = buildNonAjaxRequest(context, button, form, null, false); } if (csvEnabled) { CSVBuilder csvb = requestContext.getCSVBuilder(); request = csvb.init().source("this").ajax(ajax).process(button, button.getProcess()).update(button, button.getUpdate()).command(request).build(); } return request; }
@Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { ResponseWriter writer = context.getResponseWriter(); Growl growl = (Growl) component; String clientId = growl.getClientId(context); String widgetVar = growl.resolveWidgetVar(); writer.startElement("span", growl); writer.writeAttribute("id", clientId, "id"); if (PrimeApplicationContext.getCurrentInstance(context).getConfig().isClientSideValidationEnabled()) { writer.writeAttribute("class", "ui-growl-pl", null); writer.writeAttribute(HTML.WIDGET_VAR, widgetVar, null); writer.writeAttribute("data-global", growl.isGlobalOnly(), null); writer.writeAttribute("data-summary", growl.isShowSummary(), null); writer.writeAttribute("data-detail", growl.isShowDetail(), null); writer.writeAttribute("data-severity", getClientSideSeverity(growl.getSeverity()), null); writer.writeAttribute("data-redisplay", String.valueOf(growl.isRedisplay()), null); } writer.endElement("span"); WidgetBuilder wb = getWidgetBuilder(context); wb.init("Growl", growl.resolveWidgetVar(), clientId) .attr("sticky", growl.isSticky()) .attr("life", growl.getLife()) .attr("escape", growl.isEscape()) .attr("keepAlive", growl.isKeepAlive()); writer.write(",msgs:"); encodeMessages(context, growl); wb.finish(); }
PrimeConfiguration config = PrimeApplicationContext.getCurrentInstance(getFacesContext()).getConfig();