List of usage examples for javax.el ValueExpression getValue
public abstract Object getValue(ELContext context);
From source file:org.ajax4jsf.component.AjaxRegionBrige.java
public boolean isSelfRendered() { if (this.selfRenderedSet) { return (this.selfRendered); }//from w w w.j a va2 s.c o m ValueExpression vb = component.getValueExpression("selfRendered"); if (vb != null) { return (Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance().getELContext()))); } else { return (this.selfRendered); } }
From source file:org.nuxeo.ecm.platform.ui.web.component.UISelectItem.java
protected String retrieveItemLabel() { FacesContext ctx = FacesContext.getCurrentInstance(); Locale locale = ctx.getViewRoot().getLocale(); String label = null;//from w ww. jav a 2 s . co m if (isdbl10n()) { Map<String, String> labels = getItemLabels(); if (labels != null) { if (labels.containsKey(locale.getLanguage())) { label = labels.get(locale.getLanguage()); } else { // fallback on en label = labels.get("en"); } } } if (StringUtils.isBlank(label)) { Object labelObject = getItemLabel(); label = labelObject != null ? labelObject.toString() : null; } if (isResolveItemLabelTwice() && ComponentTagUtils.isValueReference(label)) { ValueExpression ve = ctx.getApplication().getExpressionFactory() .createValueExpression(ctx.getELContext(), label, Object.class); if (ve != null) { Object newLabel = ve.getValue(ctx.getELContext()); if (newLabel instanceof String) { label = (String) newLabel; } } } if (isLocalize()) { label = translate(ctx, locale, label); } return label; }
From source file:org.richfaces.component.UIComponentControl.java
public boolean isDisableDefault() { if (this.disableDefaultSet) { return (this.disableDefault); }/*from w ww.ja v a 2 s. c o m*/ ValueExpression ve = getValueExpression("disableDefault"); if (ve != null) { Boolean value = null; try { value = (Boolean) ve.getValue(getFacesContext().getELContext()); } catch (ELException e) { throw new FacesException(e); } if (null != value) { return value.booleanValue(); } } String event = getEvent(); return ("contextmenu".equalsIgnoreCase(event) || "oncontextmenu".equalsIgnoreCase(event)); }
From source file:org.apache.myfaces.custom.aliasbean.AliasBean.java
/** * The existing value that the alias can be set to. This can be * a literal string (like "toto") or a reference to an existing * bean (like "#{myBean.member1}")./* w w w .jav a 2 s. c om*/ * */ @JSFProperty(deferredValueType = "java.lang.Object") public String getValue() { String valueExpression = alias.getValueExpression(); if (valueExpression != null) return valueExpression; // Normally, this component will have no value, because the setValue method always // passes that data on to the alias instead. However it is possible for someone // to use f:attribute (or other mechanism?) to set the value instead. So when the // alias has no value, look for it there. ValueExpression vb = getValueExpression("value"); return vb != null ? (String) vb.getValue(getFacesContext().getELContext()) : null; }
From source file:velo.uiComponents.XMLTagInput.java
/** * <p>Return the client identifier of the component for which * this component represents associated message(s) (if any).</p> *//* w w w. j a v a 2 s .com*/ public String getFor() { if (this.forVal != null) { return this.forVal; } ValueExpression ve = getValueExpression("for"); 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.binding.alias.AliasTagHandler.java
protected boolean isAnchored(FaceletContext ctx) { if (cache != null && cache.getBoolean(ctx)) { return false; }// w ww .j a va 2 s .c o m ExpressionFactory eFactory = ctx.getExpressionFactory(); ValueExpression ve = eFactory.createValueExpression(ctx, "#{" + ANCHOR_ENABLED_VARIABLE + "}", Boolean.class); if (Boolean.TRUE.equals(ve.getValue(ctx))) { return true; } if (anchor != null) { return anchor.getBoolean(ctx); } return false; }
From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java
protected String getStringValue(FacesContext context, ValueExpression vb) { Object value = vb.getValue(context.getELContext()); if (value != null) { return value.toString(); }// w w w .j a v a 2 s. c om return null; }
From source file:org.exoplatform.portal.gadget.core.GateInJsonContainerConfig.java
@Override public Object getProperty(String container, String property) { if (property.startsWith("${")) { // An expression! try {// ww w. j a v a 2s . co m ValueExpression expression = expressions.parse(property, Object.class); return expression.getValue(createExpressionContext(container)); } catch (ELException e) { return null; } } Map<String, Object> containerData = getProperties(container); if (containerData == null) { return null; } return containerData.get(property); }
From source file:org.apache.shindig.config.JsonContainerConfig.java
@Override public Object getProperty(String container, String property) { if (property.startsWith("${")) { // An expression! try {/*from ww w. j a v a 2s . c o m*/ ValueExpression expression = expressions.parse(property, Object.class); return expression.getValue(createExpressionContext(container)); } catch (ELException e) { return null; } } Map<String, Object> containerData = config.get(container); if (containerData == null) { return null; } return containerData.get(property); }
From source file:org.nuxeo.ecm.platform.ui.web.directory.DirectoryAwareComponent.java
protected Boolean getBooleanValue(String name, boolean defaultValue) { ValueExpression ve = getValueExpression(name); if (ve != null) { try {// ww w . j a v a2s.co m return !Boolean.FALSE.equals(ve.getValue(getFacesContext().getELContext())); } catch (ELException e) { throw new FacesException(e); } } else { return defaultValue; } }