com.alee.extended.tree
Class AsyncUniqueNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by com.alee.laf.tree.UniqueNode
          extended by com.alee.extended.tree.AsyncUniqueNode
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode
Direct Known Subclasses:
FileTreeNode, SampleNode

public abstract class AsyncUniqueNode
extends UniqueNode
implements java.io.Serializable

Custom UniqueNode for WebAsyncTree. In addition to UniqueNode it contains a loader icon and busy state indicator.

Author:
Mikle Garin
See Also:
Serialized Form

Field Summary
protected  java.lang.Throwable failureCause
          Childs load failure cause.
protected  javax.swing.ImageIcon loaderIcon
          Special separate loader icon for each tree node.
protected  AsyncNodeState state
          Current async node state.
 
Fields inherited from class com.alee.laf.tree.UniqueNode
id, ID_PREFIX
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
AsyncUniqueNode()
          Costructs default node.
AsyncUniqueNode(java.lang.Object userObject)
          Constructs AsyncUniqueNode with a custom user object.
 
Method Summary
protected  javax.swing.ImageIcon createLoaderIcon()
          Returns newly created loader icon for this node.
 AsyncUniqueNode getChildAt(int index)
          
 java.lang.Throwable getFailureCause()
          Returns childs load failure cause.
 javax.swing.ImageIcon getLoaderIcon()
          Returns loader icon for this node.
 AsyncUniqueNode getParent()
          
 AsyncNodeState getState()
          Returns async node state.
 boolean isFailed()
          Returns whether node childs load failed or not.
 boolean isLoaded()
          Returns whether node childs are loaded or not.
 boolean isLoading()
          Returns whether node childs are being loaded or not.
 boolean isWaiting()
          Returns whether node is in waiting state.
 void setFailureCause(java.lang.Throwable failureCause)
          Sets childs load failure cause.
 void setState(AsyncNodeState state)
          Sets async node state.
 
Methods inherited from class com.alee.laf.tree.UniqueNode
getId, getTreePath, setId, setId, toString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

loaderIcon

protected transient javax.swing.ImageIcon loaderIcon
Special separate loader icon for each tree node. This is required to provide separate image observers to optimize tree repaints around the animated icon.


state

protected AsyncNodeState state
Current async node state.


failureCause

protected java.lang.Throwable failureCause
Childs load failure cause.

Constructor Detail

AsyncUniqueNode

public AsyncUniqueNode()
Costructs default node.


AsyncUniqueNode

public AsyncUniqueNode(java.lang.Object userObject)
Constructs AsyncUniqueNode with a custom user object.

Parameters:
userObject - custom user object
Method Detail

getState

public AsyncNodeState getState()
Returns async node state.

Returns:
async node state

isWaiting

public boolean isWaiting()
Returns whether node is in waiting state.

Returns:
true if node is in waiting state, false otherwise

isLoading

public boolean isLoading()
Returns whether node childs are being loaded or not.

Returns:
true if node childs are being loaded, false otherwise

isLoaded

public boolean isLoaded()
Returns whether node childs are loaded or not.

Returns:
true if node childs are loaded, false otherwise

isFailed

public boolean isFailed()
Returns whether node childs load failed or not.

Returns:
true if node childs load failed, false otherwise

setState

public void setState(AsyncNodeState state)
Sets async node state. Do not change this value on your own since that might break the tree.

Parameters:
state - new async node state

getFailureCause

public java.lang.Throwable getFailureCause()
Returns childs load failure cause.

Returns:
childs load failure cause

setFailureCause

public void setFailureCause(java.lang.Throwable failureCause)
Sets childs load failure cause.

Parameters:
failureCause - childs load failure cause

getLoaderIcon

public javax.swing.ImageIcon getLoaderIcon()
Returns loader icon for this node.

Returns:
loader icon

createLoaderIcon

protected javax.swing.ImageIcon createLoaderIcon()
Returns newly created loader icon for this node.

Returns:
loader icon

getParent

public AsyncUniqueNode getParent()

Specified by:
getParent in interface javax.swing.tree.TreeNode
Overrides:
getParent in class UniqueNode

getChildAt

public AsyncUniqueNode getChildAt(int index)

Specified by:
getChildAt in interface javax.swing.tree.TreeNode
Overrides:
getChildAt in class javax.swing.tree.DefaultMutableTreeNode