javax.swing.event.TreeWillExpandListener Java Examples

The following examples show how to use javax.swing.event.TreeWillExpandListener. 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 fireTreeWillExpand (TreeExpansionEvent e, boolean expanded) throws ExpandVetoException {
    int size = weListeners.size();
    
    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (expanded) {
            listeners[i].treeWillExpand(e);
        } else {
            listeners[i].treeWillCollapse(e);
        }
    }
}
 
Example #2
Source File: TreePathSupport.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void fireTreeExpansionVetoed (TreeExpansionEvent e, ExpandVetoException ex) {
    int size = weListeners.size();
    
    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (listeners[i] instanceof ExtTreeWillExpandListener) {
            ((ExtTreeWillExpandListener) listeners[i]).treeExpansionVetoed(e,
                ex);
        }
    }
}
 
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.addTreeWillExpandListener(TreeWillExpandListener)}
 * through queue
 */
public void addTreeWillExpandListener(final TreeWillExpandListener treeWillExpandListener) {
    runMapping(new MapVoidAction("addTreeWillExpandListener") {
        @Override
        public void map() {
            ((JTree) getSource()).addTreeWillExpandListener(treeWillExpandListener);
        }
    });
}
 
Example #4
Source File: JTreeOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps
 * {@code JTree.removeTreeWillExpandListener(TreeWillExpandListener)}
 * through queue
 */
public void removeTreeWillExpandListener(final TreeWillExpandListener treeWillExpandListener) {
    runMapping(new MapVoidAction("removeTreeWillExpandListener") {
        @Override
        public void map() {
            ((JTree) getSource()).removeTreeWillExpandListener(treeWillExpandListener);
        }
    });
}
 
Example #5
Source File: GraphicalTreeRenderer.java    From jsqsh with Apache License 2.0 5 votes vote down vote up
/**
 * A way to set a will expand listener, this was added as a hack to 
 * interface with the tree command.  This too will be nullified after
 * the footer has been called.
 * @param twel
 */
public void setTreeListeners(TreeWillExpandListener twel, 
        TreeSelectionListener tsl) {
    
    this.twel = twel;
    
    this.tsl = tsl;
}
 
Example #6
Source File: TreePathSupport.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Add a TreeWillExpandListener.
 * @param l The tree will expand listener
 */
public synchronized void addTreeWillExpandListener (TreeWillExpandListener l) {
    weListeners.add(l);
}
 
Example #7
Source File: TreePathSupport.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Remove a TreeWillExpandListener.
 * @param l The tree will expand listener
 */
public synchronized void removeTreeWillExpandListener (TreeWillExpandListener l) {
    weListeners.remove(l);
}