Examples of MethodExpressionActionListener


Examples of javax.faces.event.MethodExpressionActionListener

          }
          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()) {
            parent.getAttributes().put(nameValue, value.getValue());
          } else {
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                        {
                                            actionListener = new PartialMethodExpressionActionListener(methodExpression, methodExpression2);
                                        }
                                        else
                                        {
                                            actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
                                        }
                                    }
                                    ((ActionSource2) innerComponent).addActionListener(actionListener);
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
                                    if (mctx.isUsingPSSOnThisView() && mctx.isMarkInitialState())
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                                                  ve.getExpressionString(),
                                                                  Void.TYPE,
                                                                  NO_ARGS);

                ((ActionSource2) target).addActionListener(
                      new MethodExpressionActionListener(
                            new ContextualCompositeMethodExpression(ve,
                                                                    me),
                            new ContextualCompositeMethodExpression(ve,
                                                                    noArg)));
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

            this.attr = attr;
        }

        public void applyMetadata(FaceletContext ctx, Object instance) {
            ((ActionSource2) instance)
                    .addActionListener(new MethodExpressionActionListener(
                            this.attr.getMethodExpression(ctx, null,
                                    ActionSourceRule.ACTION_LISTENER_SIG)));

        }
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                   
                                    methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                        createMethodExpression(elContext,
                                                attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY), attributeNameValueExpression);
                                   
                                    ActionListener actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
                                    ((ActionSource2)innerComponent).addActionListener(actionListener);
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
                                }
                                else if ("validator".equals(attributeName))
                                {
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                                                  ve.getExpressionString(),
                                                                  Void.TYPE,
                                                                  NO_ARGS);

                ((ActionSource2) target).addActionListener(
                      new MethodExpressionActionListener(
                            new ContextualCompositeMethodExpression(ve,
                                                                    me),
                            new ContextualCompositeMethodExpression(ve,
                                                                    noArg)));
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                        methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                            createMethodExpression(elContext,
                                                    attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY), attributeNameValueExpression);

                                        actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
                                    }
                                    ((ActionSource2)innerComponent).addActionListener(actionListener);
                                    mctx.addMethodExpressionTargeted(innerComponent, attributeName, actionListener);
                                }
                                else if ("validator".equals(attributeName))
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

            if (!(component instanceof ActionSource2))
            {
                throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource");
            }

            ((ActionSource2)component).addActionListener(new MethodExpressionActionListener(actionListener));
        }
    }
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

            if (!(component instanceof ActionSource2))
            {
                throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource");
            }

            ((ActionSource2)component).addActionListener(new MethodExpressionActionListener(actionListener));
        }
    }
View Full Code Here

Examples of javax.faces.event.MethodExpressionActionListener

                                        methodExpression2 = reWrapMethodExpression(context.getApplication().getExpressionFactory().
                                            createMethodExpression(elContext,
                                                    attributeExpressionString, Void.TYPE, EMPTY_CLASS_ARRAY), attributeNameValueExpression);

                                        actionListener = new MethodExpressionActionListener(methodExpression, methodExpression2);
                                    }
                                    ((ActionSource2)innerComponent).addActionListener(actionListener);
                                    mctx.addMethodExpressionTargeted(innerComponent, targetAttributeName, actionListener);
                                }
                                else if ("validator".equals(targetAttributeName))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.