private Object getValue() { if (UIComponentTag.isValueReference(_value)) { FacesContext facesContext = FacesContext.getCurrentInstance(); ValueBinding vb = facesContext.getApplication().createValueBinding(_value); return vb.getValue(facesContext); } return _value; }
/** * <p>Implement <code>createComponent</code> using Faces 1.1 EL * API.</p> * * @param context {@inheritDoc} * @param newId {@inheritDoc} */ @Override protected UIComponent createComponent(FacesContext context, String newId) { UIComponent component; Application application = context.getApplication(); if (binding != null) { ValueBinding vb = application.createValueBinding(binding); component = application.createComponent(vb, context, getComponentType()); component.setValueBinding("binding", vb); } else { component = application.createComponent(getComponentType()); } component.setId(newId); setProperties(component); return component; }
public void release() { super.release(); title = null; }
protected UIComponent createComponent(final FacesContext context, final String newId) { final UIComponent component = WebAppUtil.createComponent(context, binding, getComponentType()); component.setId(newId); setProperties(component); return component; }
/** * @param component {@inheritDoc} */ protected void setProperties(UIComponent component) { // The "id" property is explicitly set when components are created // so it does not need to be set here if (rendered != null) { if (isValueReference(rendered)) { ValueBinding vb = getFacesContext().getApplication().createValueBinding(rendered); component.setValueBinding("rendered", vb); } else { component.setRendered(Boolean.valueOf(rendered).booleanValue()); } } if (getRendererType() != null) { component.setRendererType(getRendererType()); } }
protected void setProperties(UIComponent component) { if (log.isDebugEnabled()) log.debug("setProperties " + bean); super.setProperties(component); FacesContext context = getFacesContext(); if (bean != null) { if (UIComponentTag.isValueReference(bean)) { ValueBinding vb = context.getApplication().createValueBinding(bean); component.setValueBinding("bean", vb); } else { log.error("Invalid expression " + bean); } } }
throw new JspException("type attribute not set"); UIComponentTag componentTag = UIComponentTag.getParentUIComponentTag(pageContext); if (componentTag == null) throw new JspException("TreeSelectionListenerTag has no UIComponentTag ancestor"); if (componentTag.getCreated()) UIComponent component = componentTag.getComponentInstance(); if (component instanceof HtmlTree) if (UIComponentTag.isValueReference(type)) FacesContext facesContext = FacesContext.getCurrentInstance(); ValueBinding valueBinding = facesContext.getApplication().createValueBinding(type); className = (String) valueBinding.getValue(facesContext); } else } else throw new JspException("Component " + component.getId() + " is no HtmlTree");
throws JspException { FacesContext context = FacesContext.getCurrentInstance(); Converter converter = null; ValueExpression vb = null; try { vb = context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(), binding, Object.class); if (vb != null) { converter = (Converter)vb.getValue(context.getELContext()); throw new JspException(e); try { String converterIdVal = converterId; if (UIComponentTag.isValueReference(converterId)) { ValueExpression idBinding = context.getApplication().getExpressionFactory().createValueExpression(context.getELContext(), converterId, Object.class); converterIdVal = (String) idBinding.getValue(context.getELContext()); converter = context.getApplication().createConverter(converterIdVal); if (converter != null) { if (vb != null) { throw new JspException(e);
public static void setMethodBinding(UIComponent component, String attributeName, String attributeValue, Class[] paramTypes) { if (attributeValue == null) { return; } if (UIComponentTag.isValueReference(attributeValue)) { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); MethodBinding methodBinding = application.createMethodBinding(attributeValue, paramTypes); component.getAttributes().put(attributeName, methodBinding); } }
/** * @deprecated since 2.0.0 */ @Deprecated public static void setConverterProperty(final UIComponent component, final String name, final String value) { if (value != null && component instanceof ValueHolder) { final FacesContext facesContext = FacesContext.getCurrentInstance(); final Application application = facesContext.getApplication(); if (UIComponentTag.isValueReference(value)) { final ValueBinding valueBinding = application.createValueBinding(value); component.setValueBinding(name, valueBinding); } else { final Converter converter = application.createConverter(value); ((ValueHolder) component).setConverter(converter); } } }
/** * <p>Set the expression that will be used to create a {@link ValueExpression} * that references a backing bean property of the {@link Converter} instance to * be created.</p> * * @param binding The new expression * * @throws JspException if a JSP error occurs */ public void setBinding(String binding) throws JspException { if (binding!= null && !UIComponentTag.isValueReference(binding)) { // PENDING i18n throw new JspException("Invalid Expression:"+binding); } this.binding = binding; } // ---------------------------------------------------------- Public Methods
setStringProperty(component, "rangeStyleClass",this._rangeStyleClass); if(null != this._sliderListener){ if (isValueReference(this._sliderListener)) MethodBinding mb = getFacesContext().getApplication().createMethodBinding(this._sliderListener, new Class[]{org.richfaces.event.DataFilterSliderEvent.class}); ((HtmlDataFilterSlider)component).setSliderListener(mb); getFacesContext().getExternalContext().log("Component " + component.getClientId(getFacesContext()) + " has invalid sliderListener value: " + this._sliderListener);
public int doStartTag() throws JspException { final String type = getType(); if (type == null) { throw new JspException("type attribute not set"); .getParentUIComponentTag(pageContext); if (tag == null) { throw new JspException("Not nested in a UIComponentTag"); if (!tag.getCreated()) { return SKIP_BODY; UIComponent component = tag.getComponentInstance(); if (component == null) { throw new JspException( "No component associated with UIComponentTag"); if (UIComponentTag.isValueReference(type)) { FacesContext context = FacesContext.getCurrentInstance(); ValueBinding vb = ValueBindingUtil.createValueBinding(context, type); className = (String) vb.getValue(context); } else { className = type;
public int doStartTag() throws JspException { UIComponentTag tag = UIComponentTag .getParentUIComponentTag(pageContext); if (tag == null) { throw new JspException("Not nested in a UIComponentTag"); } if (!tag.getCreated()) { return EVAL_PAGE; } Validator validator = createValidator(); UIComponent component = tag.getComponentInstance(); if (component == null || !(component instanceof EditableValueHolder)) { throw new JspException( "Component is null or not editable value holder."); } EditableValueHolder editableValueHolder = (EditableValueHolder) component; editableValueHolder.addValidator(validator); return SKIP_BODY; }
public int doStartTag() throws JspException { UIComponentTag componentTag = UIComponentTag .getParentUIComponentTag(pageContext); if (componentTag == null) { throw new JspException("Not nested in a UIComponentTag"); } UIComponent component = componentTag.getComponentInstance(); if (component == null) { throw new JspException( "No component associated with UIComponentTag"); } String nameObj = name; if (UIComponentTag.isValueReference(name)) { nameObj = (String) WebAppUtil.getValueFromCreatedValueBinding(name); } Object valueObj = value; if (UIComponentTag.isValueReference(value)) { valueObj = WebAppUtil.getValueFromCreatedValueBinding(value); } if (component.getAttributes().get(nameObj) == null) { component.getAttributes().put(nameObj, valueObj); } return SKIP_BODY; }
public static void setBoolean(UIComponent component, String attributeName, String attributeValue) { if (attributeValue == null) { return; } else if (UIComponentTag.isValueReference(attributeValue)) { setValueBinding(component, attributeName, attributeValue); } else { component.getAttributes().put(attributeName, Boolean.valueOf(attributeValue)); } }
protected void setProperties(final UIComponent component) { if (rendered != null) { if (isValueReference(rendered)) { component.setValueBinding("rendered", ValueBindingUtil .createValueBinding(context, rendered)); } else { component.setRendered(Boolean.valueOf(rendered).booleanValue()); } } if (getRendererType() != null) { component.setRendererType(getRendererType()); } }
/** * @deprecated since 2.0.0 */ @Deprecated public static void setValueBindingProperty(final UIComponent component, final String name, final String value) { if (value != null && UIComponentTag.isValueReference(value)) { final ValueBinding valueBinding = createValueBinding(value); component.setValueBinding(name, valueBinding); } }
protected void setProperties(UIComponent component) { super.setProperties(component); TagUtil.setString(component, "value", value); }
throw new JspException("type attribute not set"); UIComponentTag componentTag = UIComponentTag.getParentUIComponentTag(pageContext); if (componentTag == null) throw new JspException("IconProviderTag has no UIComponentTag ancestor"); UIComponent component = componentTag.getComponentInstance(); if (component instanceof HtmlTree) if (UIComponentTag.isValueReference(type)) FacesContext facesContext = FacesContext.getCurrentInstance(); ValueBinding vb = facesContext.getApplication().createValueBinding(type); className = (String) vb.getValue(facesContext); } else } else throw new JspException("Component " + component.getId() + " is no HtmlTree");