Package org.apache.myfaces.tobago.component

Examples of org.apache.myfaces.tobago.component.UITreeNode


  @Override
  public void prepareRender(FacesContext facesContext, UIComponent component) throws IOException {
    super.prepareRender(facesContext, component);

    final UITreeNode node = (UITreeNode) component;
    if (node.isMarked()) {
      node.setCurrentMarkup(Markup.MARKED.add(node.getCurrentMarkup()));
    }
    if (node.isFolder()) {
      node.setCurrentMarkup(Markup.FOLDER.add(node.getCurrentMarkup()));
      if (node.isExpanded()) {
        node.setCurrentMarkup(Markup.EXPANDED.add(node.getCurrentMarkup()));
      }
    }
  }
View Full Code Here


  }

  @Override
  public void encodeBegin(FacesContext facesContext, UIComponent component) throws IOException {

    final UITreeNode node = (UITreeNode) component;
    final UITreeMenu tree = ComponentUtils.findAncestor(node, UITreeMenu.class);

    final boolean folder = node.isFolder();
    final String id = node.getClientId(facesContext);
    final int level = node.getLevel();
    final boolean root = level == 0;
    final boolean expanded = folder && node.isExpanded() || level == 0;
    final boolean showRoot = tree.isShowRoot();
    final boolean ie6
        = VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().equals(UserAgent.MSIE_6_0);

    // XXX todo: find a better way to determine the parentId
    final String clientId = node.getClientId(facesContext);
    final int colon = clientId.lastIndexOf(":");
    final int underscore = clientId.substring(0, colon).lastIndexOf("_");
    final String parentId = root ? null : clientId.substring(0, underscore) + clientId.substring(colon);

    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
View Full Code Here

  public void testLifecycleSmall() {

    MixedTreeModel model = new MixedTreeModel();

    UITreeNode n1 = new UITreeNode();

    model.beginBuildNode(n1);
    model.endBuildNode(n1);

    model.onEncodeBegin();
View Full Code Here

  public void testLifecycleStatic() {

    MixedTreeModel model = new MixedTreeModel();

    UITreeNode n1 = new UITreeNode();
    UITreeNode n2 = new UITreeNode();
    UITreeNode n3 = new UITreeNode();

    model.beginBuildNode(n1);
    model.beginBuildNode(n2);
    model.endBuildNode(n2);
    model.beginBuildNode(n3);
View Full Code Here

    tree.add(new DefaultMutableTreeNode());
    tree.add(new DefaultMutableTreeNode());

    UITreeData data = new UITreeData();
    data.setValue(tree);
    UITreeNode node = new UITreeNode();

    model.beginBuildNodeData(data);
    model.beginBuildNode(node);
    model.endBuildNode(node);
    model.endBuildNodeData(data);
View Full Code Here

    tree.add(new DefaultMutableTreeNode());
    tree.add(new DefaultMutableTreeNode());

    UITreeData data = new UITreeData();
    data.setValue(tree);
    UITreeNode node = new UITreeNode();

    model.beginBuildNode(node);
    model.beginBuildNodeData(data);
    model.beginBuildNode(node);
    model.endBuildNode(node);
View Full Code Here

public class TreeMenuNodeRenderer extends TreeNodeRendererBase {

  @Override
  public void encodeBegin(final FacesContext facesContext, final UIComponent component) throws IOException {

    final UITreeNode node = (UITreeNode) component;
    final AbstractUIData data = ComponentUtils.findAncestor(node, AbstractUIData.class);

    final boolean dataRendersRowContainer = data.isRendersRowContainer();
    final boolean folder = node.isFolder();
    final String clientId = node.getClientId(facesContext);
    final boolean ie6
        = VariableResolverUtils.resolveClientProperties(facesContext).getUserAgent().equals(UserAgent.MSIE_6_0);
    final String parentId = data.getRowParentClientId();
    final boolean visible = data.isRowVisible();
View Full Code Here

    }
  }

  @Override
  public void encodeEnd(final FacesContext facesContext, final UIComponent component) throws IOException {
    final UITreeNode node = (UITreeNode) component;
    final AbstractUIData data = ComponentUtils.findAncestor(node, AbstractUIData.class);
    final int level = node.getLevel();
    final boolean folder = node.isFolder();
    final boolean expanded = folder && data.getExpandedState().isExpanded(node.getPath()) || level == 0;

    final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);

    if (folder) {
      encodeIcon(facesContext, writer, expanded, node);
View Full Code Here

  private static final Logger LOG = LoggerFactory.getLogger(TreeCommandRenderer.class);

  @Override
  public void prepareRender(final FacesContext facesContext, final UIComponent component) throws IOException {
    final UITreeCommand command = (UITreeCommand) component;
    final UITreeNode node = ComponentUtils.findAncestor(command, UITreeNode.class);
    // Todo: use an expression?
    command.setDisabled(node.isDisabled());
    super.prepareRender(facesContext, component);
  }
View Full Code Here

  private static final Logger LOG = LoggerFactory.getLogger(TreeCommandRenderer.class);

  @Override
  public void prepareRender(final FacesContext facesContext, final UIComponent component) throws IOException {
    final UITreeCommand command = (UITreeCommand) component;
    final UITreeNode node = ComponentUtils.findAncestor(command, UITreeNode.class);
    // Todo: use an expression?
    command.setDisabled(node.isDisabled());
    super.prepareRender(facesContext, component);
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.tobago.component.UITreeNode

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.