public static void setConverter(ValueHolder valueHolder, Object converterExpression) { if (converterExpression instanceof ValueExpression) { ValueExpression expression = (ValueExpression) converterExpression; if (!expression.isLiteralText()) { ((UIComponent) valueHolder).setValueExpression("converter", expression); } else { valueHolder.setConverter(FacesContext.getCurrentInstance() .getApplication().createConverter(expression.getExpressionString())); } } }
@Override protected void setProperties(UIComponent component) { super.setProperties(component); // set forID if (forID != null) { if (!forID.isLiteralText()) { component.setValueExpression("for", forID); } else { component.getAttributes().put("for", forID.getExpressionString()); } } }
protected void setProperty(UIComponent component, String propName, ValueExpression valueExpression) { if (valueExpression != null) { if (valueExpression.isLiteralText()) { component.getAttributes().put(propName,valueExpression.getValue(getELContext())); } else { component.setValueExpression(propName, valueExpression); } } }
protected void setAttributeProperites(final UIComponent component, final String attributeName, final String attribute) { if (attribute != null) { if (Expressions.isEL(attribute)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ExpressionFactory expressionFactory = app.getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(attribute, Object.class); component.setValueExpression(attributeName, ve); } else { component.getAttributes().put(attributeName, attribute); } } } }
if (_locale.isLiteralText()) component.setValueExpression("locale", _locale); if (_renderKitId.isLiteralText()) String defaultRenderKitId = facesContext.getApplication().getDefaultRenderKitId();
protected void setAttributeProperites(final UIComponent component, final String attributeName, final String attribute) { if (attribute != null) { if (Expressions.isEL(attribute)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ExpressionFactory expressionFactory = app.getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(attribute, Object.class); component.setValueExpression(attributeName, ve); } else { component.getAttributes().put(attributeName, attribute); } } } }
@Override protected void setProperties(UIComponent component) { super.setProperties(component); // set forID if (forID != null) { if (!forID.isLiteralText()) { component.setValueExpression("for", forID); } else { component.getAttributes().put("for", forID.getExpressionString()); } } }
protected void setConverterProperty(UIComponent component, ValueExpression converter) { if (converter != null) { if (component instanceof ValueHolder) { ValueHolder output = (ValueHolder) component; if (!converter.isLiteralText()) { component.setValueExpression("converter", converter); } else { Converter conv = FacesContext.getCurrentInstance().getApplication().createConverter(converter.getExpressionString()); output.setConverter(conv); } } else { throw new IllegalArgumentException(Messages.getMessage(Messages.NO_VALUE_HOLDER_ERROR, component.getClass().getName())); } } }
if (_locale.isLiteralText()) component.setValueExpression("locale", _locale); if (_renderKitId.isLiteralText()) String defaultRenderKitId = facesContext.getApplication().getDefaultRenderKitId();
/** * @since 1.2 */ public static void setValueBinding(FacesContext context, UIComponent component, String propName, ValueExpression value) { if (value != null) { if (!value.isLiteralText()) { component.setValueExpression(propName, value); } else { throw new IllegalArgumentException("Component " + component.getClientId(context) + " attribute " + propName + " must be a value reference, was " + value); } } }
protected void setAttributeProperites(final UIComponent component, final String attributeName, final String attribute) { if (attribute != null) { if (Expressions.isEL(attribute)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ExpressionFactory expressionFactory = app.getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(attribute, Object.class); component.setValueExpression(attributeName, ve); } else { component.getAttributes().put(attributeName, attribute); } } } }
@Override protected void setProperties(UIComponent component) { super.setProperties(component); // set forID if (forID != null) { if (!forID.isLiteralText()) { component.setValueExpression("for", forID); } else { component.getAttributes().put("for", forID.getExpressionString()); } } }
private void setConverter( final FaceletContext faceletContext, final UIComponent parent, final String nameValue, final ValueExpression expression) { if (expression.isLiteralText()) { final Converter converter = faceletContext.getFacesContext().getApplication().createConverter(expression.getExpressionString()); ((ValueHolder) parent).setConverter(converter); } else { parent.setValueExpression(nameValue, expression); } } }
if (_locale.isLiteralText()) component.setValueExpression("locale", _locale); if (_renderKitId.isLiteralText()) String defaultRenderKitId = facesContext.getApplication().getDefaultRenderKitId();
/** * @since 1.2 */ public static void setValueBinding(FacesContext context, UIComponent component, String propName, ValueExpression value) { if (value != null) { if (!value.isLiteralText()) { component.setValueExpression(propName, value); } else { throw new IllegalArgumentException("Component " + component.getClientId(context) + " attribute " + propName + " must be a value reference, was " + value); } } }
protected void setAttributeProperites(final UIComponent component, final String attributeName, final String attribute) { if (attribute != null) { if (Expressions.isEL(attribute)) { FacesContext context = FacesContext.getCurrentInstance(); Application app = context.getApplication(); ExpressionFactory expressionFactory = app.getExpressionFactory(); ValueExpression ve = expressionFactory.createValueExpression(attribute, Object.class); component.setValueExpression(attributeName, ve); } else { component.getAttributes().put(attributeName, attribute); } } } }
@Override protected void setProperties(UIComponent component) { super.setProperties(component); // set forID if (forID != null) { if (!forID.isLiteralText()) { component.setValueExpression("for", forID); } else { component.getAttributes().put("for", forID.getExpressionString()); } } }
/** * @since 1.2 */ public static void setConverterProperty(FacesContext context, UIComponent component, ValueExpression value) { if (value != null) { if (component instanceof ValueHolder) { if (value.isLiteralText()) { FacesContext facesContext = FacesContext.getCurrentInstance(); Converter converter = facesContext.getApplication().createConverter(value.getExpressionString()); ((ValueHolder)component).setConverter(converter); } else { component.setValueExpression(org.apache.myfaces.shared_impl.renderkit.JSFAttr.CONVERTER_ATTR, value); } } else { log.severe("Component " + component.getClass().getName() + " is no ValueHolder, cannot set value."); } } }
if (_locale.isLiteralText()) component.setValueExpression("locale", _locale); if (_renderKitId.isLiteralText()) String defaultRenderKitId = facesContext.getApplication().getDefaultRenderKitId();
/** * @since 1.2 */ public static void setValueBinding(FacesContext context, UIComponent component, String propName, ValueExpression value) { if (value != null) { if (!value.isLiteralText()) { component.setValueExpression(propName, value); } else { throw new IllegalArgumentException("Component " + component.getClientId(context) + " attribute " + propName + " must be a value reference, was " + value); } } }