Package javax.el

Examples of javax.el.MethodExpression


  if (this._filterMethod != null) {
    return this._filterMethod;
  }
  ValueExpression ve = getValueExpression("filterMethod");
  if (ve != null) {
      MethodExpression value = null;
     
      try {
      value = (MethodExpression) ve.getValue(getFacesContext().getELContext());
      } catch (ELException e) {
      throw new FacesException(e);
View Full Code Here


this._accesskey = _accesskey;
}

@SuppressWarnings("deprecation")
public MethodBinding getAction(){
  MethodExpression expression = getActionExpression();
  if (expression instanceof org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor) {
    return ((org.richfaces.webapp.taglib.MethodExpressionMethodBindingAdaptor) expression).getBinding();
  } else if (expression != null) {
    return new org.richfaces.webapp.taglib.MethodBindingMethodExpressionAdaptor(expression);
  }
View Full Code Here

  public void setTip(java.lang.String tip) {
    this.tip = tip;
  }

  public javax.faces.el.MethodBinding getSuggestMethod() {
    MethodExpression expression = getSuggestMethodExpression();
    if (expression instanceof MethodBindingToMethodExpression) {
      return ((MethodBindingToMethodExpression)expression).getMethodBinding();
    }
    if (expression != null) {
       return new MethodExpressionToMethodBinding(expression);
View Full Code Here

  public void setDirectLinkCount(java.lang.Integer directLinkCount) {
    this.directLinkCount = directLinkCount;
  }

  public javax.faces.el.MethodBinding getSortActionListener() {
    MethodExpression expression = getSortActionListenerExpression();
    if (expression instanceof MethodBindingToMethodExpression) {
      return ((MethodBindingToMethodExpression)expression).getMethodBinding();
    }
    if (expression != null) {
       return new MethodExpressionToMethodBinding(expression);
View Full Code Here

    final UISuggest suggest = (UISuggest) component;
    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
    final String id  = suggest.getClientId(facesContext);
    final UIIn in = (UIIn) suggest.getParent();
    final MethodExpression suggestMethodExpression = suggest.getSuggestMethodExpression();
    final AutoSuggestItems items
        = createAutoSuggestItems(suggestMethodExpression.invoke(facesContext.getELContext(), new Object[]{in}));
    // todo: declare unused/unsupported stuff deprecated

    writer.startElement(HtmlElements.DIV, null);
    writer.writeClassAttribute(Classes.create(suggest));
    writer.writeIdAttribute(id);
View Full Code Here

              break;
            }
          }
          if (expressionString != null) {
            ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
            MethodExpression action = new TagMethodExpression(value, expressionFactory.createMethodExpression(
                faceletContext, expressionString, String.class, ComponentUtils.ACTION_ARGS));
            ((ActionSource2) parent).setActionExpression(action);
          }
        } else if ("actionListener".equals(mode.getValue())) {
          String expressionString = value.getValue();
          while (isSimpleExpression(expressionString)) {
            if (isMethodOrValueExpression(expressionString)) {
              ValueExpression expression
                  = faceletContext.getVariableMapper().resolveVariable(removeElParenthesis(expressionString));
              if (expression == null) {
                if (LOG.isDebugEnabled()) {
                  // when the action hasn't been set while using a composition.
                  LOG.debug("Variable can't be resolved: value='" + expressionString + "'");
                }
                expressionString = null;
                break;
              } else {
                expressionString = expression.getExpressionString();
              }
            } else {
              LOG.warn("Only expressions are supported mode=actionListener value='" + expressionString + "'");
              expressionString = null;
              break;
            }
          }
          if (expressionString != null) {
            ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
            MethodExpression actionListener = new TagMethodExpression(value, expressionFactory.createMethodExpression(
                faceletContext, expressionString, null, ComponentUtils.ACTION_LISTENER_ARGS));
            ((ActionSource) parent).addActionListener(new MethodExpressionActionListener(actionListener));
          }
        } else if ("actionFromValue".equals(mode.getValue())) {
          if (!value.isLiteral()) {
            String result = value.getValue(faceletContext);
            parent.getAttributes().put(name.getValue(), new ConstantMethodBinding(result));
          }
        } else if ("valueIfSet".equals(mode.getValue())) {
          String expressionString = value.getValue();
          String lastExpressionString = null;
          while (isMethodOrValueExpression(expressionString) && isSimpleExpression(expressionString)) {
            ValueExpression expression
                = faceletContext.getVariableMapper().resolveVariable(removeElParenthesis(expressionString));
            if (expression != null) {
              lastExpressionString = expressionString;
              expressionString = expression.getExpressionString();
            } else {
              // restore last value
              expressionString = lastExpressionString;
              break;
            }
          }
          if (expressionString != null) {
            final String attributeName = name.getValue(faceletContext);
            if (containsMethodOrValueExpression(expressionString)) {
              ValueExpression expression = value.getValueExpression(faceletContext, Object.class);
              parent.setValueExpression(attributeName, expression);
            } else {
              final Object literalValue = getValue(faceletContext, parent, expressionString, attributeName);
              parent.getAttributes().put(attributeName, literalValue);
            }
          }
        } else {
          throw new FacesException("Type " + mode + " not supported");
        }
      } else {

        String nameValue = name.getValue(faceletContext);
        if (Attributes.RENDERED.equals(nameValue)) {
          if (value.isLiteral()) {
            parent.setRendered(value.getBoolean(faceletContext));
          } else {
            parent.setValueExpression(nameValue, value.getValueExpression(faceletContext, Boolean.class));
          }
        } else if (Attributes.RENDERED_PARTIALLY.equals(nameValue)
            && parent instanceof SupportsRenderedPartially) {

          if (value.isLiteral()) {
            String[] components = ComponentUtils.splitList(value.getValue());
            ((SupportsRenderedPartially) parent).setRenderedPartially(components);
          } else {
            parent.setValueExpression(nameValue, value.getValueExpression(faceletContext, Object.class));
          }
        } else if (Attributes.STYLE_CLASS.equals(nameValue)) {
          // TODO expression
          ComponentUtils.setStyleClasses(parent, value.getValue());
        } else if (Attributes.MARKUP.equals(nameValue)) {
          if (parent instanceof SupportsMarkup) {
            if (value.isLiteral()) {
              ((SupportsMarkup) parent).setMarkup(Markup.valueOf(value.getValue()));
            } else {
              ValueExpression expression = value.getValueExpression(faceletContext, Object.class);
              parent.setValueExpression(nameValue, expression);
            }
          } else {
            LOG.error("Component is not instanceof SupportsMarkup. Instance is: " + parent.getClass().getName());
          }
        } else if (parent instanceof EditableValueHolder && Attributes.VALIDATOR.equals(nameValue)) {
          MethodExpression methodExpression = getMethodExpression(faceletContext, null, ComponentUtils.VALIDATOR_ARGS);
          if (methodExpression != null) {
            ((EditableValueHolder) parent).addValidator(new MethodExpressionValidator(methodExpression));
          }
        } else if (parent instanceof EditableValueHolder
            && Attributes.VALUE_CHANGE_LISTENER.equals(nameValue)) {
          MethodExpression methodExpression =
              getMethodExpression(faceletContext, null, ComponentUtils.VALUE_CHANGE_LISTENER_ARGS);
          if (methodExpression != null) {
            ((EditableValueHolder) parent).addValueChangeListener(
                new MethodExpressionValueChangeListener(methodExpression));
          }
        } else if (parent instanceof ValueHolder && Attributes.CONVERTER.equals(nameValue)) {
          setConverter(faceletContext, parent, nameValue);
        } else if (parent instanceof ActionSource && Attributes.ACTION.equals(nameValue)) {
          MethodExpression action = getMethodExpression(faceletContext, String.class, ComponentUtils.ACTION_ARGS);
          if (action != null) {
            ((ActionSource2) parent).setActionExpression(action);
          }
        } else if (parent instanceof ActionSource && Attributes.ACTION_LISTENER.equals(nameValue)) {
          MethodExpression action = getMethodExpression(faceletContext, null, ComponentUtils.ACTION_LISTENER_ARGS);
          if (action != null) {
            ((ActionSource) parent).addActionListener(new MethodExpressionActionListener(action));
          }
        } else if (!parent.getAttributes().containsKey(nameValue)) {
          if (value.isLiteral()) {
View Full Code Here

         facesContext.addMessage(null, facesMessage);
      }
      UIComponent source = event.getComponent();
      ActionSource2 actionSource = (ActionSource2) source;
      Application application = facesContext.getApplication();
      MethodExpression expression = actionSource.getActionExpression();
      // Retrieve the NavigationHandler instance..
      NavigationHandler navHandler = application.getNavigationHandler();
      // Invoke nav handling..
      String navBinding = (null != expression) ? expression.getExpressionString() : null;
      navHandler.handleNavigation(facesContext, navBinding, errorOutcome);
      // Trigger a switch to Render Response if needed
      facesContext.renderResponse();
    }
  }
View Full Code Here

        }

        if (params == null)
            params = new Class[0];

        MethodExpression methodExpression;

        try
        {
            methodExpression = getExpressionFactory().createMethodExpression(threadELContext(), reference,
                    Object.class, params);
View Full Code Here

     *
     * @deprecated Use getActionExpression() instead.
     */
    public MethodBinding getAction()
    {
        MethodExpression actionExpression = getActionExpression();
        if (actionExpression instanceof _MethodBindingToMethodExpression)
        {
            return ((_MethodBindingToMethodExpression) actionExpression)
                    .getMethodBinding();
        }
View Full Code Here

                        }
                    }

                    String[] targetsArray = StringUtils.splitShortString(targets, ' ');
                    String attributeExpressionString = attributeNameValueExpression.getExpressionString();
                    MethodExpression methodExpression = null;
                    MethodExpression methodExpression2 = null;

                    //Check if the stored valueExpression is a ccRedirection, to handle it properly later.
                    boolean ccAttrMeRedirection =
                            attributeNameValueExpression instanceof LocationValueExpression &&
                                    CompositeComponentELUtils.isCompositeComponentAttrsMethodExpression(
View Full Code Here

TOP

Related Classes of javax.el.MethodExpression

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.