Example usage for javax.swing.event TreeExpansionEvent TreeExpansionEvent

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

Introduction

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

Prototype

public TreeExpansionEvent(Object source, TreePath path) 

Source Link

Document

Constructs a TreeExpansionEvent object.

Usage

From source file:org.wings.STree.java

/**
 * Notifies all listeners that have registered interest for
 * notification on this event type.  The event instance
 * is lazily created using the <code>path</code> parameter.
 *
 * @param path the <code>TreePath</code> indicating the node that was
 *             expanded/*from  ww w .j ava2s  .  c o  m*/
 * @see EventListenerList
 */
public void fireTreeWillExpand(TreePath path, boolean expand) throws ExpandVetoException {

    // Guaranteed to return a non-null array
    Object[] listeners = getListenerList();
    TreeExpansionEvent e = null;
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == TreeWillExpandListener.class) {
            // Lazily create the event:
            if (e == null)
                e = new TreeExpansionEvent(this, path);

            if (expand) {
                ((TreeWillExpandListener) listeners[i + 1]).treeWillExpand(e);
            } else {
                ((TreeWillExpandListener) listeners[i + 1]).treeWillCollapse(e);
            }
        }
    }
}

From source file:org.wings.STree.java

/**
 * Notify all listeners that have registered interest for
 * notification on this event type.  The event instance
 * is lazily created using the parameters passed into
 * the fire method./*from  w ww  . j  av a 2  s  .  c  o  m*/
 *
 * @param path the TreePath indicating the node that was expanded
 * @see EventListenerList
 */
protected void fireTreeExpanded(TreePath path) {
    fireTreeExpansionEvent(new TreeExpansionEvent(this, path), true);
}

From source file:org.wings.STree.java

/**
 * Notify all listeners that have registered interest for
 * notification on this event type.  The event instance
 * is lazily created using the parameters passed into
 * the fire method.//  w  ww .j  a  v a 2 s  .  com
 *
 * @param path the TreePath indicating the node that was collapsed
 * @see EventListenerList
 */
public void fireTreeCollapsed(TreePath path) {
    fireTreeExpansionEvent(new TreeExpansionEvent(this, path), false);
}