Example usage for javax.swing.event TreeExpansionEvent getPath

List of usage examples for javax.swing.event TreeExpansionEvent getPath

Introduction

In this page you can find the example usage for javax.swing.event TreeExpansionEvent getPath.

Prototype

public TreePath getPath() 

Source Link

Document

Returns the path to the value that has been expanded/collapsed.

Usage

From source file:org.kepler.objectmanager.library.LibraryManager.java

/** Called whenever an item in the tree is expanded. */
@Override/*from w ww  .j  a va  2 s.  c  o m*/
public void treeExpanded(TreeExpansionEvent event) {
    final Object tree = event.getSource();
    final List<TreePath> expansions = _treeExpansionMap.get(tree);
    if (expansions != null) {
        //System.out.println("expanded " + event.getPath());
        expansions.add(event.getPath());
    }
}

From source file:org.kepler.objectmanager.library.LibraryManager.java

/** Called whenever an item in the tree is collapsed. */
@Override/*from w w w.  j a va 2s . co m*/
public void treeCollapsed(TreeExpansionEvent event) {
    final Object tree = event.getSource();
    final List<TreePath> expansions = _treeExpansionMap.get(tree);
    if (expansions != null) {
        //System.out.println("collapsed " + event.getPath());
        expansions.remove(event.getPath());
    }
}

From source file:org.openehealth.coms.cc.consent_applet.applet.ConsentApplet.java

/**
 * Listener which handles the expansion of TreeNodes
 * //  w  w w . j  ava2 s.c o  m
 * @return
 */
private TreeExpansionListener getMyTreeExpansionListener() {

    return new TreeExpansionListener() {

        public void treeCollapsed(TreeExpansionEvent arg0) {
        }

        public void treeExpanded(TreeExpansionEvent arg0) {

            //Normal Tree, load child Nodes from the server
            if (arg0.getPath().getLastPathComponent() instanceof LazyOIDTreeNode) {
                LazyOIDTreeNode node = (LazyOIDTreeNode) arg0.getPath().getLastPathComponent();

                if (!node.isLeaf() && !node.hasBeenExpanded()) {
                    node.setHasBeenExpanded(true);
                    requestTreeNode(node);
                }
            }
            //Search Tree, expand as usual
            else if (arg0.getPath().getLastPathComponent() instanceof DefaultMutableTreeNode) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) arg0.getPath().getLastPathComponent();

                JTree tree = (JTree) arg0.getSource();
                tree.expandPath(new TreePath(node.getPath()));

            }
        };
    };
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserUI.java

/**
 * Creates a new instance./*w w w  .  j  av  a 2 s.com*/
 * The {@link #initialize(BrowserControl, BrowserModel) initialize} method
 * should be called straight after to link this View to the Controller.
 */
BrowserUI() {
    sorter = new ViewerSorter();
    nodesToReset = new HashSet<TreeImageDisplay>();
    listener = new TreeExpansionListener() {
        public void treeCollapsed(TreeExpansionEvent e) {
            onNodeNavigation((TreeImageDisplay) e.getPath().getLastPathComponent(), false);
        }

        public void treeExpanded(TreeExpansionEvent e) {
            onNodeNavigation((TreeImageDisplay) e.getPath().getLastPathComponent(), true);
        }
    };
}

From source file:org.photovault.swingui.volumetree.VolumeTreeController.java

public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
    DefaultMutableTreeNode expandingNode = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    Object o = expandingNode.getUserObject();
    if (o instanceof VolumeTreeNode) {
        VolumeTreeNode node = (VolumeTreeNode) o;
        if (node.path.equals("") && node.state == NodeState.UNINITIALIZED) {
            node.state = NodeState.INITIALIZING;
            log.debug("expand volume  " + node.volId);
            QuerySubfoldersTask fillTreeTask = new QuerySubfoldersTask(
                    ((HibernateDAOFactory) getDAOFactory()).getSession(), this, expandingNode);
            fillTreeTask.execute();/*from   w w w  .  j a v  a 2  s . c  o m*/
        }
    }

}

From source file:ser321.media.MediaJavaClient.java

public void treeWillCollapse(TreeExpansionEvent tee) {
    debug("In treeWillCollapse with path: " + tee.getPath());
    tree.setSelectionPath(tee.getPath());
}

From source file:ser321.media.MediaJavaClient.java

public void treeWillExpand(TreeExpansionEvent tee) {
    debug("In treeWillExpand with path: " + tee.getPath());
    //DefaultMutableTreeNode dmtn =
    //    (DefaultMutableTreeNode)tee.getPath().getLastPathComponent();
    //System.out.println("will expand node: "+dmtn.getUserObject()+
    //         " whose path is: "+tee.getPath());
}