List of usage examples for javax.el ValueExpression isLiteralText
public abstract boolean isLiteralText();
From source file:org.richfaces.taglib.ColumnsTag.java
@Override protected void setProperties(UIComponent component) { ELContext elContext = getContext(pageContext.getELContext()); Field[] fields = this.getClass().getDeclaredFields(); for (Field field : fields) { try {// ww w .ja v a 2s . co m Object o = field.get(this); if (o != null && o instanceof ValueExpression) { String fieldName = field.getName(); if (fieldName != null && fieldName.startsWith("_")) { String attributeName = fieldName.replace("_", ""); if (ColumnsAttributes.FILTER_ATTRIBUTES.indexOf(attributeName) == -1 && ColumnsAttributes.SORT_ATTRIBUTES.indexOf(attributeName) == -1) { ValueExpression ex = (ValueExpression) o; ex = createValueExpression(elContext, ex); component.setValueExpression(attributeName, ex); } else { ValueExpression ex = (ValueExpression) o; ValueExpression expr = null; if (!ex.isLiteralText()) { expr = ELBuilder.createValueExpression(ex.getExpressionString(), ex.getExpectedType(), getFacesContext().getApplication().getExpressionFactory(), pageContext.getELContext(), itemId, indexId, getVarReplacement(), String.valueOf(index)); } else { expr = ex; } component.setValueExpression(attributeName, expr); } } } } catch (Exception e) { continue; } } // Set filterMethod attribute if (_filterMethod != null) { MethodExpression mexpr = getFacesContext().getApplication().getExpressionFactory() .createMethodExpression(elContext, _filterMethod.getExpressionString(), Object.class, new Class[] { Object.class }); ((HtmlColumn) component).setFilterMethod(mexpr); } // Set SortExpression attribute especially for scrollable data table if (_sortExpression != null) { ValueExpression expr = ELBuilder.createValueExpression(_sortExpression.getExpressionString(), _sortExpression.getExpectedType(), getFacesContext().getApplication().getExpressionFactory(), pageContext.getELContext(), itemId, indexId, getVarReplacement(), String.valueOf(index)); component.setValueExpression("sortExpression", expr); } }
From source file:org.richfaces.webapp.taglib.UIComponentELTagBase.java
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); }//from w w w . ja va 2s. co m } else { throw new IllegalArgumentException( Messages.getMessage(Messages.NO_VALUE_HOLDER_ERROR, component.getClass().getName())); } } }
From source file:org.richfaces.webapp.taglib.UIComponentELTagBase.java
protected void setRowKeyConverterProperty(UIComponent component, ValueExpression converter) { if (converter != null) { if (component instanceof UIDataAdaptor) { UIDataAdaptor data = (UIDataAdaptor) component; if (!converter.isLiteralText()) { component.setValueExpression("rowKeyConverter", converter); } else { Converter conv = FacesContext.getCurrentInstance().getApplication() .createConverter(converter.getExpressionString()); data.setRowKeyConverter(conv); }//from ww w . j a va 2 s. c om } else { throw new IllegalArgumentException( Messages.getMessage(Messages.NO_DATA_ADAPTOR, component.getClass().getName())); } } }