org.annotation.agschema.graphics.vtree
Class VTreeExpansionStateImpl

java.lang.Object
  extended byorg.annotation.agschema.graphics.vtree.VTreeExpansionStateImpl
All Implemented Interfaces:
java.util.EventListener, java.beans.PropertyChangeListener, VTreeExpansionState

public class VTreeExpansionStateImpl
extends java.lang.Object
implements VTreeExpansionState

A simple implementation of the expansion state. Note that when a node is collapsed all it's children if previously collapsed, will now be treated as hidden, and expanding this node will make all its children expanded. Applications should write their own expansion state tailored to their needs.

Author:
nikhild

Constructor Summary
VTreeExpansionStateImpl(javax.swing.tree.TreeNode root)
          Creates a new instance of VTreeExpansionStateImpl
 
Method Summary
 void addListener(VTreeExpansionListener l)
          Add a listener to receive notification of events
 void collapse(javax.swing.tree.TreeNode node)
          Collapses a node.
 void expand(javax.swing.tree.TreeNode node)
          Expands a node
protected  void fireNodeCollapsed(javax.swing.tree.TreeNode node)
           
protected  void fireNodeExpanded(javax.swing.tree.TreeNode node)
           
 javax.swing.tree.TreeNode getRoot()
          Get the root of the tree
 boolean isCollapsed(javax.swing.tree.TreeNode node)
          Returns true iff the node is collapsed
 boolean isExpanded(javax.swing.tree.TreeNode node)
          Returns true iff the node is expanded
 boolean isHidden(javax.swing.tree.TreeNode node)
          Returns true iff an ancestor of the node is collapsed.
 void propertyChange(java.beans.PropertyChangeEvent evt)
           
 void removeListener(VTreeExpansionListener l)
          Remove the listener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VTreeExpansionStateImpl

public VTreeExpansionStateImpl(javax.swing.tree.TreeNode root)
Creates a new instance of VTreeExpansionStateImpl

Method Detail

collapse

public void collapse(javax.swing.tree.TreeNode node)
Description copied from interface: VTreeExpansionState
Collapses a node.

Specified by:
collapse in interface VTreeExpansionState

expand

public void expand(javax.swing.tree.TreeNode node)
Description copied from interface: VTreeExpansionState
Expands a node

Specified by:
expand in interface VTreeExpansionState

getRoot

public javax.swing.tree.TreeNode getRoot()
Description copied from interface: VTreeExpansionState
Get the root of the tree

Specified by:
getRoot in interface VTreeExpansionState

isCollapsed

public boolean isCollapsed(javax.swing.tree.TreeNode node)
Description copied from interface: VTreeExpansionState
Returns true iff the node is collapsed

Specified by:
isCollapsed in interface VTreeExpansionState

isExpanded

public boolean isExpanded(javax.swing.tree.TreeNode node)
Description copied from interface: VTreeExpansionState
Returns true iff the node is expanded

Specified by:
isExpanded in interface VTreeExpansionState

isHidden

public boolean isHidden(javax.swing.tree.TreeNode node)
Description copied from interface: VTreeExpansionState
Returns true iff an ancestor of the node is collapsed.

Specified by:
isHidden in interface VTreeExpansionState

addListener

public void addListener(VTreeExpansionListener l)
Description copied from interface: VTreeExpansionState
Add a listener to receive notification of events

Specified by:
addListener in interface VTreeExpansionState
Parameters:
l - the listener to add

removeListener

public void removeListener(VTreeExpansionListener l)
Description copied from interface: VTreeExpansionState
Remove the listener

Specified by:
removeListener in interface VTreeExpansionState
Parameters:
l - the listener to remove

fireNodeExpanded

protected void fireNodeExpanded(javax.swing.tree.TreeNode node)

fireNodeCollapsed

protected void fireNodeCollapsed(javax.swing.tree.TreeNode node)

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener