Examples of TabChangeSource


Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component "+ component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;

    TabChangeListener handler = null;
    ValueBinding valueBinding = null;
    if (binding != null && UIComponentTag.isValueReference(binding)) {
      valueBinding = ComponentUtil.createValueBinding(binding);
      if (valueBinding != null) {
        Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
        if (obj != null && obj instanceof TabChangeListener) {
          handler = (TabChangeListener) obj;
        }
      }
    }

    if (handler == null && type != null) {
      handler = createTabChangeListener(type);
      if (handler != null && valueBinding != null) {
        valueBinding.setValue(FacesContext.getCurrentInstance(), handler);
      }
    }
    if (handler != null) {
      if (valueBinding != null) {
        changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type, valueBinding));
      } else {
        changeSource.addTabChangeListener(handler);
      }
    }
    // TODO else LOG.warn?
    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component " + component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;
    final ELContext elContext = FacesContext.getCurrentInstance().getELContext();

    TabChangeListener handler = null;
    if (binding != null && !binding.isLiteralText()) {

      Object value = binding.getValue(elContext);
      if (value instanceof TabChangeListener) {
        handler = (TabChangeListener) value;
      }
    }

    if (handler == null && type != null) {
      handler = createTabChangeListener((String) type.getValue(elContext));
      if (handler != null && binding != null) {
        binding.setValue(elContext, handler);
      }
    }

    if (handler != null) {
      if (binding != null) {
        changeSource.addTabChangeListener(
            new ValueExpressionTabChangeListener((String) type.getValue(elContext), binding));
      } else {
        changeSource.addTabChangeListener(handler);
      }
    }

    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

  public void apply(FaceletContext faceletContext, UIComponent parent)
      throws IOException, FacesException, ELException {
    if (parent instanceof TabChangeSource) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        TabChangeSource changeSource = (TabChangeSource) parent;
        TabChangeListener listener = null;
        ValueExpression valueExpression = null;
        if (binding != null) {
          valueExpression = binding.getValueExpression(faceletContext, TabChangeListener.class);
          listener = (TabChangeListener) valueExpression.getValue(faceletContext);
        }
        if (listener == null) {
          try {
            listener = (TabChangeListener) listenerType.newInstance();
          } catch (Exception e) {
            throw new TagAttributeException(tag, type, e.getCause());
          }
          if (valueExpression != null) {
            valueExpression.setValue(faceletContext, listener);
          }
        }
        if (valueExpression != null) {
          changeSource.addTabChangeListener(
              new ValueExpressionTabChangeListener(type.getValue(), valueExpression));
        } else {
          changeSource.addTabChangeListener(listener);
        }
      }
    } else {
      throw new TagException(tag, "Parent is not of type TabChangeSource, type is: " + parent);
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component "+ component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;

    TabChangeListener handler = null;

    if (binding != null && UIComponentTag.isValueReference(binding)) {
      ValueBinding valueBinding = ComponentUtil.createValueBinding(binding);
      if (valueBinding != null) {
        Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
        if (obj != null && obj instanceof TabChangeListener) {
          handler = (TabChangeListener) obj;
        }
      }
    }

    if (handler == null && type != null) {
      String className;
      // evaluate any VB expression that we were passed
      if (UIComponentTag.isValueReference(type)) {
        ValueBinding typeValueBinding = ComponentUtil.createValueBinding(type);
        className = (String) typeValueBinding.getValue(FacesContext.getCurrentInstance());
      } else {
        className = type;
      }
      handler = createStateChangeListener(className);
      if (handler != null && binding != null) {
        ComponentUtil.setValueForValueBinding(binding, handler);
      }
    }
    if (handler != null) {
      changeSource.addTabChangeListener(handler);
    }
    // TODO else LOG.warn?
    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component " + component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;

    TabChangeListener handler = null;
    Object valueBinding = null;
    if (isBindingSet() && !isBindingLiteral()) {
      valueBinding = getBindingAsBindingOrExpression();
      if (valueBinding != null) {
        Object obj = FacesUtils.getValueFromBindingOrExpression(valueBinding);
        if (obj != null && obj instanceof TabChangeListener) {
          handler = (TabChangeListener) obj;
        }
      }
    }

    if (handler == null && isTypeSet()) {
      handler = createTabChangeListener(getTypeValue());
      if (handler != null && valueBinding != null) {
        FacesUtils.setValueOfBindingOrExpression(FacesContext.getCurrentInstance(), handler, valueBinding);
      }
    }
    if (handler != null) {
      if (valueBinding != null) {
        FacesUtils.addBindingOrExpressionTabChangeListener(changeSource, getTypeValue(), valueBinding);
      } else {
        changeSource.addTabChangeListener(handler);
      }
    }
    // TODO else LOG.warn?
    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

  public void apply(FaceletContext faceletContext, UIComponent parent)
      throws IOException, FacesException, ELException {
    if (parent instanceof TabChangeSource) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        TabChangeSource changeSource = (TabChangeSource) parent;
        TabChangeListener listener = null;
        ValueExpression valueExpression = null;
        if (binding != null) {
          valueExpression = binding.getValueExpression(faceletContext, TabChangeListener.class);
          listener = (TabChangeListener) valueExpression.getValue(faceletContext);
        }
        if (listener == null) {
          try {
            listener = (TabChangeListener) listenerType.newInstance();
          } catch (Exception e) {
            throw new TagAttributeException(tag, type, e.getCause());
          }
          if (valueExpression != null) {
            valueExpression.setValue(faceletContext, listener);
          }
        }
        if (valueExpression != null) {
          if (FacesVersion.supports12()) {
            FacesUtils.addBindingOrExpressionTabChangeListener(changeSource, type.getValue(), valueExpression);
          } else {
            FacesUtils.addBindingOrExpressionTabChangeListener(changeSource, type.getValue(),
                new LegacyValueBinding(valueExpression));
          }
        } else {
          changeSource.addTabChangeListener(listener);
        }
      }
    } else {
      throw new TagException(tag, "Parent is not of type TabChangeSource, type is: " + parent);
    }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component " + component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;

    TabChangeListener handler = null;
    ValueBinding valueBinding = null;
    if (binding != null && UIComponentTag.isValueReference(binding)) {
      valueBinding = ComponentUtil.createValueBinding(binding);
      if (valueBinding != null) {
        Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
        if (obj != null && obj instanceof TabChangeListener) {
          handler = (TabChangeListener) obj;
        }
      }
    }

    if (handler == null && type != null) {
      handler = createTabChangeListener(type);
      if (handler != null && valueBinding != null) {
        valueBinding.setValue(FacesContext.getCurrentInstance(), handler);
      }
    }
    if (handler != null) {
      if (valueBinding != null) {
        changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type, valueBinding));
      } else {
        changeSource.addTabChangeListener(handler);
      }
    }

    if (listener != null && UIComponentTag.isValueReference(listener)) {
      Application application = FacesContext.getCurrentInstance().getApplication();
      MethodBinding methodBinding = application.createMethodBinding(listener, TAB_CHANGE_LISTENER_ARGS);
      changeSource.setTabChangeListener(methodBinding);
    }
    // TODO else LOG.warn?
    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

  public void apply(FaceletContext faceletContext, UIComponent parent)
      throws IOException, FacesException, ELException {
    if (parent instanceof TabChangeSource) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        TabChangeSource changeSource = (TabChangeSource) parent;
        TabChangeListener changeListener = null;
        ValueExpression valueExpression = null;
        if (binding != null) {
          valueExpression = binding.getValueExpression(faceletContext, TabChangeListener.class);
          changeListener = (TabChangeListener) valueExpression.getValue(faceletContext);
        }
        if (changeListener == null) {
          try {
            changeListener = (TabChangeListener) listenerType.newInstance();
          } catch (Exception e) {
            throw new TagAttributeException(tag, type, e.getCause());
          }
          if (valueExpression != null) {
            valueExpression.setValue(faceletContext, changeListener);
          }
        }
        if (valueExpression != null) {
          changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type.getValue(),
              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

Examples of org.apache.myfaces.tobago.event.TabChangeSource

    }
    if (!(component instanceof TabChangeSource)) {
      // TODO Message resource i18n
      throw new JspException("Component "+ component.getClass().getName() + " is not instanceof TabChangeSource");
    }
    TabChangeSource changeSource = (TabChangeSource) component;

    TabChangeListener handler = null;
    ValueBinding valueBinding = null;
    if (binding != null && UIComponentTag.isValueReference(binding)) {
      valueBinding = ComponentUtil.createValueBinding(binding);
      if (valueBinding != null) {
        Object obj = valueBinding.getValue(FacesContext.getCurrentInstance());
        if (obj != null && obj instanceof TabChangeListener) {
          handler = (TabChangeListener) obj;
        }
      }
    }

    if (handler == null && type != null) {
      handler = createTabChangeListener(type);
      if (handler != null && valueBinding != null) {
        valueBinding.setValue(FacesContext.getCurrentInstance(), handler);
      }
    }
    if (handler != null) {
      if (valueBinding != null) {
        changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type, valueBinding));
      } else {
        changeSource.addTabChangeListener(handler);
      }
    }
    // TODO else LOG.warn?
    return (SKIP_BODY);
  }
View Full Code Here

Examples of org.apache.myfaces.tobago.event.TabChangeSource

  public void apply(FaceletContext faceletContext, UIComponent parent)
      throws IOException, FacesException, ELException {
    if (parent instanceof TabChangeSource) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        TabChangeSource changeSource = (TabChangeSource) parent;
        TabChangeListener listener = null;
        ValueExpression valueExpression = null;
        if (binding != null) {
          valueExpression = binding.getValueExpression(faceletContext, TabChangeListener.class);
          listener = (TabChangeListener) valueExpression.getValue(faceletContext);
        }
        if (listener == null) {
          try {
            listener = (TabChangeListener) listenerType.newInstance();
          } catch (Exception e) {
            throw new TagAttributeException(tag, type, e.getCause());
          }
          if (valueExpression != null) {
            valueExpression.setValue(faceletContext, listener);
          }
        }
        if (valueExpression != null) {
          changeSource.addTabChangeListener(new TabChangeListenerValueBindingDelegate(type.getValue(),
              new LegacyValueBinding(valueExpression)));
        } else {
          changeSource.addTabChangeListener(listener);
        }
      }
    } else {
      throw new TagException(tag, "Parent is not of type TabChangeSource, type is: " + parent);
    }
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.