Package javax.swing.tree

Examples of javax.swing.tree.TreePath


   public TreePath getPathToDbInfo(String catalog, String schema, FilterMatcher objectMatcher, ObjectTreeNode startNode, boolean useExpanders)
   {
      if(dbObjectInfoEquals(catalog, schema, objectMatcher, startNode.getDatabaseObjectInfo()))
      {
         return new TreePath(startNode.getPath());
      }
      else
      {
         if(useExpanders && 0 == startNode.getChildCount())
         {
            INodeExpander[] expanders = getExpanders(startNode.getDatabaseObjectType());


            for (int i = 0; i < expanders.length; i++)
            {
               try
               {
                  List<ObjectTreeNode> children =
                      expanders[i].createChildren(startNode.getSession(), startNode);

                  for (int j = 0; j < children.size(); j++)
                  {
                     ObjectTreeNode newChild = children.get(j);
                     if(0 == getExpanders(newChild.getDatabaseObjectType()).length)
                     {
                        newChild.setAllowsChildren(false);
                     }
                     else
                     {
                        newChild.setAllowsChildren(true);
                     }

                     startNode.add(newChild);
                  }
               }
               catch (Exception e)
               {
                  String msg =
                     "Error loading object type " +  startNode.getDatabaseObjectType() +
                     ". Error: " + e.toString() ". See SQuirreL Logs for stackttrace.";
                  startNode.getSession().showErrorMessage(msg);
                  logger.error(msg, e);
               }
            }
         }

         for(int i=0; i < startNode.getChildCount(); ++i)
         {
            TreePath ret = getPathToDbInfo(catalog, schema, objectMatcher, (ObjectTreeNode) startNode.getChildAt(i), useExpanders);
            if(null != ret)
            {
               return ret;
            }
         }
View Full Code Here


    *
    * @param node the tree node to expand
    */   
    public void expandNode(ObjectTreeNode node) {
        IDatabaseObjectInfo info = node.getDatabaseObjectInfo();
        TreePath path = getTreePath(info.getCatalogName(),
                                    info.getSchemaName(),
                                    new FilterMatcher(info.getSimpleName(), null));   
        _tree.fireTreeExpanded(path);
    }
View Full Code Here

   {
      if ("".equals(objectMatcher.getMetaDataMatchString())) {
          return false;
      }

      TreePath treePath = getTreePath(catalog, schema, objectMatcher);
      if(null != treePath)
      {
         _tree.setSelectionPath(treePath);
         _tree.scrollPathToVisible(treePath);
         return true;
View Full Code Here

    * @return the TreePath to the node with the specified criteria, or the root
    *         node if a node with matching characteristics isn't found.
    */
   private TreePath getTreePath(String catalog, String schema, FilterMatcher objectMatcher) {
       ObjectTreeModel otm = (ObjectTreeModel) _tree.getModel();
       TreePath treePath =
           otm.getPathToDbInfo(catalog,
                               schema,
                               objectMatcher,
                               (ObjectTreeNode) otm.getRoot(),
                               false);
View Full Code Here

    private class delaySelectionRunnable implements Runnable {
        public void run() {
          Utilities.sleep(50);
          SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    TreePath rootPath = _tree.getPathForRow(0);
                    _tree.setSelectionPath(rootPath);
                }
            });           
        }
View Full Code Here

            if (!isInTree(buddy)) {
                node.insert(new AutomatedTreeNode(buddy), index);
            }

            TreePath parent = new TreePath(root);
            tree.expandPath(parent);

            // find out if we need to expand this group
            String property = Settings.getInstance().getProperty(
                    "groupExpandStatus_" + group);
            if (property == null || !property.equals("collapsed")) {
                tree.expandPath(parent.pathByAddingChild(node));
            }
        }

    }
View Full Code Here

        if (buddy == null) {
            if (tree.getSelectionPath() == null) {
                return;
            }

            TreePath path = tree.getSelectionPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();
            if (model.isLeaf(node)) {
                try {
                    buddy = (BuddyStatus) node.getUserObject();
                } catch (ClassCastException ex) {
View Full Code Here

    // initialize tree content
    DefaultMutableTreeNode localAddressBookTreeNode = new DefaultMutableTreeNode();
    localAddressBook = new ContactCollection(contactDatabase, i18n.tr("Local Address Book"));
    localAddressBookTreeNode.setUserObject(localAddressBook);
    rootNode.add(localAddressBookTreeNode);
    addressBookTree.expandPath(new TreePath(rootNode));
    addressBookTree.setSelectionRow(0);
   
    updateActions();
  }
View Full Code Here

     */
    protected MouseListener getNode(MouseEvent e) {
        JTree tree = getTree(e);
        int x = e.getX();
        int y = e.getY();
        TreePath path = tree.getPathForLocation(x, y);
        if (path != null) {
            return (MouseListener) (path.getLastPathComponent());
        } else {
            return null;
        }
    }
View Full Code Here

                        .getParent().getIndex(node) + 1);
            UndoableAddOrRemoveGroup undo = new UndoableAddOrRemoveGroup(
                    GroupSelector.this, groupsRoot, newNode,
                    UndoableAddOrRemoveGroup.ADD_NODE);
            revalidateGroups();
            groupsTree.expandPath(new TreePath(
                    (node != null ? node : groupsRoot).getPath()));
            // Store undo information.
            panel.undoManager.addEdit(undo);
            panel.markBaseChanged();
            frame.output(Globals.lang("Added group \"%0\".",
View Full Code Here

TOP

Related Classes of javax.swing.tree.TreePath

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.