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.nuxeo.ecm.automation.core.operations.services.DocumentPageProviderOperation.java

/**
 * Resolves additional parameters that could have been defined in the contribution.
 *
 * @param parameters parameters from the operation
 * @since 5.8//from  w  w w.j a va  2 s.co m
 */
private Object[] resolveParameters(Object[] parameters) {
    ActionContext actionContext = (ActionContext) context.get(GetActions.SEAM_ACTION_CONTEXT);
    if (actionContext == null) {
        // if no Seam Context has been initialized, don't do evaluation
        return parameters;
    }

    // resolve additional parameters
    PageProviderDefinition ppDef = ppService.getPageProviderDefinition(providerName);
    String[] params = ppDef.getQueryParameters();
    if (params == null) {
        params = new String[0];
    }

    Object[] resolvedParams = new Object[params.length + (parameters != null ? parameters.length : 0)];

    ELContext elContext = Framework.getService(ELService.class).createELContext();

    int i = 0;
    if (parameters != null) {
        i = parameters.length;
        System.arraycopy(parameters, 0, resolvedParams, 0, i);
    }
    for (int j = 0; j < params.length; j++) {
        ValueExpression ve = ELActionContext.EXPRESSION_FACTORY.createValueExpression(elContext, params[j],
                Object.class);
        resolvedParams[i + j] = ve.getValue(elContext);
    }
    return resolvedParams;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public Boolean getRightToLeft() {
    if (_rightToLeft != null)
        return _rightToLeft;
    ValueExpression expression = getValueExpression("rightToLeft");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            return (Boolean) value;
        }//from w w w .ja v  a  2s.  c  o m
    }
    return Boolean.FALSE;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public TimeZone getTimezone() {
    if (_timezone != null)
        return _timezone;
    ValueExpression expression = getValueExpression("timezone");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            if (value instanceof TimeZone) {
                return DateUtils.getSupportedTimeZone(value.toString());
            } else {
                return (TimeZone) value;
            }//from  w  w w  .j a v  a2  s.com
        }
    }
    return null;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public Character getDecimalSeparator() {
    if (_decimalSeparator != null)
        return _decimalSeparator;
    ValueExpression expression = getValueExpression("decimalSeparator");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            return (Character) value;
        }/*w ww.ja v a2 s .  c  om*/
    }
    return null;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public Boolean getAnimationEnabled() {
    if (_animationEnabled != null)
        return _animationEnabled;
    ValueExpression expression = getValueExpression("animationEnabled");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            return (Boolean) value;
        }/* ww w.  ja v  a 2s  . com*/
    }
    return Boolean.TRUE;
}

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

public VocabularyEntryList getDirectoryValues() {
    ValueExpression ve = getValueExpression("directoryValues");
    if (ve != null) {
        try {//w  w w  .ja  v a  2 s.c  o  m
            return (VocabularyEntryList) ve.getValue(getFacesContext().getELContext());
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        // default value
        return null;
    }
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public AccessibilityProfile getAccessibilityProfile() {
    if (_accessibilityProfile != null)
        return _accessibilityProfile;
    ValueExpression expression = getValueExpression("accessibilityProfile");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            return (AccessibilityProfile) value;
        }/*from  w  w w. j a v a2  s  . c o m*/
    }
    return null;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public Locale getFormattingLocale() {
    if (_formattingLocale != null)
        return _formattingLocale;
    ValueExpression expression = getValueExpression("formattingLocale");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            if (value instanceof Locale) {
                return (Locale) value;
            } else {
                return LocaleUtils.getLocaleForIANAString(value.toString().replace('_', '-'));
            }//w w w.  jav a2  s. c o m
        }
    }
    return null;
}

From source file:org.apache.myfaces.custom.skin.context.RequestContextBean.java

public Character getNumberGroupingSeparator() {
    if (_numberGroupingSeparator != null)
        return _numberGroupingSeparator;
    ValueExpression expression = getValueExpression("numberGroupingSeparator");
    if (expression != null) {
        Object value = expression.getValue(getFacesContext().getELContext());
        if (value != null) {
            return (Character) value;
        }//from ww  w .  j  ava2  s  .c  o m
    }
    return null;
}

From source file:org.nuxeo.ecm.platform.ui.web.component.holder.UIValueHolder.java

public Boolean getSubmitValue() {
    if (submitValue != null) {
        return submitValue;
    }/*from   ww  w  .j  a  v a  2  s .  c  o m*/
    ValueExpression ve = getValueExpression("submitValue");
    if (ve != null) {
        try {
            return Boolean.valueOf(Boolean.TRUE.equals(ve.getValue(getFacesContext().getELContext())));
        } catch (ELException e) {
            throw new FacesException(e);
        }
    } else {
        return Boolean.TRUE;
    }
}