コード例 #1
0
 protected void setEventPhase(ItemChangeEvent event) {
   if (isImmediate()
       || (event.getNewItem() != null
           && RendererUtils.getInstance().isBooleanAttribute(event.getNewItem(), "immediate"))) {
     event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
   } else {
     event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES);
   }
 }
コード例 #2
0
  @Override
  public void processDecodes(FacesContext context) {
    super.processDecodes(context);

    // TODO nick - is component immediate = true only?
    // TODO nick - processValue should be executed in context of component, i.e. when 'component' EL
    // variable is set

    ItemChangeEvent event = createItemChangeEvent(context);
    if (event != null) {
      event.queue();
    }
  }
コード例 #3
0
  /**
   * Specialized decode behavior on top of that provided by the superclass. In addition to the
   * standard <code>processDecodes</code> behavior inherited from {@link
   * javax.faces.component.UIComponentBase}, calls <code>processValue()</code> if the the <code>
   * immediate</code> property is true; if the component is invalid afterwards or a <code>
   * RuntimeException</code> is thrown, calls {@link FacesContext#renderResponse}.
   *
   * @throws NullPointerException {@inheritDoc}
   */
  @Override
  public void processDecodes(FacesContext facesContext) {
    if (facesContext == null) {
      throw new NullPointerException();
    }

    // Skip processing if our rendered flag is false
    if (!isRendered()) {
      return;
    }

    pushComponentToEL(facesContext, null);

    final String activeItem = getActiveItemValue();
    EnumSet<VisitHint> hints = EnumSet.of(VisitHint.SKIP_UNRENDERED);
    VisitContext visitContext = new FullVisitContext(facesContext, hints);
    this.visitTree(
        visitContext,
        new VisitCallback() {
          @Override
          public VisitResult visit(VisitContext context, UIComponent target) {
            if (AbstractTogglePanel.this == target || target instanceof UIRepeat) {
              return VisitResult.ACCEPT; // Proceed with visit to target's children
            }
            if (isActiveItem(target, activeItem) || getSwitchType() == SwitchType.client) {
              target.processDecodes(context.getFacesContext());
            }
            return VisitResult
                .REJECT; // No need to visit target's children, as they were recursively visited
                         // above
          }
        });

    // Process this component itself
    try {
      decode(facesContext);
    } catch (RuntimeException e) {
      facesContext.renderResponse();
      throw e;
    } finally {
      popComponentFromEL(facesContext);
    }

    ItemChangeEvent event = createItemChangeEvent(facesContext);
    if (event != null) {
      event.queue();
    }
  }