Example usage for javax.el ValueExpression getValue

List of usage examples for javax.el ValueExpression getValue

Introduction

In this page you can find the example usage for javax.el ValueExpression getValue.

Prototype

public abstract Object getValue(ELContext context);

Source Link

Usage

From source file:org.apache.myfaces.custom.aliasbean.Alias.java

private void computeEvaluatedExpression(FacesContext facesContext) {
    if (evaluatedExpression != null)
        return;//ww  w . j av  a2  s .  c  om

    ValueExpression valueVB = null;
    if (_valueExpression == null) {
        valueVB = _aliasComponent.getValueExpression("value");
        _valueExpression = valueVB.getExpressionString();
    }

    if (valueVB == null) {
        if (_valueExpression.startsWith("#{")) {
            valueVB = facesContext.getApplication().getExpressionFactory()
                    .createValueExpression(facesContext.getELContext(), _valueExpression, Object.class);
            evaluatedExpression = valueVB.getValue(facesContext.getELContext());
        } else {
            evaluatedExpression = _valueExpression;
        }
    } else {
        evaluatedExpression = valueVB.getValue(facesContext.getELContext());
    }
}

From source file:com.jsmartframework.web.manager.ExpressionHandler.java

private Object evaluateExpression(String expr) {
    if (expr == null) {
        return expr;
    }//from   ww w . ja v  a 2s.c o m

    String[] exprs = expr.split(Constants.EL_SEPARATOR, 2);
    if (exprs.length == 2 && WebText.containsResource(exprs[0])) {
        return WebText.getString(exprs[0], exprs[1]);
    }

    String jspExpr = String.format(Constants.JSP_EL, expr);

    ELContext context = WebContext.getPageContext().getELContext();
    ValueExpression valueExpr = WebContext.getExpressionFactory().createValueExpression(context, jspExpr,
            Object.class);
    Object obj = valueExpr.getValue(context);

    if (obj instanceof String) {
        String[] objs = obj.toString().split(Constants.EL_SEPARATOR, 2);
        if (objs.length == 2 && WebText.containsResource(objs[0])) {
            return WebText.getString(objs[0], objs[1]);
        }
    }
    return obj;
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public String getStyle() {
    ValueExpression ve = getValueExpression("style");
    if (ve != null) {
        return (String) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {/*from  w  w  w. j a  v a 2 s .c o m*/
        return style;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public String getDisplay() {
    ValueExpression ve = getValueExpression("display");
    if (ve != null) {
        return (String) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {//from   w ww.jav a2 s. co  m
        return display != null ? display : DISPLAY_LABEL;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public String getReRender() {
    ValueExpression ve = getValueExpression("reRender");
    if (ve != null) {
        return (String) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {/*from   ww  w.ja  v  a  2 s.com*/
        return reRender;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public String getStyleClass() {
    ValueExpression ve = getValueExpression("styleClass");
    if (ve != null) {
        return (String) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {/*  w  w w .j a  v a  2s  .  c  o  m*/
        return styleClass;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public String getKeySeparator() {
    ValueExpression ve = getValueExpression("keySeparator");
    if (ve != null) {
        return (String) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {/*from  w  w  w .  j  a  v a2s.co  m*/
        return keySeparator;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public int getListboxSize() {
    ValueExpression ve = getValueExpression("listboxSize");
    if (ve != null) {
        return (Integer) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {/*from  www  .j  a  va 2  s. com*/
        return listboxSize;
    }
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public int getDepth() {
    int myDepth;/* w ww . j  a  va2  s  .  c o  m*/
    ValueExpression ve = getValueExpression("depth");
    if (ve != null) {
        myDepth = (Integer) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {
        myDepth = depth;
    }

    return myDepth != 0 ? myDepth : getDirectories().length;
}

From source file:org.nuxeo.ecm.platform.ui.web.directory.ChainSelectBase.java

public boolean getShowObsolete() {
    ValueExpression ve = getValueExpression("showObsolete");
    if (ve != null) {
        return (Boolean) ve.getValue(FacesContext.getCurrentInstance().getELContext());
    } else {//from   w w w .  java  2 s  .  co  m
        return showObsolete;
    }
}