Package com.sun.facelets.el

Examples of com.sun.facelets.el.LegacyMethodBinding


      this.attribute = attribute;
    }

    public void applyMetadata(FaceletContext ctx, Object instance) {
      ((TabChangeSource) instance)
          .setTabChangeListener(new LegacyMethodBinding(attribute
              .getMethodExpression(ctx, null,
              TabChangeSourceRule.ACTION_LISTENER)));
    }
View Full Code Here


          if (expressionString != null) {
            ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
            MethodExpression action = new TagMethodExpression(value, expressionFactory.createMethodExpression(
                faceletContext, expressionString, String.class, ComponentUtils.ACTION_ARGS));
            // TODO jsf 1.2
            ((ActionSource) parent).setAction(new LegacyMethodBinding(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));
            // TODO jsf 1.2
            ((ActionSource) parent).setActionListener(new LegacyMethodBinding(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();
          while (isMethodOrValueExpression(expressionString) && isSimpleExpression(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();
            }
          }
          if (expressionString != null) {
            if (containsMethodOrValueExpression(expressionString)) {
              ValueExpression expression = value.getValueExpression(faceletContext, Object.class);
              ELAdaptor.setExpression(parent, name.getValue(faceletContext), expression);
            } else {
              parent.getAttributes().put(name.getValue(faceletContext), expressionString);
            }
          }
        } else {
          throw new FacesException("Type " + mode + " not suppored");
        }
      } else {

        String nameValue = name.getValue(faceletContext);
        if (Attributes.RENDERED.equals(nameValue)) {
          if (value.isLiteral()) {
            parent.setRendered(value.getBoolean(faceletContext));
          } else {
            ELAdaptor.setExpression(parent, 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 {
            ELAdaptor.setExpression(parent, 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);
              ELAdaptor.setExpression(parent, 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) {
            // TODO jsf 1.2
            ((EditableValueHolder) parent).setValidator(new LegacyMethodBinding(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) {
            // TODO jsf 1.2
            ((EditableValueHolder) parent).setValueChangeListener(new LegacyMethodBinding(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) {
            // TODO jsf 1.2
            ((ActionSource) parent).setAction(new LegacyMethodBinding(action));
          }
        } else if (parent instanceof ActionSource && Attributes.ACTION_LISTENER.equals(nameValue)) {
          MethodExpression action = getMethodExpression(faceletContext, null, ComponentUtils.ACTION_LISTENER_ARGS);
          if (action != null) {
            // TODO jsf 1.2
            ((ActionSource) parent).setActionListener(new LegacyMethodBinding(action));
          }
        } else if (!parent.getAttributes().containsKey(nameValue)) {
          if (value.isLiteral()) {
            parent.getAttributes().put(nameValue, value.getValue());
          } else {
View Full Code Here

      this.attribute = attribute;
    }

    public void applyMetadata(FaceletContext ctx, Object instance) {
      ((SortActionSource) instance)
          .setSortActionListener(new LegacyMethodBinding(attribute
              .getMethodExpression(ctx, null,
              SortActionSourceRule.ACTION_LISTENER)));
    }
View Full Code Here

      this.attribute = attribute;
    }

    public void applyMetadata(FaceletContext ctx, Object instance) {
      ((SheetStateChangeSource) instance)
          .setStateChangeListener(new LegacyMethodBinding(attribute
              .getMethodExpression(ctx, null,
              SheetStateChangeSourceRule.ACTION_LISTENER)));
    }
View Full Code Here

      this.attribute = attribute;
    }

    public void applyMetadata(FaceletContext ctx, Object instance) {
      ((TabChangeSource) instance)
          .setTabChangeListener(new LegacyMethodBinding(attribute
              .getMethodExpression(ctx, null,
              TabChangeSourceRule.ACTION_LISTENER)));
    }
View Full Code Here

    public SuggestMethodMapper(TagAttribute attribute) {
      this.attribute = attribute;
    }

    public void applyMetadata(FaceletContext ctx, Object instance) {
      ((UIInput) instance).setSuggestMethod(new LegacyMethodBinding(attribute.getMethodExpression(ctx,
          null, SuggestMethodRule.SUGGEST_METHOD)));
    }
View Full Code Here

          if (expressionString != null) {
            ExpressionFactory expressionFactory = faceletContext.getExpressionFactory();
            MethodExpression action = new TagMethodExpression(value, expressionFactory.createMethodExpression(
                faceletContext, expressionString, String.class, ComponentUtil.ACTION_ARGS));
            // TODO jsf 1.2
            ((ActionSource) parent).setAction(new LegacyMethodBinding(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 componsition.
                  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, ComponentUtil.ACTION_LISTENER_ARGS));
            // TODO jsf 1.2
            ((ActionSource) parent).setActionListener(new LegacyMethodBinding(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();
          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 componsition.
                  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) {
            ValueExpression expression = value.getValueExpression(faceletContext, Object.class);
            ELAdaptor.setExpression(parent, name.getValue(faceletContext), expression);
          }
        } else {
          throw new FacesException("Type " + mode + " not suppored");
        }
      } else {

        String nameValue = name.getValue(faceletContext);
        if (TobagoConstants.ATTR_RENDERED.equals(nameValue)) {
          if (value.isLiteral()) {
            parent.setRendered(value.getBoolean(faceletContext));
          } else {
            ELAdaptor.setExpression(parent, nameValue, value.getValueExpression(faceletContext, Boolean.class));
          }
        } else if (TobagoConstants.ATTR_RENDERED_PARTIALLY.equals(nameValue) && parent instanceof UICommand) {
          if (value.isLiteral()) {
            ComponentUtil.setRenderedPartially((UICommand) parent, value.getValue());
          } else {
            ELAdaptor.setExpression(parent, nameValue, value.getValueExpression(faceletContext, Object.class));
          }
        } else if (TobagoConstants.ATTR_STYLE_CLASS.equals(nameValue)) {
          // TODO expression
          ComponentUtil.setStyleClasses(parent, value.getValue());
        } else if (TobagoConstants.ATTR_MARKUP.equals(nameValue)) {
          if (parent instanceof SupportsMarkup) {
            if (value.isLiteral()) {
              ComponentUtil.setMarkup(parent, value.getValue());
            } else {
              ValueExpression expression = value.getValueExpression(faceletContext, Object.class);
              ELAdaptor.setExpression(parent, nameValue, expression);
            }
          } else {
            LOG.error("Component is not instanceof SupportsMarkup. Instance is: " + parent.getClass().getName());
          }
        } else if (parent instanceof EditableValueHolder && TobagoConstants.ATTR_VALIDATOR.equals(nameValue)) {
          MethodExpression methodExpression = getMethodExpression(faceletContext, null, ComponentUtil.VALIDATOR_ARGS);
          if (methodExpression != null) {
            // TODO jsf 1.2
            ((EditableValueHolder) parent).setValidator(new LegacyMethodBinding(methodExpression));
          }
        } else if (parent instanceof EditableValueHolder
            && TobagoConstants.ATTR_VALUE_CHANGE_LISTENER.equals(nameValue)) {
          MethodExpression methodExpression =
              getMethodExpression(faceletContext, null, ComponentUtil.VALUE_CHANGE_LISTENER_ARGS);
          if (methodExpression != null) {
            // TODO jsf 1.2
            ((EditableValueHolder) parent).setValueChangeListener(new LegacyMethodBinding(methodExpression));
          }
        } else if (parent instanceof ValueHolder && TobagoConstants.ATTR_CONVERTER.equals(nameValue)) {
          setConverter(faceletContext, parent, nameValue);
        } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION.equals(nameValue)) {
          MethodExpression action = getMethodExpression(faceletContext, String.class, ComponentUtil.ACTION_ARGS);
          if (action != null) {
            // TODO jsf 1.2
            ((ActionSource) parent).setAction(new LegacyMethodBinding(action));
          }
        } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION_LISTENER.equals(nameValue)) {
          MethodExpression action = getMethodExpression(faceletContext, null, ComponentUtil.ACTION_LISTENER_ARGS);
          if (action != null) {
            // TODO jsf 1.2
            ((ActionSource) parent).setActionListener(new LegacyMethodBinding(action));
          }
        } else if (!parent.getAttributes().containsKey(nameValue)) {
          if (value.isLiteral()) {
            parent.getAttributes().put(nameValue, value.getValue());
          } else {
View Full Code Here

              new LegacyValueBinding(valueExpression)));
        } else {
          changeSource.addTabChangeListener(changeListener);
        }
        if (listener != null && !listener.isLiteral()) {
          changeSource.setTabChangeListener(new LegacyMethodBinding(
              listener.getMethodExpression(faceletContext, null, TAB_CHANGE_LISTENER_ARGS)));
        }

      }
    } else {
View Full Code Here

        }
      } else if (parent instanceof EditableValueHolder && TobagoConstants.ATTR_VALIDATOR.equals(nameValue)) {
        MethodExpression methodExpression = getMethodExpression(faceletContext, null, ComponentUtil.VALIDATOR_ARGS);
        if (methodExpression != null) {
          // TODO jsf 1.2
          ((EditableValueHolder) parent).setValidator(new LegacyMethodBinding(methodExpression));
        }
      } else if (parent instanceof EditableValueHolder
          && TobagoConstants.ATTR_VALUE_CHANGE_LISTENER.equals(nameValue)) {
        MethodExpression methodExpression =
            getMethodExpression(faceletContext, null, ComponentUtil.VALUE_CHANGE_LISTENER_ARGS);
        if (methodExpression != null) {
          // TODO jsf 1.2
          ((EditableValueHolder) parent).setValueChangeListener(new LegacyMethodBinding(methodExpression));
        }
      } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION.equals(nameValue)) {
        MethodExpression action = getMethodExpression(faceletContext, String.class, ComponentUtil.ACTION_ARGS);
        if (action != null) {
          // TODO jsf 1.2
          ((ActionSource) parent).setAction(new LegacyMethodBinding(action));
        }
      } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION_LISTENER.equals(nameValue)) {
        MethodExpression action = getMethodExpression(faceletContext, null, ComponentUtil.ACTION_LISTENER_ARGS);
        if (action != null) {
          // TODO jsf 1.2
          ((ActionSource) parent).setActionListener(new LegacyMethodBinding(action));
        }
      } else if (!parent.getAttributes().containsKey(nameValue)) {
        if (value.isLiteral()) {
          parent.getAttributes().put(nameValue, value.getValue());
        } else {
View Full Code Here

        }
      } else if (parent instanceof EditableValueHolder && TobagoConstants.ATTR_VALIDATOR.equals(nameValue)) {
        MethodExpression methodExpression = getMethodExpression(faceletContext, null, ComponentUtil.VALIDATOR_ARGS);
        if (methodExpression != null) {
          // TODO jsf 1.2
          ((EditableValueHolder) parent).setValidator(new LegacyMethodBinding(methodExpression));
        }
      } else if (parent instanceof ValueHolder && TobagoConstants.ATTR_CONVERTER.equals(nameValue)) {
        setConverter(faceletContext, parent, nameValue)
      } else if (parent instanceof EditableValueHolder
          && TobagoConstants.ATTR_VALUE_CHANGE_LISTENER.equals(nameValue)) {
        MethodExpression methodExpression =
            getMethodExpression(faceletContext, null, ComponentUtil.VALUE_CHANGE_LISTENER_ARGS);
        if (methodExpression != null) {
          // TODO jsf 1.2
          ((EditableValueHolder) parent).setValueChangeListener(new LegacyMethodBinding(methodExpression));
        }
      } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION.equals(nameValue)) {
        MethodExpression action = getMethodExpression(faceletContext, String.class, ComponentUtil.ACTION_ARGS);
        if (action != null) {
          // TODO jsf 1.2
          ((ActionSource) parent).setAction(new LegacyMethodBinding(action));
        }
      } else if (parent instanceof ActionSource && TobagoConstants.ATTR_ACTION_LISTENER.equals(nameValue)) {
        MethodExpression action = getMethodExpression(faceletContext, null, ComponentUtil.ACTION_LISTENER_ARGS);
        if (action != null) {
          // TODO jsf 1.2
          ((ActionSource) parent).setActionListener(new LegacyMethodBinding(action));
        }
      } else if (!parent.getAttributes().containsKey(nameValue)) {
        if (value.isLiteral()) {
          parent.getAttributes().put(nameValue, value.getValue());
        } else {
View Full Code Here

TOP

Related Classes of com.sun.facelets.el.LegacyMethodBinding

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.