javax.swing.event.TreeExpansionListener Java Examples

The following examples show how to use javax.swing.event.TreeExpansionListener. 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 File: TreePathSupport.java    From netbeans with 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 File: JTreeOperator.java    From openjdk-jdk9 with 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 File: JTreeOperator.java    From openjdk-jdk9 with 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
Source File: TreeSingleChildExpandBehavior.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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
Source File: TreeSingleChildExpandBehavior.java    From weblaf with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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 File: OutlineView.java    From netbeans with 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 File: OutlineView.java    From netbeans with 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 File: BrowserPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
void addTreeExpansionListener(TreeExpansionListener l) {
    outlineView.addTreeExpansionListener(l);
}
 
Example #9
Source File: BrowserPanel.java    From netbeans with Apache License 2.0 4 votes vote down vote up
void removeTreeExpansionListener(TreeExpansionListener l) {
    outlineView.removeTreeExpansionListener(l);
}
 
Example #10
Source File: DebugTreeView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void addTreeExpansionListener(TreeExpansionListener listener) {
    tree.addTreeExpansionListener(listener);
}
 
Example #11
Source File: DebugTreeView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void removeTreeExpansionListener(TreeExpansionListener listener) {
    tree.removeTreeExpansionListener(listener);
}
 
Example #12
Source File: TreePathSupport.java    From netbeans with 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 File: TreePathSupport.java    From netbeans with 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);
}