Package org.apache.myfaces.custom.tree2

Examples of org.apache.myfaces.custom.tree2.Tree


public class TreeTest
{
   public static void main( String args[] )
   {
      Tree tree = new Tree();
      int value;
      Random randomNumber = new Random();

      System.out.println( "Inserting the following values: " );

      // insert 10 random integers from 0-99 in tree
      for ( int i = 1; i <= 10; i++ )
      {
         value = randomNumber.nextInt( 100 );
         System.out.print( value + " " );
         tree.insertNode( value );
      } // end for

      System.out.println ( "\n\nPreorder traversal" );
      tree.preorderTraversal(); // perform preorder traversal of tree

      System.out.println ( "\n\nInorder traversal" );
      tree.inorderTraversal(); // perform inorder traversal of tree

      System.out.println ( "\n\nPostorder traversal" );
      tree.postorderTraversal(); // perform postorder traversal of tree
      System.out.println();
   } // end main
View Full Code Here


        // Build the tree.
        TreeNode tn = new CommentTreeNode();
        tn.setType("comments"); tn.setLeaf(false);

        // Create the tree:
        TreeModel tm = new TreeModelBase(tn);

        // Add child nodes:
        this.getChildComments(tm, tn, cmts);
       
        // Add a child for the reply box:
View Full Code Here

     *
     * @return TreeModel
     */
    public TreeModel getExpandedTreeData()
    {
        return new TreeModelBase(getTreeData());
    }
View Full Code Here

     *
     * @return TreeModel
     */
    public TreeModel getExpandedTreeData()
    {
        return new TreeModelBase(getTreeData());
    }
View Full Code Here

  /**
   * Create the table model based on the root object.
   * @param root root node object.
   */
  protected Object createTreeModel(Object root) {
    return new TreeModelBase((TreeNodeBase)root);
  }
View Full Code Here

           
            for (int i = 0; i < currentMetadata.getRootElement().getElements().size(); i++) {
                paths.add("0:" + (metadataCount) + ":0:" + i);
            }
        }
        TreeModelBase tmb = new TreeModelBase(treeData);
        for (Iterator it = paths.iterator(); it.hasNext(); ) {
            String path = (String) it.next();
            tmb.getTreeState().expandPath(tmb.getPathInformation(path));
        }
        tmb.getTreeState().collapsePath(new String[]{"0:0"});
       
        return tmb;
    }
View Full Code Here

           
            for (int i = 0; i < 50; i++) {
                paths.add("0:" + (metadataCount) + ":0:" + i);
            }
        }
        TreeModelBase tmb = new TreeModelBase(treeData);
        for (Iterator it = paths.iterator(); it.hasNext(); ) {
            String path = (String) it.next();
            tmb.getTreeState().expandPath(tmb.getPathInformation(path));
        }
        tmb.getTreeState().collapsePath(new String[]{"0:0"});
       
        return tmb;
    }
View Full Code Here

        CustomTreeNode treeData = new CustomTreeNode("root", "", true);
        if (rootVersion != null) {
            treeData = this.addVersionTreeNode(rootVersion);
        }
       
        return new TreeModelBase(treeData);
    }
View Full Code Here

//            }
        }
        if (metadataCount > 0) {
          metadataEmpty = true;
        }
        TreeModelBase tmb = new TreeModelBase(treeData);
        TreeState ts = new TreeStateBase();       
        for (Iterator it = paths.iterator(); it.hasNext(); ) {
            String path = (String) it.next();
            ts.toggleExpanded(path);
        }
        tmb.setTreeState(ts);
        //tmb.getTreeState().collapsePath(new String[]{"0:0"});
        return tmb;
    }
View Full Code Here

  }

  public String toggleRootCollectionMenu() {
    this.rootCollectionMenuOpen = !this.rootCollectionMenuOpen;
    if (!this.rootCollectionMenuOpen) {
      this.treeModel = new TreeModelBase(getTreeNode());
    }
    return "";
  }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.custom.tree2.Tree

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.