@Override
  public void encodeChildren(FacesContext context, UIComponent component) throws IOException {
    // Make sure this component is a 'when' component
    FacesUtil.AssertValidParams(context, component, UIChooseWhenComponent.class);

    // Make sure the parent of this component is a 'choose' component
    FacesUtil.AssertValidParams(context, component.getParent(), UIChooseComponent.class);

    // If this component is not rendered skip all the logic
    if (!component.isRendered()) {
      return;
    }

    UIChooseWhenComponent condComp = (UIChooseWhenComponent) component;
    UIChooseComponent chooseComp = (UIChooseComponent) component.getParent();

    // Render children only if a true condition hasn't already been
    // evaluated (assure mutual exclusion).
    //		if ( chooseComp.isFoundTrue() )
    //		{
    //			return;
    //		}

    // Render children only if the specified condition doesn't hold.

    if (condComp.getTest()) {
      super.encodeChildren(context, component);

      //			chooseComp.setFoundTrue( true );
    }
  }
예제 #2
0
  private void onPaint(PaintEvent e) {
    Color back = e.gc.getBackground();
    Color fore = e.gc.getForeground();

    strategy.paint(e.gc);

    e.gc.setBackground(back);
    e.gc.setForeground(fore);

    if (toggleRenderer != null) {
      toggleRenderer.setExpanded(expanded);
      toggleRenderer.setFocus(isFocusControl());
      toggleRenderer.setHover(overToggle);
      toggleRenderer.paint(e.gc, this);
    }

    if (toolItemRenderer != null && toolitems.size() > 0) {
      paintToolItems(e.gc);
    }
  }