Package javax.swing.tree

Examples of javax.swing.tree.DefaultTreeModel.insertNodeInto()


            Object root = rootNode.getUserObject();
            if (root != null) {
                if (root instanceof JTree) {
                    JTree tree = (JTree)root;
                    DefaultTreeModel model = (DefaultTreeModel)tree.getModel();
                    model.insertNodeInto(pChild, pParent, index);
                    // TF:21/9/07:Re-ordered this so new nodes inserted into an existing tree would be opened/closed properly
                    if (!tree.isRootVisible() || !tree.getShowsRootHandles()) {
                        TreePath path = new TreePath(pChild);
                        if (pChild.isOpened()) {
                            tree.expandPath(path);
View Full Code Here


                    handled = true;
                }
                else if (root instanceof OutlineField) {
                    OutlineField of = (OutlineField)root;
                    DefaultTreeModel model = (DefaultTreeModel)of.getModel();
                    model.insertNodeInto(pChild, pParent, index);
                    if (!of.isRootDisplayed()) {
                        TreePath path = new TreePath(rootNode);
                        if (pChild.isOpened()) {
                            of.getTree().expandPath(path);
                        }
View Full Code Here

            of.getModel().insertNodeInto(kid, parent, index);
            of.getTree().expandPath(new TreePath(of.getModel().getPathToRoot(parent)));
        }else if (this._component instanceof JTree){
            JTree jt = (JTree)this._component;
            DefaultTreeModel tm = ((TreeViewModel)jt.getModel());
            tm.insertNodeInto(kid, parent, index);

// JG: Don't expand here as it screws up the JTree.  Window builder needs to
// issue ExpandNode.expandOpenNodes after all inserts have been done.
//            if(kid.getIsOpened()){
//              NodeExpand.expandNode(jt, kid);
View Full Code Here

            System.out.println("parent == null");
            throw new RuntimeException("Parent not found!");
        }

        DefaultTreeModel model = (DefaultTreeModel) _tree.getModel();
        model.insertNodeInto(newNode, parentNode, 0);
        refresh();
    }

    /**
     * Refresh the layout.
View Full Code Here

      public void onClick(AjaxRequestTarget target)
      {
        treeTable.modelChanging();
        DefaultTreeModel model = (DefaultTreeModel)treeTable.getDefaultModelObject();
        model.removeNodeFromParent(c3);
        model.insertNodeInto(c3, c2, model.getChildCount(c2));
        treeTable.modelChanged();
        treeTable.nodeSelected(c2);
        treeTable.updateTree(target);
      }
    });
View Full Code Here

    DefaultMutableTreeNode c1 = new DefaultMutableTreeNode("c1");
    c2 = new DefaultMutableTreeNode("c2");
    c3 = new DefaultMutableTreeNode("c3");
    DefaultMutableTreeNode cc2 = new DefaultMutableTreeNode("cc2");
    DefaultTreeModel model = new DefaultTreeModel(root);
    model.insertNodeInto(c1, root, 0);
    model.insertNodeInto(c2, root, 1);
    model.insertNodeInto(cc2, c2, 0);
    model.insertNodeInto(c3, root, 2);
    return model;
  }
View Full Code Here

    c2 = new DefaultMutableTreeNode("c2");
    c3 = new DefaultMutableTreeNode("c3");
    DefaultMutableTreeNode cc2 = new DefaultMutableTreeNode("cc2");
    DefaultTreeModel model = new DefaultTreeModel(root);
    model.insertNodeInto(c1, root, 0);
    model.insertNodeInto(c2, root, 1);
    model.insertNodeInto(cc2, c2, 0);
    model.insertNodeInto(c3, root, 2);
    return model;
  }
View Full Code Here

    c3 = new DefaultMutableTreeNode("c3");
    DefaultMutableTreeNode cc2 = new DefaultMutableTreeNode("cc2");
    DefaultTreeModel model = new DefaultTreeModel(root);
    model.insertNodeInto(c1, root, 0);
    model.insertNodeInto(c2, root, 1);
    model.insertNodeInto(cc2, c2, 0);
    model.insertNodeInto(c3, root, 2);
    return model;
  }

View Full Code Here

    DefaultMutableTreeNode cc2 = new DefaultMutableTreeNode("cc2");
    DefaultTreeModel model = new DefaultTreeModel(root);
    model.insertNodeInto(c1, root, 0);
    model.insertNodeInto(c2, root, 1);
    model.insertNodeInto(cc2, c2, 0);
    model.insertNodeInto(c3, root, 2);
    return model;
  }


}
View Full Code Here

      
      String strName = (String) nod.getUserObject();
      int intPos = GfrSorterNodChildren.s_getPositionChildToAdd(this, strName);

      DefaultTreeModel dtm = (DefaultTreeModel) super._tree.getModel();
      dtm.insertNodeInto(nod, this, intPos);
     
      // IN COMMENTS COZ OF DISPLAY TBRL, LABEL BEING TRUNCATED AT THE END !!! I.E., AT IMPORT TIME
      //TreePath tphCur = new TreePath(nod.getPath());

      //if (!super._tree.isVisible(tphCur))
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.