eu.beesoft.gaia.swing
Class ExplorableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by eu.beesoft.gaia.swing.ExplorableTreeNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
TreeTableNode

public abstract class ExplorableTreeNode
extends javax.swing.tree.DefaultMutableTreeNode

Abstract tree node proposed for data lazy loading. If this node has set the 'explorable' property and tree where this node is displayed has installed ExplorationTreeListener as tree expansion listener, then method exploreImpl() is invoked when this node is the first time displayed. Subclass and override this method to process lazy loading.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, EMPTY_ENUMERATION, children, parent, userObject
 
Constructor Summary
ExplorableTreeNode()
          Default empty constructor.
 
Method Summary
 void explore()
          If this node is not explored yet, invokes exploreImpl() method.
protected abstract  void exploreImpl()
          This method is invoked if the node is explorable and was not explored yet.
 boolean getAllowsChildren()
          Overriden to return value of isExplorable() method.
 boolean isExplorable()
          Returns state of the 'explorable' property.
 boolean isExplored()
          Returns true if node was explored or is not explorable or has some children already.
 boolean isLeaf()
          Returns true if this node is a leaf.
 void setExplorable(boolean value)
          Sets the 'explorable' property.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, clone, depthFirstEnumeration, getDepth, getFirstChild, getFirstLeaf, getChildAfter, getChildAt, getChildBefore, getChildCount, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, children, insert, isNodeAncestor, isNodeDescendant, isNodeChild, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExplorableTreeNode

public ExplorableTreeNode()
Default empty constructor.

Method Detail

getAllowsChildren

public boolean getAllowsChildren()
Overriden to return value of isExplorable() method.

Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Overrides:
getAllowsChildren in class javax.swing.tree.DefaultMutableTreeNode
Returns:
true if node may have children

isLeaf

public boolean isLeaf()
Returns true if this node is a leaf. If the node is explorable, returns true only if it is explored and has no children.

Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Overrides:
isLeaf in class javax.swing.tree.DefaultMutableTreeNode
Returns:
true if this node is a leaf

isExplorable

public boolean isExplorable()
Returns state of the 'explorable' property.

Returns:
a value of the 'explorable' property.

setExplorable

public void setExplorable(boolean value)
Sets the 'explorable' property. Also sets 'explored' property with inverted value.

Parameters:
value - - a value to set

isExplored

public boolean isExplored()
Returns true if node was explored or is not explorable or has some children already.

Returns:
true if node does not need to explore

explore

public final void explore()
If this node is not explored yet, invokes exploreImpl() method.


exploreImpl

protected abstract void exploreImpl()
This method is invoked if the node is explorable and was not explored yet. Override it to lazy load children for this node.