List of usage examples for javax.el ValueExpression getValue
public abstract Object getValue(ELContext context);
From source file:org.jbuilt.components.html.raw.base.AbstractCommandComponent.java
@SuppressWarnings("unchecked") public <T> T getExpressionValue(UIComponent component, String attribute, T overrideValue, T defaultValue) { if (overrideValue != null) { return overrideValue; }/*from ww w . j a v a 2 s . com*/ ValueExpression ve = component.getValueExpression(attribute); if (ve != null) { return (T) ve.getValue(getFacesContext().getELContext()); } return defaultValue; }
From source file:org.jbuilt.components.html.raw.base.AbstractCommandComponent.java
public String getAcceptcharset() { if (acceptcharset != null) { return acceptcharset; }// w w w . j a v a 2 s.com ValueExpression vb = getValueExpression("acceptcharset"); if (vb != null) { return (String) vb.getValue(getFacesContext().getELContext()); } return null; }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
/** * Gets model name exposed in request map. *///w ww .ja v a 2 s. c o m public String getModel() { if (model != null) { return model; } ValueExpression ve = getValueExpression("model"); if (ve != null) { try { return (String) ve.getValue(getFacesContext().getELContext()); } catch (ELException e) { throw new FacesException(e); } } else { return null; } }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
public Integer getNumber() { if (number != null) { return number; }//w ww .j a va 2 s .c om ValueExpression ve = getValueExpression("number"); if (ve != null) { try { return ((Number) ve.getValue(getFacesContext().getELContext())).intValue(); } catch (ELException e) { throw new FacesException(e); } } else { // default value return null; } }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
/** * Gets template to be used when adding new values to the model. *///w w w.ja v a2 s . c o m public Object getTemplate() { if (template != null) { return template; } ValueExpression ve = getValueExpression("template"); if (ve != null) { try { Object res = ve.getValue(getFacesContext().getELContext()); if (res instanceof String) { // try to resolve a second time in case it's an expression res = ComponentTagUtils.resolveElExpression(getFacesContext(), (String) res); } return res; } catch (ELException e) { throw new FacesException(e); } } else { return null; } }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
/** * Gets boolean stating if diff must be used when saving the value submitted. *///from w ww .ja v a 2s .co m public Boolean getDiff() { if (diff != null) { return diff; } ValueExpression ve = getValueExpression("diff"); if (ve != null) { try { return !Boolean.FALSE.equals(ve.getValue(getFacesContext().getELContext())); } catch (ELException e) { throw new FacesException(e); } } else { // default value return false; } }
From source file:org.jbuilt.components.html.raw.base.AbstractFormComponent.java
/** * @return the value//w w w . java2s .c o m */ public Object getValue() { if (value != null) { return value; } ValueExpression vb = getValueExpression("value"); if (vb != null) { return vb.getValue(getFacesContext().getELContext()); } return null; }
From source file:org.nuxeo.ecm.platform.ui.web.component.list.UIEditableList.java
public Boolean getRemoveEmpty() { if (removeEmpty != null) { return removeEmpty; }//from w w w . j a v a 2 s . c o m ValueExpression ve = getValueExpression("removeEmpty"); if (ve != null) { try { return !Boolean.FALSE.equals(ve.getValue(getFacesContext().getELContext())); } catch (ELException e) { throw new FacesException(e); } } else { // default value return false; } }
From source file:org.jbuilt.components.html.raw.base.AbstractFormComponent.java
@SuppressWarnings("unchecked") public <T> T getExpressionValue(UIComponent component, String attribute, T overrideValue, T defaultValue) { component = this; if (overrideValue != null) { return overrideValue; }/*from ww w. java2 s .c o m*/ ValueExpression ve = component.getValueExpression(attribute); if (ve != null) { return (T) ve.getValue(getFacesContext().getELContext()); } return defaultValue; }
From source file:org.crank.javax.faces.component.MenuRenderer.java
public Object convertSelectManyValue(FacesContext context, UISelectMany uiSelectMany, String[] newValues) throws ConverterException { // if we have no local value, try to get the valueExpression. ValueExpression valueExpression = uiSelectMany.getValueExpression("value"); Object result = newValues; // default case, set local value Class<?> modelType = null; boolean throwException = false; // If we have a ValueExpression if (null != valueExpression) { modelType = valueExpression.getType(context.getELContext()); // Does the valueExpression resolve properly to something with // a type? if (modelType != null) { result = convertSelectManyValuesForModel(context, uiSelectMany, modelType, newValues); }//from www. j a v a2s.c o m // If it could not be converted, as a fall back try the type of // the valueExpression's current value covering some edge cases such // as where the current value came from a Map. if (result == null) { Object value = valueExpression.getValue(context.getELContext()); if (value != null) { result = convertSelectManyValuesForModel(context, uiSelectMany, value.getClass(), newValues); } } if (result == null) { throwException = true; } } else { // No ValueExpression, just use Object array. result = convertSelectManyValues(context, uiSelectMany, Object[].class, newValues); } if (throwException) { StringBuffer values = new StringBuffer(); if (null != newValues) { for (int i = 0; i < newValues.length; i++) { if (i == 0) { values.append(newValues[i]); } else { values.append(' ').append(newValues[i]); } } } Object[] params = { values.toString(), valueExpression.getExpressionString() }; throw new ConverterException( MessageUtils.getExceptionMessage(MessageUtils.CONVERSION_ERROR_MESSAGE_ID, params)); } // At this point, result is ready to be set as the value if (logger.isLoggable(Level.FINE)) { logger.fine("SelectMany Component " + uiSelectMany.getId() + " convertedValues " + result); } return result; }