Package javax.swing.tree

Examples of javax.swing.tree.TreeNode


            }
        }

        public int getChildCount(Object parent) {
            if (parent instanceof TreeNode) {
                TreeNode node = (TreeNode) parent;
                return node.getChildCount();
            } else {
                return 0;
            }
        }
View Full Code Here


            }
        }

        public boolean isLeaf(Object node) {
            if (node instanceof TreeNode) {
                TreeNode n = (TreeNode) node;
                return n.isLeaf();
            } else {
                return true;
            }
        }
View Full Code Here

        public int getIndexOfChild(Object parent, Object child) {
            if (parent == null || child == null) {
                return -1;
            }
            TreeNode node = (TreeNode) parent;
            return node.getIndex((TreeNode) child);
        }
View Full Code Here

    }

    // Ensure that the template namespace tree node for the given namespace
    // is in its expanded state.
    void setNamespace(String namespace) {
        TreeNode root = (TreeNode) getModel().getRoot();
        Enumeration e = root.children();
        while (e.hasMoreElements()) {
            TemplateNamespaceTreeNode child =
                (TemplateNamespaceTreeNode) e.nextElement();
            String ns = child.toString();
            if (ns.equals(namespace)) {
View Full Code Here

        return null;
    }

    // Initialize expanded states for namespace nodes
    private void initExpandedStates() {
        TreeNode root = (TreeNode) getModel().getRoot();
        Enumeration e = root.children();
        while (e.hasMoreElements()) {
            Object node = e.nextElement();
            String namespace = node.toString();
            if (Prefs.getBoolean(ExpandedKey + namespace, true)) {
                TreePath path = new TreePath(new Object[] { root, node });
View Full Code Here

            new MouseAdapter() {
                public void mouseClicked(MouseEvent event) {
                    Point p = event.getPoint();
                    TreePath path = getPathForLocation(p.x, p.y);
                    if (path != null) {
                        TreeNode node = (TreeNode) path.getLastPathComponent();
                        if (! node.isLeaf()) {
                            if (isExpanded(path)) {
                                collapsePath(path);
                            }
                            else {
                                expandPath(path);
View Full Code Here

        children = new ArrayList<LazyTreeNode>();

        Enumeration srcChildren = srcNode.children();
        while (srcChildren.hasMoreElements()) {
            TreeNode srcChild = (TreeNode) srcChildren.nextElement();
            children.add(new LazyTreeNode(this, srcChild));
        }
    }
View Full Code Here

      tree_model.reload(n.getParent());
    }

    public void nodeRemoved(String fqn) {
  MyNode   n;
  TreeNode par;
  System.out.println("** nodeRemoved(" + fqn + ')');
  n=root.findNode(fqn);
  if(n != null) {
      n.removeAllChildren();     
      par=n.getParent();
View Full Code Here

  @RunsInEDT
  private static DefaultMutableTreeNode firstChildInRootOf(final JTree tree) {
    return execute(new GuiQuery<DefaultMutableTreeNode>() {
      @Override
      protected DefaultMutableTreeNode executeInEDT() {
        TreeNode root = (TreeNode) tree.getModel().getRoot();
        return (DefaultMutableTreeNode) root.getChildAt(0);
      }
    });
  }
View Full Code Here

  @RunsInEDT
  static DefaultMutableTreeNode firstChildOfRootIn(final JTree tree) {
    return execute(new GuiQuery<DefaultMutableTreeNode>() {
      @Override
      protected DefaultMutableTreeNode executeInEDT() {
        TreeNode root = (TreeNode) tree.getModel().getRoot();
        return (DefaultMutableTreeNode) root.getChildAt(0);
      }
    });
  }
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.