Package javax.swing.tree

Examples of javax.swing.tree.TreeNode


    ArrayList<Component> subcircs = new ArrayList<Component>();
    for (Component comp : circuitState.getCircuit().getNonWires()) {
      if (comp.getFactory() instanceof SubcircuitFactory) {
        subcircs.add(comp);
      } else {
        TreeNode toAdd = model.mapComponentToNode(comp);
        if (toAdd != null) {
          newChildren.add(toAdd);
        }
      }
    }
View Full Code Here


        for (int i = 1; i < o.length; i++) {
          TreeNode[] pathNodes = getPathToRoot((TreeNode) o[i]);

          if (node == null || pathNodes[0].toString().compareTo("Plugins") != 0) {
            TreeNode n1 = (TreeNode) o[i - 1];
            @SuppressWarnings("unchecked")
            Enumeration<DefaultMutableTreeNode> e1 = n1.children();

            while (e1.hasMoreElements()) {
              TreeNode n2 = e1.nextElement();
              if (n2.toString().compareTo(o[i].toString()) == 0) {
                o[i] = n2;
                break;
              }
            }
          }
View Full Code Here

   * @return Number of Child-Nodes
   */
  private int getLeafCount(TreeNode node) {
    int count = 0;
    for (Enumeration children = node.children(); children.hasMoreElements();) {
      TreeNode child = (TreeNode) children.nextElement();
      if (child.isLeaf()) {
        count++;
      }
      else {
        count += getLeafCount(child);
      }
View Full Code Here

   * @param index  the index from where to read the child.
   * @return the child of <code>parent</code> at index <code>index</code>
   */
  public Object getChild(final Object parent, final int index)
  {
    final TreeNode node = (TreeNode) parent;
    return node.getChildAt(index);
  }
View Full Code Here

   * @param parent a node in the tree, obtained from this data source
   * @return the number of children of the node <code>parent</code>
   */
  public int getChildCount(final Object parent)
  {
    final TreeNode node = (TreeNode) parent;
    return node.getChildCount();
  }
View Full Code Here

   * @param node a node in the tree, obtained from this data source
   * @return true if <code>node</code> is a leaf
   */
  public boolean isLeaf(final Object node)
  {
    final TreeNode tnode = (TreeNode) node;
    return tnode.isLeaf();
  }
View Full Code Here

   * @return the index of the child in the parent, or -1 if either <code>child</code> or <code>parent</code> are
   *         <code>null</code>
   */
  public int getIndexOfChild(final Object parent, final Object child)
  {
    final TreeNode node = (TreeNode) parent;
    final TreeNode childNode = (TreeNode) child;
    return node.getIndex(childNode);
  }
View Full Code Here

  public int getIndex(TreeNode node)
  {
    for (int i = 0; i < childs.length; i++)
    {
      TreeNode child = childs[i];
      if (node == child)
      {
        return i;
      }
    }
View Full Code Here

            return projectTreeNode;
        }

        private ProjectTreeNode findProjectChild(TaskTreeBaseNode parentNode, String projectName) {
            for (int index = 0; index < parentNode.getChildCount(); index++) {
                TreeNode child = parentNode.getChildAt(index);
                if (child instanceof ProjectTreeNode) {
                    if (((ProjectTreeNode) child).getProject().getName().equals(projectName)) {
                        return (ProjectTreeNode) child;
                    }
                }
View Full Code Here

            }
        }

        private TaskTreeNode findTaskChild(ProjectTreeNode parentNode, String taskName) {
            for (int index = 0; index < parentNode.getChildCount(); index++) {
                TreeNode child = parentNode.getChildAt(index);
                if (child instanceof TaskTreeNode) {
                    if (((TaskTreeNode) child).getTask().getName().equals(taskName)) {
                        return (TaskTreeNode) child;
                    }
                }
View Full Code Here

TOP

Related Classes of javax.swing.tree.TreeNode

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.