List of usage examples for javax.el ValueExpression setValue
public abstract void setValue(ELContext context, Object value);
From source file:org.nuxeo.ecm.platform.ui.web.util.ComponentTagUtils.java
/** * Resolves given value expression as string and sets given value on it. * * @since 6.0//from ww w .j a va2 s.c om */ public static void applyValueExpression(FacesContext context, String elExpression, Object value) { if (!isStrictValueReference(elExpression)) { log.warn("Cannot set value '" + value + "' for expression '" + elExpression + "'"); } else { if (context == null) { log.error("FacesContext is null => cannot resolve el expression '" + elExpression + "'"); return; } Application app = context.getApplication(); ExpressionFactory eFactory = app.getExpressionFactory(); ELContext elContext = context.getELContext(); try { ValueExpression vExpression = eFactory.createValueExpression(elContext, elExpression, Object.class); vExpression.setValue(elContext, value); } catch (ELException e) { log.error("Error setting value '" + value + "' for expression '" + elExpression + "'", e); } } }
From source file:org.primefaces.extensions.showcase.controller.dynaform.ClearInputsExecutor.java
/** * @see org.primefaces.extensions.util.visitcallback.VisitTaskExecutor *///from w w w. j a va2 s . c om public VisitResult execute(UIComponent component) { UIInput input = (UIInput) component; String id = input.getId(); // reset UI input.resetValue(); // reset value in bean if ("tableColumn".equals(id) || "inputValue".equals(id)) { ValueExpression ve = input.getValueExpression("value"); if (ve != null) { ve.setValue(elContext, StringUtils.EMPTY); } } else if ("inputOffset".equals(id)) { ValueExpression ve = input.getValueExpression("value"); if (ve != null) { ve.setValue(elContext, 0); } } else if ("valueOperator".equals(id)) { ValueExpression ve = input.getValueExpression("value"); if (ve != null) { ve.setValue(elContext, "eq"); } } // update the corresponding input during response requestContext.update(input.getClientId()); // delete handled id from the list, so that similar inputs should not be executed again ArrayUtils.removeElement(ids, id); return (ids.length != 0) ? VisitResult.REJECT : VisitResult.COMPLETE; }
From source file:org.nuxeo.ecm.platform.ui.web.binding.alias.AliasValueExpression.java
@Override public void setValue(ELContext context, Object value) { ValueExpression ve = resolveExpression(context); if (ve != null) { ve.setValue(context, value); }/* ww w.j av a 2 s.c o m*/ if (log.isDebugEnabled()) { log.debug("Resolved expression var='" + var + "' for mapper with id '" + id + "' and set value: " + value); } }
From source file:com.googlecode.jsfFlex.component.AbstractFlexUITextInputBase.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;//from w w w .java 2 s . c o m } javax.el.ValueExpression ve = getValueExpression(TEXT_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getText()); setText(null); } }
From source file:com.googlecode.jsfFlex.component.AbstractFlexUISelectedBase.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;/*from www . j av a2s . c o m*/ } javax.el.ValueExpression ve = getValueExpression(SELECTED_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getSelected()); setSelected(null); } }
From source file:com.googlecode.jsfFlex.component.ext.AbstractFlexUIColorPicker.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;//from w ww . jav a 2 s . c om } ValueExpression ve = getValueExpression(SELECTED_COLOR_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getSelectedColor()); setSelectedColor(null); } }
From source file:com.googlecode.jsfFlex.component.AbstractFlexUISelectedIndexBase.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;/*from w w w . j a v a2s.c o m*/ } javax.el.ValueExpression ve = getValueExpression(SELECTED_INDEX_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getSelectedIndex()); setSelectedIndex(null); } }
From source file:com.googlecode.jsfFlex.component.AbstractFlexUIHtmlTextInputBase.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;/*from w w w.j av a 2 s. c o m*/ } javax.el.ValueExpression ve = getValueExpression(HTML_TEXT_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getHtmlText()); setHtmlText(null); } }
From source file:org.apache.myfaces.custom.aliasbean.Alias.java
/** * Deactivate this alias (ie remove the temporary name). */// ww w .j a va 2s. c o m void remove(FacesContext facesContext) { _active = false; if (evaluatedExpression == null) return; evaluatedExpression = null; log.debug("removeAlias: " + _valueExpression + " != " + _aliasBeanExpression); ValueExpression aliasVB = _aliasComponent.getValueExpression("alias"); if (aliasVB != null) aliasVB.setValue(facesContext.getELContext(), null); }
From source file:com.googlecode.jsfFlex.component.ext.AbstractFlexUIDateChooser.java
@Override public void processUpdates(FacesContext context) { super.processUpdates(context); if (!isRendered() || !isValid()) { return;//from w w w . j a v a2 s. c o m } javax.el.ValueExpression ve = getValueExpression(SELECTED_DATE_ATTR); if (ve != null && !ve.isReadOnly(context.getELContext())) { ve.setValue(context.getELContext(), getSelectedDate()); setSelectedDate(null); } }