Package javax.swing.tree

Examples of javax.swing.tree.TreePath


         *
         * @param e
         *            Description of the Parameter
         */
        public void treeCollapsed(TreeExpansionEvent e) {
            TreePath path = e.getPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();

            if (node.getUserObject() instanceof BuddyGroup) {
                Settings.getInstance().setProperty(
                        "groupExpandStatus_"
View Full Code Here


         *
         * @param e
         *            Description of the Parameter
         */
        public void treeExpanded(TreeExpansionEvent e) {
            TreePath path = e.getPath();
            AutomatedTreeNode node = (AutomatedTreeNode) path
                    .getLastPathComponent();

            if (node.getUserObject() instanceof BuddyGroup) {
                Settings.getInstance().remove(
                        "groupExpandStatus_"
View Full Code Here

            if (e.isPopupTrigger()) {
                try {

                    JTree tree = (JTree) e.getComponent();

                    TreePath path = tree.getPathForLocation(e.getX(), e.getY());
                    if (path == null) {
                        throw new ClassCastException();
                    }

                    tree.setSelectionPath(path);

                    AutomatedTreeNode node = (AutomatedTreeNode) path
                            .getLastPathComponent();
                    Object selectedUserObject = node.getUserObject();
                    if (selectedUserObject.getClass().equals(BuddyStatus.class)) {
                        buddy = (BuddyStatus) node.getUserObject();
                        buddyPopupMenu.showMenu(e.getComponent(), e.getX(), e
View Full Code Here

   * @param  event  Used to determine the current mouse position.
   */
  public String getToolTipText(MouseEvent evt)
  {
    String tip = null;
    final TreePath path = getPathForLocation(evt.getX(), evt.getY());
    if (path != null)
    {
      tip = path.getLastPathComponent().toString();
    }
    else
    {
      tip = getToolTipText();
    }
View Full Code Here

    if (node == null)
    {
      throw new IllegalArgumentException("ObjectTreeNode == null");
    }

    final TreePath nodePath = new TreePath(node.getPath());
        if (matchKeyPrefix(previouslySelectedTreePathNames, node, nodePath.toString()))
    {
      selectedTreePaths.add(nodePath);
    }


      try
      {
         _startExpandInThread = false;
         expandPath(nodePath);
      }
      finally
      {
         _startExpandInThread = true;
      }



      // Go through each child of the parent and see if it was previously
    // expanded. If it was recursively call this method in order to expand
    // the child.
      @SuppressWarnings("unchecked")
      Enumeration<ObjectTreeNode> childEnumeration =
          (Enumeration<ObjectTreeNode>) node.children();
    Iterator<ObjectTreeNode> it =
            new EnumerationIterator<ObjectTreeNode>(childEnumeration);
    while (it.hasNext())
    {
      final ObjectTreeNode child = it.next();
      final TreePath childPath = new TreePath(child.getPath());
      final String childPathName = childPath.toString();

         if (matchKeyPrefix(previouslySelectedTreePathNames, child, childPathName))
      {
        selectedTreePaths.add(childPath);
      }
View Full Code Here

     * Gets the index of the selected item
     *
     * @return the selected index
     */
    public int getSelectedIndex() {
        TreePath path = tree.getSelectionPath();
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
                .getLastPathComponent();
        DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
        return model.getIndexOfChild(root, node);
    }
View Full Code Here

         * @param e
         *            Description of the Parameter
         */
        public void mouseClicked(MouseEvent e) {
            JTree tree = (JTree) e.getComponent();
            TreePath path = tree.getSelectionPath();
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
                    .getLastPathComponent();
            String string = (String) node.getUserObject();
            if (string != null) {
                prefsDialog.switchPanel(string);
            }
View Full Code Here

          if (evt.isPopupTrigger())
          {
          // If the user wants to select for Right mouse clicks then change the selection before popup
           // appears
            if (_session.getApplication().getSquirrelPreferences().getSelectOnRightMouseClick()) {           
              TreePath path = ObjectTree.this.getPathForLocation(evt.getX(), evt.getY());
              boolean alreadySelected = false;
              TreePath[] selectedPaths = ObjectTree.this.getSelectionPaths();
              if (selectedPaths != null) {             
                for (TreePath selectedPath : selectedPaths) {
                  if (path != null && path.equals(selectedPath)) {
                    alreadySelected = true;
                    break;
                  }
                }
              }
View Full Code Here

  private final class NodeExpansionListener implements TreeExpansionListener
  {
    public void treeExpanded(TreeExpansionEvent evt)
    {
      // Get the node to be expanded.
      final TreePath path = evt.getPath();
      final Object parentObj = path.getLastPathComponent();
      if (parentObj instanceof ObjectTreeNode)
      {
        startExpandingTree((ObjectTreeNode)parentObj, false, null, false);
        _expandedPathNames.put(path.toString(), null);
      }
    }
View Full Code Here

        {
          fireStructureChanged(_parentNode);
          if (_selectParentNode)
          {
            clearSelection();
            setSelectionPath(new TreePath(_parentNode.getPath()));
          }
        }
      }
      catch (Throwable ex)
      {
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.