- java.lang.Object
-
- org.nuiton.jaxx.runtime.swing.nav.NavNodeChildLoador<T,O,M,B,N>
-
- Type Parameters:
T- type of data used to create nodes (can be just a String type to use only ids)O- type of data associated with nodesN- type of node to used (to make possible full co-variance and no cast in fal implementations).
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
NavTreeNodeChildLoador,NavTreeTableNodeChildLoador
public abstract class NavNodeChildLoador<T,O,M,B extends NavBridge<M,N>,N extends NavNode<M,N>> extends Object implements Serializable
Object to load childs of a node. It usesNavDataProviderin methodloadChilds(NavBridge, NavNode, NavDataProvider)to obtain datas then build childs nodes. A factory of such objects can be found inNavHelperto make them reusable in other places than inside aNavNodeto auto-load childs. For example when you want to creat by hand a new node, always prefer to reuse a such object rathen than duplicate same code in helper...- Since:
- 2.1
- Author:
- Tony Chemit - dev@tchemit.fr
- See Also:
NavHelper,NavNode, Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedNavNodeChildLoador(Class<O> beanType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidaddChildNodes(N parentNode, List<T> datas, NavDataProvider dataProvider)Add childs to givenparentNodeusing retrivedatasfrom the data provider.abstract NcreateNode(T data, NavDataProvider dataProvider)Hook to create a child node given hisdata.Class<O>getBeanType()Returns the type of data associated with nodes to create.abstract List<T>getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider)Obtain the list of data used to create nodes.voidloadChilds(B bridge, N parentNode, NavDataProvider dataProvider)Load childs of the givenparentnode.
-
-
-
Method Detail
-
getData
public abstract List<T> getData(Class<?> parentClass, String parentId, NavDataProvider dataProvider)
Obtain the list of data used to create nodes. If typeTisO, we directly use the data associated with nodes.- Parameters:
parentClass- type of parentparentId- id of parentdataProvider- the data provider- Returns:
- the list of data
- Throws:
Exception- if any problem
-
createNode
public abstract N createNode(T data, NavDataProvider dataProvider)
Hook to create a child node given hisdata.- Parameters:
data- the data of the node to createdataProvider- the data provider- Returns:
- the created node
-
getBeanType
public Class<O> getBeanType()
Returns the type of data associated with nodes to create.- Returns:
- the type of data associated with created nodes.
-
loadChilds
public void loadChilds(B bridge, N parentNode, NavDataProvider dataProvider)
Load childs of the givenparentnode.- Parameters:
bridge- the model owner of nodesparentNode- the parent node where to insert nodesdataProvider- data provider- Throws:
Exception- pour tout probleme de recuperation de donnees
-
addChildNodes
protected void addChildNodes(N parentNode, List<T> datas, NavDataProvider dataProvider)
Add childs to givenparentNodeusing retrivedatasfrom the data provider. This method is invoked by theloadChilds(NavBridge, NavNode, NavDataProvider).- Parameters:
parentNode- the node where to insertdatas- the data used to create nodedataProvider- the data provider
-
-