jaxx.runtime.swing.nav.treetable
Class NavTreeTableNode<N extends NavTreeTableNode<N>>

java.lang.Object
  extended by org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode
      extended by org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode
          extended by jaxx.runtime.swing.nav.treetable.NavTreeTableNode<N>
All Implemented Interfaces:
Serializable, Cloneable, TreeNode, NavNode<NavTreeTableModel,N>, org.jdesktop.swingx.treetable.MutableTreeTableNode, org.jdesktop.swingx.treetable.TreeTableNode

public class NavTreeTableNode<N extends NavTreeTableNode<N>>
extends org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode
implements NavNode<NavTreeTableModel,N>

Implementation of NavNode used to create in tree table This node extends DefaultMutableTreeTableNode used by JXTreeTable

Since:
2.2
Author:
sletellier
See Also:
Serialized Form

Field Summary
protected  NavTreeTableNodeChildLoador<?,?,N> childLoador
          Optional child loador to lazy create childs of the node.
protected  String context
          Optinal context to distinguish different nodes with same internalClass.
protected  boolean dirty
          Flag to know when renderer should (re-)compute render of the node.
protected  String id
          Id of the data associated with the node.
protected  Class<?> internalClass
          Type of data associated with the node
protected  boolean loaded
          Flag to know when the none static node was loaded.
 
Fields inherited from class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode
allowsChildren, children, parent, userObject
 
Constructor Summary
  NavTreeTableNode(Class<?> internalClass, String id, String context, NavTreeTableNodeChildLoador<?,?,N> childLoador)
           
protected NavTreeTableNode(String id)
           
 
Method Summary
 void add(N node)
           
 Enumeration<N> children()
           
 N findNodeById(String id, NavBridge<NavTreeTableModel,N> model, NavDataProvider provider)
          Given an id, obtain the child with matching id.
 N getChild(String id, NavBridge<NavTreeTableModel,N> model, NavDataProvider provider)
          Given an id, obtain the child with matching id.
 N getChildAt(int index)
           
 N getContainerNode()
          Gets the first node form this one to the root which has a none String type.
 String getContext()
           
 String getId()
           
 Class<?> getInternalClass()
           
 N getParent()
           
 N[] getPathToRoot(NavTreeTableNode aNode, int depth)
           
 Object getUserObject()
           
 void insert(N node, int position)
           
 boolean isDirty()
           
 boolean isLeaf()
           
 boolean isLoaded()
           
 boolean isRoot()
           
 boolean isStaticNode()
          To know if the node is static.
 boolean isStringNode()
          Convinient method to known if the node is a String typed.
 void populateChilds(NavBridge<NavTreeTableModel,N> model, NavDataProvider provider)
          To populate childs of the node (only when a none static node).
 void populateNode(NavBridge<NavTreeTableModel,N> model, NavDataProvider provider, boolean populateChilds)
          To populate the node.
 void remove(N node)
           
 void removeAllChildren()
           
 void setDirty(boolean dirty)
          Changes the NavNode.isDirty() state.
 String toString()
           
 
Methods inherited from class org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode
getColumnCount, getValueAt, isEditable, setValueAt
 
Methods inherited from class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode
add, createChildrenList, getAllowsChildren, getChildCount, getIndex, insert, remove, remove, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.TreeNode
getAllowsChildren, getChildCount, getIndex
 

Field Detail

internalClass

protected final Class<?> internalClass
Type of data associated with the node


context

protected final String context
Optinal context to distinguish different nodes with same internalClass.


id

protected final String id
Id of the data associated with the node.


dirty

protected boolean dirty
Flag to know when renderer should (re-)compute render of the node.


loaded

protected boolean loaded
Flag to know when the none static node was loaded.


childLoador

protected final NavTreeTableNodeChildLoador<?,?,N extends NavTreeTableNode<N>> childLoador
Optional child loador to lazy create childs of the node.

Constructor Detail

NavTreeTableNode

protected NavTreeTableNode(String id)

NavTreeTableNode

public NavTreeTableNode(Class<?> internalClass,
                        String id,
                        String context,
                        NavTreeTableNodeChildLoador<?,?,N> childLoador)
Method Detail

getId

public String getId()
Specified by:
getId in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

getContext

public String getContext()
Specified by:
getContext in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

getInternalClass

public Class<?> getInternalClass()
Specified by:
getInternalClass in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

isLoaded

public boolean isLoaded()
Specified by:
isLoaded in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

isDirty

public boolean isDirty()
Specified by:
isDirty in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

isStringNode

public boolean isStringNode()
Description copied from interface: NavNode
Convinient method to known if the node is a String typed.

Specified by:
isStringNode in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Returns:
true if the type of node if

isStaticNode

public boolean isStaticNode()
Description copied from interface: NavNode
To know if the node is static.

A static node has no childLoador.

Specified by:
isStaticNode in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Returns:
true when the node is static : says, the node has no childLoador.

getContainerNode

public N getContainerNode()
Description copied from interface: NavNode
Gets the first node form this one to the root which has a none String type.

Specified by:
getContainerNode in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Returns:
the first concrete node type

isRoot

public boolean isRoot()
Specified by:
isRoot in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

findNodeById

public N findNodeById(String id,
                      NavBridge<NavTreeTableModel,N> model,
                      NavDataProvider provider)
Description copied from interface: NavNode
Given an id, obtain the child with matching id.

If node is NOT loaded, then first loads it (method NavNode.populateChilds(NavBridge , NavDataProvider)) then do search on direct childs of the node recursivly.

Specified by:
findNodeById in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Parameters:
id - the id of the researched node
model - model owner of nodes
provider - data provider
Returns:
the found node or null if not found

getChild

public N getChild(String id,
                  NavBridge<NavTreeTableModel,N> model,
                  NavDataProvider provider)
Description copied from interface: NavNode
Given an id, obtain the child with matching id.

If node is NOT loaded, then first loads it (method NavNode.populateChilds(NavBridge , NavDataProvider)) then return on direct childs of the node.

Specified by:
getChild in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Parameters:
id - the id of the researched node
provider - data provider
Returns:
the found node or null if not found

setDirty

public void setDirty(boolean dirty)
Description copied from interface: NavNode
Changes the NavNode.isDirty() state.

As a side effect, when a renderer will use this node, it will force to reload the render from the NavDataProvider.

Specified by:
setDirty in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Parameters:
dirty - the new dirty value

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface TreeNode
Specified by:
isLeaf in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Overrides:
isLeaf in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

getUserObject

public Object getUserObject()
Specified by:
getUserObject in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Specified by:
getUserObject in interface org.jdesktop.swingx.treetable.TreeTableNode
Overrides:
getUserObject in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

toString

public String toString()
Specified by:
toString in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Overrides:
toString in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

populateNode

public void populateNode(NavBridge<NavTreeTableModel,N> model,
                         NavDataProvider provider,
                         boolean populateChilds)
Description copied from interface: NavNode
To populate the node. A side-effect of this method is to set dirty the node (renderer will recompute the render of the node).

If populateChilds is set to true, then also populate childs of the node using the given dataProvider.

Specified by:
populateNode in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Parameters:
model - le delegate modèles content le noeud
provider - le provider de données
populateChilds - un drapeau pour charger aussi les fils du noeud courant

populateChilds

public void populateChilds(NavBridge<NavTreeTableModel,N> model,
                           NavDataProvider provider)
Description copied from interface: NavNode
To populate childs of the node (only when a none static node). A side-effect of this method is to set loaded of the node.

For a static node, do nothing.

Specified by:
populateChilds in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Parameters:
model - model owner of the node
provider - data provider

getParent

public N getParent()
Specified by:
getParent in interface TreeNode
Specified by:
getParent in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>
Specified by:
getParent in interface org.jdesktop.swingx.treetable.TreeTableNode
Overrides:
getParent in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

getChildAt

public N getChildAt(int index)
Specified by:
getChildAt in interface TreeNode
Specified by:
getChildAt in interface org.jdesktop.swingx.treetable.TreeTableNode
Overrides:
getChildAt in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

children

public Enumeration<N> children()
Specified by:
children in interface TreeNode
Specified by:
children in interface org.jdesktop.swingx.treetable.MutableTreeTableNode
Specified by:
children in interface org.jdesktop.swingx.treetable.TreeTableNode
Overrides:
children in class org.jdesktop.swingx.treetable.AbstractMutableTreeTableNode

removeAllChildren

public void removeAllChildren()

add

public void add(N node)
Specified by:
add in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

getPathToRoot

public N[] getPathToRoot(NavTreeTableNode aNode,
                         int depth)

remove

public void remove(N node)
Specified by:
remove in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>

insert

public void insert(N node,
                   int position)
Specified by:
insert in interface NavNode<NavTreeTableModel,N extends NavTreeTableNode<N>>


Copyright © 2008-2010 CodeLutin. All Rights Reserved.