public interface NavNode<M,N extends NavNode<M,N>> extends Cloneable, TreeNode, Serializable
childLoador to build childs of
node.
A node is identified by an getId() of an associated data of type
getInternalClass().
Note:
While using a childLoador, we can not know before node
was loaded the exact count of his childs. As a matter of facts, real leaf
nodes appears at the beginning in ui as a not leaf (there is a root handler).
When node was loaded, a leaf node will be then displayed as required.
class MyNode extends NavNode<MyNode> { ... }
While in this class, you overrides every method with a node return type,
co-variance you'll be able to use this code :
MyNode parentNode = new MyNode(); MyNode node = parentNode.getFirstNode();So for final application this generic type avoid any cast for your own node type, this is quite convinient. Even if in your project, you wants to have a heriarchy of nodes, this will still works (if you use a genercic type on your abstract nodes).
internalclasstrue when node render MUST be recomputedtrue when node was loadedstatic nodes.
The method isStaticNode() gives this state.
Note: A static node has no childLoador.
isLoaded() equals
false).
when model requires node's childs, it can load them via method
populateNode(NavBridge, NavDataProvider, boolean)
and populateChilds(NavBridge, NavDataProvider) methods.
AbstractNavTreeCellRenderer looks the isDirty() state to
know when render should be (re-)compute and set back the state to false.
Each time, a node is modified, the isDirty() should be set to true.| Modifier and Type | Method and Description |
|---|---|
void |
add(N node) |
N |
findNodeById(String id,
NavBridge<M,N> bridge,
NavDataProvider provider)
Given an
id, obtain the child with matching id. |
N |
getChild(String id,
NavBridge<M,N> bridge,
NavDataProvider provider)
Given an
id, obtain the child with matching id. |
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() |
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<M,N> bridge,
NavDataProvider provider)
To populate childs of the node (only when a none static node).
|
void |
populateNode(NavBridge<M,N> bridge,
NavDataProvider provider,
boolean populateChilds)
To populate the node.
|
void |
remove(N node) |
void |
setDirty(boolean dirty)
Changes the
isDirty() state. |
String |
toString() |
children, getAllowsChildren, getChildAt, getChildCount, getIndexString getId()
String getContext()
Class<?> getInternalClass()
boolean isLoaded()
boolean isDirty()
boolean isStringNode()
String typed.true if the type of node ifboolean isStaticNode()
static node has no childLoador.true when the node is static : says, the node has
no childLoador.N getContainerNode()
String type.N findNodeById(String id, NavBridge<M,N> bridge, NavDataProvider provider)
id, obtain the child with matching id.
If node is NOT loaded, then first loads it (method
populateChilds(NavBridge, NavDataProvider)) then do search
on direct childs of the node recursivly.id - the id of the researched nodebridge - model owner of nodesprovider - data providernull if not foundN getChild(String id, NavBridge<M,N> bridge, NavDataProvider provider)
id, obtain the child with matching id.
If node is NOT loaded, then first loads it (method
populateChilds(NavBridge, NavDataProvider)) then return
on direct childs of the node.id - the id of the researched nodebridge - model owner of nodesprovider - data providernull if not foundvoid setDirty(boolean dirty)
isDirty() state.
As a side effect, when a renderer will use this node, it will force to
reload the render from the NavDataProvider.dirty - the new dirty valueObject getUserObject()
void populateNode(NavBridge<M,N> bridge, NavDataProvider provider, boolean populateChilds)
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.bridge - le delegate modèles content le noeudprovider - le provider de donnéespopulateChilds - un drapeau pour charger aussi les fils du noeud courantvoid populateChilds(NavBridge<M,N> bridge, NavDataProvider provider)
loaded of the node.
For a static node, do nothing.bridge - model owner of the nodeprovider - data providerboolean isRoot()
void add(N node)
void remove(N node)
void insert(N node, int position)
Copyright © 2008–2017 Ultreia.io. All rights reserved.