Java Code Examples for javax.swing.event.TreeExpansionListener

The following examples show how to use javax.swing.event.TreeExpansionListener. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: netbeans   Source File: TreePathSupport.java    License: Apache License 2.0 5 votes vote down vote up
private void fireTreeExpansion (TreeExpansionEvent e, boolean expanded) {
    int size = eListeners.size();
    
    TreeExpansionListener[] listeners = new TreeExpansionListener[size];
    synchronized (this) {
        listeners = eListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (expanded) {
            listeners[i].treeExpanded(e);
        } else {
            listeners[i].treeCollapsed(e);
        }
    }
}
 
Example 2
Source Project: openjdk-jdk9   Source File: JTreeOperator.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code JTree.addTreeExpansionListener(TreeExpansionListener)}
 * through queue
 */
public void addTreeExpansionListener(final TreeExpansionListener treeExpansionListener) {
    runMapping(new MapVoidAction("addTreeExpansionListener") {
        @Override
        public void map() {
            ((JTree) getSource()).addTreeExpansionListener(treeExpansionListener);
        }
    });
}
 
Example 3
Source Project: openjdk-jdk9   Source File: JTreeOperator.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps
 * {@code JTree.removeTreeExpansionListener(TreeExpansionListener)}
 * through queue
 */
public void removeTreeExpansionListener(final TreeExpansionListener treeExpansionListener) {
    runMapping(new MapVoidAction("removeTreeExpansionListener") {
        @Override
        public void map() {
            ((JTree) getSource()).removeTreeExpansionListener(treeExpansionListener);
        }
    });
}
 
Example 4
/**
 * Uninstalls all behaviors from the specified tree.
 *
 * @param tree tree to modify
 */
public static void uninstall ( final JTree tree )
{
    for ( final TreeExpansionListener listener : tree.getTreeExpansionListeners () )
    {
        if ( listener instanceof TreeSingleChildExpandBehavior )
        {
            tree.removeTreeExpansionListener ( listener );
        }
    }
}
 
Example 5
/**
 * Returns whether the specified tree has any behaviors installed or not.
 *
 * @param tree tree to process
 * @return true if the specified tree has any behaviors installed, false otherwise
 */
public static boolean isInstalled ( final JTree tree )
{
    for ( final TreeExpansionListener listener : tree.getTreeExpansionListeners () )
    {
        if ( listener instanceof TreeSingleChildExpandBehavior )
        {
            return true;
        }
    }
    return false;
}
 
Example 6
Source Project: netbeans   Source File: OutlineView.java    License: Apache License 2.0 4 votes vote down vote up
public void addTreeExpansionListener( TreeExpansionListener l ) {
    TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport();
    if( tps != null )
        tps.addTreeExpansionListener(l);
}
 
Example 7
Source Project: netbeans   Source File: OutlineView.java    License: Apache License 2.0 4 votes vote down vote up
public void removeTreeExpansionListener( TreeExpansionListener l ) {
    TreePathSupport tps = getOutline().getOutlineModel().getTreePathSupport();
    if( tps != null )
        tps.removeTreeExpansionListener(l);
}
 
Example 8
Source Project: netbeans   Source File: BrowserPanel.java    License: Apache License 2.0 4 votes vote down vote up
void addTreeExpansionListener(TreeExpansionListener l) {
    outlineView.addTreeExpansionListener(l);
}
 
Example 9
Source Project: netbeans   Source File: BrowserPanel.java    License: Apache License 2.0 4 votes vote down vote up
void removeTreeExpansionListener(TreeExpansionListener l) {
    outlineView.removeTreeExpansionListener(l);
}
 
Example 10
Source Project: netbeans   Source File: DebugTreeView.java    License: Apache License 2.0 4 votes vote down vote up
public void addTreeExpansionListener(TreeExpansionListener listener) {
    tree.addTreeExpansionListener(listener);
}
 
Example 11
Source Project: netbeans   Source File: DebugTreeView.java    License: Apache License 2.0 4 votes vote down vote up
public void removeTreeExpansionListener(TreeExpansionListener listener) {
    tree.removeTreeExpansionListener(listener);
}
 
Example 12
Source Project: netbeans   Source File: TreePathSupport.java    License: Apache License 2.0 2 votes vote down vote up
/** Add a TreeExpansionListener.  If the TreeWillExpandListener implements
 * ExtTreeExpansionListener, it will be notified if another 
 * TreeWillExpandListener vetoes the expansion event
 * @param l The tree expansion listener
 */
public synchronized void addTreeExpansionListener (TreeExpansionListener l) {
    eListeners.add(l);
}
 
Example 13
Source Project: netbeans   Source File: TreePathSupport.java    License: Apache License 2.0 2 votes vote down vote up
/**
 * Remove a TreeExpansionListener.
 * @param l The tree expansion listener
 */
public synchronized void removeTreeExpansionListener (TreeExpansionListener l) {
    eListeners.remove(l);
}