List of usage examples for javax.el ValueExpression getValue
public abstract Object getValue(ELContext context);
From source file:org.nuxeo.ecm.platform.ui.web.component.date.UIInputDateTime.java
public String getFormat() { if (format != null) { return format; }//w w w.j a va2 s . co m ValueExpression ve = getValueExpression("format"); if (ve != null) { try { return (String) ve.getValue(getFacesContext().getELContext()); } catch (ELException e) { throw new FacesException(e); } } else { // default value return "dd/MM/yyyy HH:mm"; } }
From source file:org.jspringbot.keyword.expression.ExpressionHelper.java
public Object getValue(Object result) { DefaultELContext context = new DefaultELContext(functionManager, getVariables()); ValueExpression expr = factory.createValueExpression(result, TypeExpressionHolder.peek()); return expr.getValue(context); }
From source file:org.nuxeo.ecm.platform.ui.web.component.date.UIInputDateTime.java
public String getTimeZone() { if (timeZone != null) { return timeZone; }/*from ww w . java 2s. com*/ ValueExpression ve = getValueExpression("timeZone"); if (ve != null) { try { Object t = ve.getValue(getFacesContext().getELContext()); if (t instanceof TimeZone) { timeZone = ((TimeZone) t).getID(); } else if (t instanceof String) { timeZone = (String) t; } } catch (ELException e) { throw new FacesException(e); } } else { // default value timeZone = TimeZone.getDefault().getID(); } return timeZone; }
From source file:de.openknowledge.extensions.jsf.model.ModelMethod.java
@Override public void updateModel(FacesContext context) { ValueExpression expression = getValueExpression("value"); SimpleMethodExpressionParser parser = new SimpleMethodExpressionParser(expression.getExpressionString()); SimpleMethodExpression methodExpression = parser.parse(); ExpressionFactory expressionFactory = notNull(context, "context may not be null").getApplication() .getExpressionFactory();/*from ww w .j av a 2 s. c om*/ ValueExpression baseExpression = expressionFactory.createValueExpression(context.getELContext(), "#{" + methodExpression.getBase() + '}', Object.class); Object baseValue = baseExpression.getValue(context.getELContext()); Class<? extends Object> baseType = baseValue.getClass(); UIInput[] parameterComponents = findComponents(methodExpression); Class<?>[] parameterTypes = findParameterTypes(context, methodExpression, expressionFactory, parameterComponents); Method method = findMethod(baseType, methodExpression.getMethodName(), parameterTypes); Object[] parameters = findParameters(context, methodExpression, expressionFactory, parameterComponents, parameterTypes); try { method.invoke(baseValue, parameters); } catch (InvocationTargetException e) { throw new ELException(e.getTargetException()); } catch (Exception e) { throw new ELException(e); } }
From source file:org.nuxeo.ecm.platform.ui.web.component.date.UIInputDateTime.java
public String getTriggerLabel() { if (triggerLabel != null) { return triggerLabel; }//from w w w.ja va2s. c o m ValueExpression ve = getValueExpression("triggerLabel"); if (ve != null) { try { return (String) ve.getValue(getFacesContext().getELContext()); } catch (ELException e) { throw new FacesException(e); } } else { // default value return "..."; } }
From source file:org.nuxeo.ecm.platform.ui.web.component.seam.UICellExcel.java
/** * Returns the style attribute, used to format cells with a specific {@link #forceType}. Sample value for dates * formatting: "xls-format-mask: #{nxu:basicDateFormatter()};". * * @since 5.6//from w ww.java2 s . c o m */ @Override public String getStyle() { if (style != null) { return style; } ValueExpression ve = getValueExpression("style"); 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.date.UIInputDateTime.java
public Boolean getShowsTime() { if (showsTime != null) { return showsTime; }/*from w w w .j a v a2 s . c o m*/ ValueExpression ve = getValueExpression("showsTime"); if (ve != null) { try { return !Boolean.FALSE.equals(ve.getValue(getFacesContext().getELContext())); } catch (ELException e) { throw new FacesException(e); } } else { // default value return true; } }
From source file:org.nuxeo.ecm.platform.ui.web.component.seam.UICellExcel.java
/** * Returns the force type attribute, used to force cell type to "date" or "number" for instance. * * @since 5.6// w w w .ja va 2s. c o m */ public String getForceType() { if (forceType != null) { return forceType; } ValueExpression ve = getValueExpression("forceType"); if (ve != null) { try { return (String) ve.getValue(getFacesContext().getELContext()); } catch (ELException e) { throw new FacesException(e); } } else { return null; } }
From source file:pl.umk.mat.zawodyweb.www.FaceletErrorHandler.java
@Override public String getActionURL(FacesContext context, String viewId) { String result = super.getActionURL(context, viewId); if (result.contains("#{")) { ExpressionFactory expressionFactory = context.getApplication().getExpressionFactory(); ValueExpression valueExpression = expressionFactory.createValueExpression(context.getELContext(), viewId, String.class); ExternalContext externalContext = context.getExternalContext(); String contextPath = externalContext.getRequestContextPath(); result = contextPath + ((String) valueExpression.getValue(context.getELContext())); }//from ww w .j a va 2 s . c o m return result; }
From source file:org.ajax4jsf.component.AjaxRegionBrige.java
public boolean isImmediate() { if (this.immediateSet) { return (this.immediate); }//from ww w. j av a 2 s.c o m ValueExpression vb = component.getValueExpression("immediate"); if (vb != null) { return (Boolean.TRUE.equals(vb.getValue(FacesContext.getCurrentInstance().getELContext()))); } else { return (this.immediate); } }