Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.util
Class TreeSynchronizer  view TreeSynchronizer download TreeSynchronizer.java

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byjava.util.Vector
              extended byorg.greenstone.gatherer.util.TreeSynchronizer
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.EventListener, java.util.List, java.util.RandomAccess, java.io.Serializable, javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener

public final class TreeSynchronizer
extends java.util.Vector
implements javax.swing.event.TreeExpansionListener, javax.swing.event.TreeSelectionListener

My latest diabolical class synchronizes the expansion state of two or more JTrees. Muh-hahahaha. Note that these tree should be based on the same model. If they aren't it won't work. So there.

Version:
2.1

Nested Class Summary
 
Nested classes inherited from class java.util.AbstractList
 
Field Summary
private  boolean ignore
          true if we should temporarily ignore further events, most likely because we know our actions are causing them.
private  java.util.Vector selection_listeners
          A list of tree selection listeners.
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
TreeSynchronizer()
           
 
Method Summary
 void add(javax.swing.JTree tree)
          Add a new tree to the synchronization list of trees to be synchronized.
 void addTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
          We allow the Gatherer to add tree listeners to this class, as it persists between collection changes transparently.
 void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
          Called whenever an item in the tree has been collapsed.
 void treeExpanded(javax.swing.event.TreeExpansionEvent event)
          Called whenever an item in the tree has been expanded.
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
          Called whenever the one of the trees selection changes.
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.util.AbstractCollection
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Field Detail

ignore

private boolean ignore
true if we should temporarily ignore further events, most likely because we know our actions are causing them.


selection_listeners

private java.util.Vector selection_listeners
A list of tree selection listeners.

Constructor Detail

TreeSynchronizer

public TreeSynchronizer()
Method Detail

add

public void add(javax.swing.JTree tree)
Add a new tree to the synchronization list of trees to be synchronized.


addTreeSelectionListener

public void addTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
We allow the Gatherer to add tree listeners to this class, as it persists between collection changes transparently. Thus there is no need to reattach listeners everytime the collection changes.


treeCollapsed

public void treeCollapsed(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been collapsed.

Specified by:
treeCollapsed in interface javax.swing.event.TreeExpansionListener

treeExpanded

public void treeExpanded(javax.swing.event.TreeExpansionEvent event)
Called whenever an item in the tree has been expanded.

Specified by:
treeExpanded in interface javax.swing.event.TreeExpansionListener

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent event)
Called whenever the one of the trees selection changes.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener