public void apply(FaceletContext faceletContext, UIComponent parent) throws FacesException, ELException { if (parent == null) { throw new TagException(tag, "Parent UIComponent was null"); } if (ComponentSupport.isNew(parent)) { Object attributeName = name.isLiteral() ? (Object) name.getValue(faceletContext) : name.getValueExpression(faceletContext, Object.class); Object attributeValue = value.isLiteral() ? (Object) value.getValue(faceletContext) : value.getValueExpression(faceletContext, Object.class); ComponentUtils.putDataAttribute(parent, attributeName, attributeValue); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { ((ActionSource2) instance).setActionExpression(this.attr .getMethodExpression(ctx, String.class, ActionSourceRule.ACTION_SIG)); }
/** * Delegates to getObject with Object.class as a param * * @see #getObject(FaceletContext, Class) * @param ctx * FaceletContext to use * @return Object representation of this attribute's value */ public Object getObject(FaceletContext ctx) { return this.getObject(ctx, Object.class); }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, ELException { boolean b = this.test.getBoolean(ctx); if (this.var != null) { ctx.setAttribute(var.getValue(ctx), new Boolean(b)); } if (b) { this.nextHandler.apply(ctx, parent); } }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { String varStr = this.var.getValue(ctx); ValueExpression veObj = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(varStr, veObj); } }
public void setAttributes(FaceletContext ctx, Object obj) { super.setAttributes(ctx, obj); AbstractTypedNumberConverter c = (AbstractTypedNumberConverter) obj; if (this.destType != null) { if (this.destType.isLiteral()) { try { c.setDestType(org.apache.myfaces.commons.util.ClassUtils.classForName(this.destType.getValue())); } catch (ClassNotFoundException e) { throw new TagAttributeException(this.destType,"Cannot find class assigned: "+this.destType.getValue(),e); } } else { c.setDestType((Class) this.destType.getObject(ctx, Class.class)); } } }
if ("isNotSet".equals(mode.getValue())) { boolean result = false; String expressionString = value.getValue(); if (!value.isLiteral()) { while (isSimpleExpression(expressionString)) { if (isMethodOrValueExpression(expressionString)) { parent.getAttributes().put(name.getValue(), Boolean.valueOf(result)); } else if ("isSet".equals(mode.getValue())) { boolean result = true; String expressionString = value.getValue(); if (!value.isLiteral()) { while (isSimpleExpression(expressionString)) { if (isMethodOrValueExpression(expressionString)) { parent.getAttributes().put(name.getValue(), Boolean.valueOf(result)); } else if ("action".equals(mode.getValue())) { String expressionString = value.getValue(); while (isSimpleExpression(expressionString)) { if (isMethodOrValueExpression(expressionString)) { } else if ("actionListener".equals(mode.getValue())) { String expressionString = value.getValue(); while (isSimpleExpression(expressionString)) { if (isMethodOrValueExpression(expressionString)) { } else if ("actionFromValue".equals(mode.getValue())) { if (!value.isLiteral()) { String result = value.getValue(faceletContext);
private final String getVarStatusName(FaceletContext ctx) { if (this.varStatus != null) { return this.varStatus.getValue(ctx); } return null; }
public void applyMetadata(FaceletContext ctx, Object instance) { ((UIComponent) instance).setValueExpression("value", attr .getValueExpression(ctx, Object.class)); } }
private MethodExpression getMethodExpression(FaceletContext faceletContext, Class returnType, Class[] args) { // in a composition may be we get the method expression string from the current variable mapper // the expression can be empty // in this case return nothing if (value.getValue().startsWith("${")) { ValueExpression expression = getExpression(faceletContext); if (expression != null) { ExpressionFactory expressionFactory = faceletContext.getExpressionFactory(); return new TagMethodExpression(value, expressionFactory.createMethodExpression(faceletContext, expression.getExpressionString(), returnType, args)); } else { return null; } } else { return value.getMethodExpression(faceletContext, returnType, args); } }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { Method m = meta.getWriteMethod(name); // if the property is writable if (m != null) { if (attribute.isLiteral()) { return new LiteralPropertyMetadata(m, attribute); } else { return new DynamicPropertyMetadata(m, attribute); } } return null; }
private final boolean getTransient(FaceletContext ctx) { if (this.tranzient != null) { return this.tranzient.getBoolean(ctx); } return false; }
public void setAttributes(FaceletContext ctx, Object obj) { super.setAttributes(ctx, obj); EnumConverter c = (EnumConverter) obj; if (this.targetClass != null) { if (this.targetClass.isLiteral()) { try { c.setTargetClass(org.apache.myfaces.commons.util.ClassUtils.classForName(this.targetClass.getValue())); } catch (ClassNotFoundException e) { throw new TagAttributeException(this.targetClass,"Cannot find class assigned: "+this.targetClass.getValue(),e); } } else { c.setTargetClass((Class) this.targetClass.getObject(ctx, Class.class)); } } }
/** * @param config */ public InsertHandler(TagConfig config) { super(config); TagAttribute attr = this.getAttribute("name"); if (attr != null) { if (!attr.isLiteral()) { throw new TagAttributeException(this.tag, attr, "Must be Literal"); } this.name = attr.getValue(); } else { this.name = null; } }
private final String getVarName(FaceletContext ctx) { if (this.var != null) { return this.var.getValue(ctx); } return null; }
public void applyMetadata(FaceletContext ctx, Object instance) { ((UIComponent) instance).setValueExpression("converter", attr .getValueExpression(ctx, Converter.class)); } }
@Override protected Validator createValidator(FaceletContext ctx) { StellaIEValidator validator = new StellaIEValidator(); validator.setEstadoComponentId(estadoId.getValue()); if (formatted != null) { validator.setFormatted(formatted.getBoolean(ctx)); } else { validator.setFormatted(false); } return validator; }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { String nameStr = this.name.getValue(ctx); ValueExpression valueVE = this.value.getValueExpression(ctx, Object.class); ctx.getVariableMapper().setVariable(nameStr, valueVE); }