/** * @param config */ public DefineHandler(TagConfig config) { super(config); TagAttribute attr = this.getRequiredAttribute("name"); if (!attr.isLiteral()) { throw new TagAttributeException(this.tag, attr, "Must be Literal"); } this.name = attr.getValue(); }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { if (meta.isTargetInstanceOf(ValidatorBase.class)) { // if component and dynamic, then must set expression if (!attribute.isLiteral()) { Class type = meta.getPropertyType(name); if (type == null) { type = Object.class; } return new ValueBindingMetadata(name, type, attribute); } } return null; } }
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; }
/** * @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; } }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { if (meta.isTargetInstanceOf(ConverterBase.class)) { // if component and dynamic, then must set expression if (!attribute.isLiteral()) { Class type = meta.getPropertyType(name); if (type == null) { type = Object.class; } return new ValueBindingMetadata(name, type, attribute); } } return null; } }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent wizard, UIComponent parent) { if (outcomeAttribute != null) { if (outcomeAttribute.isLiteral()) { wizard.getAttributes().put("outcome", outcomeAttribute.getValue(faceletContext)); } else { ValueExpression expression = outcomeAttribute.getValueExpression(faceletContext, String.class); ELAdaptor.setExpression(wizard, "outcome", expression); } } super.onComponentCreated(faceletContext, wizard, parent); }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { if (meta.isTargetInstanceOf(ValidatorBase.class)) { // if component and dynamic, then must set expression if (!attribute.isLiteral()) { Class type = meta.getPropertyType(name); if (type == null) { type = Object.class; } return new ValueBindingMetadata(name, type, attribute); } } return null; } }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { if (meta.isTargetInstanceOf(DateTimeConverter.class)) { // if component and dynamic, then must set expression if (!attribute.isLiteral()) { Class type = meta.getPropertyType(name); if (type == null) { type = Object.class; } return new ValueBindingMetadata(name, type, attribute); } } return null; } }
public Metadata applyRule(String name, TagAttribute attribute, MetadataTarget meta) { if (meta.isTargetInstanceOf(ValidatorBase.class)) { // if component and dynamic, then must set expression if (!attribute.isLiteral()) { Class type = meta.getPropertyType(name); if (type == null) { type = Object.class; } //if (FacesAPI.getComponentVersion(meta.getTargetClass()) >= 12) { return new ValueExpressionMetadata(name, type, attribute); //} else { // return new ValueBindingMetadata(name, type, attribute); //} } } return null; } }
public TabChangeListenerHandler(TagConfig config) { super(config); binding = getAttribute("binding"); type = getAttribute("type"); if (type != null) { if (!type.isLiteral()) { throw new TagAttributeException(tag, type, "Must be literal"); } try { this.listenerType = Class.forName(type.getValue()); } catch (Exception e) { throw new TagAttributeException(tag, type, e); } } }
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) { if (attribute.isLiteral()) { ((Position) instance).setTop(Measure.parse(attribute.getValue())); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.TOP, expression); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { if (attribute.isLiteral()) { String[] components = ComponentUtils.splitList(attribute.getValue()); ((SupportsRenderedPartially) instance).setRenderedPartially(components); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.RENDERED_PARTIALLY, expression); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { if (attribute.isLiteral()) { ((Position) instance).setLeft(Measure.parse(attribute.getValue())); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.LEFT, expression); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { if (attribute.isLiteral()) { ((SupportsMarkup) instance).setMarkup(Markup.valueOf(attribute.getValue())); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.MARKUP, expression); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { if (attribute.isLiteral()) { ((DeprecatedDimension) instance).setWidth(Measure.parse(attribute.getValue())); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.WIDTH, expression); } } }
public void applyMetadata(FaceletContext ctx, Object instance) { if (attribute.isLiteral()) { ((DeprecatedDimension) instance).setHeight(Measure.parse(attribute.getValue())); } else { ValueExpression expression = attribute.getValueExpression(ctx, Object.class); ELAdaptor.setExpression((UIComponent) instance, Attributes.HEIGHT, expression); } } }
protected void enrichInput(FaceletContext faceletContext, UIComponent input) { super.enrichInput(faceletContext, input); UISelectBooleanCheckbox checkbox = (UISelectBooleanCheckbox) input; if (itemLabelAttribute != null) { if (itemLabelAttribute.isLiteral()) { checkbox.setItemLabel(itemLabelAttribute.getValue(faceletContext)); } else { ValueExpression expression = itemLabelAttribute.getValueExpression(faceletContext, String.class); ELAdaptor.setExpression(checkbox, Attributes.ITEM_LABEL, expression); } } else { checkbox.setItemLabel(""); // for compatibility (TOBAGO-1093) } }
protected void onComponentCreated(FaceletContext faceletContext, UIComponent separator, UIComponent parent) { Application application = faceletContext.getFacesContext().getApplication(); UIViewRoot root = ComponentSupport.getViewRoot(faceletContext, parent); UIOutput label = (UIOutput) application.createComponent(UILabel.COMPONENT_TYPE); label.setId(root.createUniqueId()); label.setRendererType("Label"); setAttributes(faceletContext, label); separator.getFacets().put(Facets.LABEL, label); if (labelAttribute != null) { if (labelAttribute.isLiteral()) { label.setValue(labelAttribute.getValue(faceletContext)); } else { ValueExpression expression = labelAttribute.getValueExpression(faceletContext, String.class); ELAdaptor.setExpression(label, Attributes.VALUE, expression); } } }
protected void setAttributes(FaceletContext ctx, Object instance) { super.setAttributes(ctx, instance); AjaxWrapper component = (AjaxWrapper) instance; try { component.setName(this.name.getValue(ctx)); if (this.service!=null && this.service.isLiteral()) component.setService(this.service.getValue(ctx)); if (this.style!=null) component.setStyle(this.style.getValue(ctx)); if (this.script!=null) component.setScript(this.script.getValue(ctx)); if (this.template!=null) component.setTemplate(this.template.getValue(ctx)); if (this.selected!=null) component.setSelected(this.selected.getValue(ctx)); if (this.options!=null) component.setOptions(this.options.getValue(ctx)); if (this.args!=null) component.setArgs(this.args.getValue(ctx)); if (this.value!=null && this.value.isLiteral()) component.setValue(this.value.getValue(ctx)); } catch (Exception e) { throw new javax.faces.FacesException("Unable to process attributes of jMaki component: " + component.getId(),e); } } }