Package org.apache.myfaces.tobago.event

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


  public void apply(FaceletContext faceletContext, UIComponent parent)
      throws IOException, FacesException, ELException {
    if (parent instanceof TabChangeSource2) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        TabChangeSource2 changeSource = (TabChangeSource2) 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


    }
    if (!(component instanceof TabChangeSource2)) {
      // TODO Message resource i18n
      throw new JspException("Component " + component.getClass().getName() + " is not instanceof TabChangeSource2");
    }
    TabChangeSource2 changeSource = (TabChangeSource2) 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

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

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

      final 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

  public void apply(final FaceletContext faceletContext, final UIComponent parent) throws IOException {
    if (parent instanceof TabChangeSource2) {
      // only process if parent was just created
      if (parent.getParent() == null) {
        final TabChangeSource2 changeSource = (TabChangeSource2) 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 (final 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

TOP

Related Classes of org.apache.myfaces.tobago.event.TabChangeSource2

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.