Class AutoChildNodeLoader<I>
- java.lang.Object
-
- net.sf.basedb.util.overview.loader.AutoChildNodeLoader<I>
-
- All Implemented Interfaces:
NodeLoader<I>
public class AutoChildNodeLoader<I> extends Object implements NodeLoader<I>
Node loader implementation that automatically loads child nodes. When any of thecreate...
methods are called the actual node loading is delegated to a parent node loader. If this loader returns a non-null node,loadChildNodes(DbControl, OverviewContext, Node)
is automatically invoked on it.The automatic loading can of course only be done one step down, since the new children probably needs a different parent node loader. It is possible to make the loading fully recursive by if the
NodeLoaderFactory
returned fromOverviewContext.getNodeLoaderFactory()
wrap all node loaders it create by an instance of this class.- Version:
- 2.10
- Author:
- Nicklas
- Last modified
- $Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
-
-
Field Summary
Fields Modifier and Type Field Description private NodeLoader<I>
parent
-
Constructor Summary
Constructors Constructor Description AutoChildNodeLoader(NodeLoader<I> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Node
createForwardNode(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the 'parent' node loader.Node
createPropertyNode(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the 'parent' node loader.Node
createReverseNode(DbControl dc, OverviewContext context, Node childNode)
Call the same method on the 'parent' node loader.Node
createRootNode(DbControl dc, OverviewContext context, I item)
Call the same method on the 'parent' node loader.boolean
loadChildNodes(DbControl dc, OverviewContext context, Node node)
Call the same method on the 'parent' node loader.String
toString()
-
-
-
Field Detail
-
parent
private final NodeLoader<I> parent
-
-
Constructor Detail
-
AutoChildNodeLoader
public AutoChildNodeLoader(NodeLoader<I> parent)
-
-
Method Detail
-
createForwardNode
public Node createForwardNode(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the 'parent' node loader. If one or more child nodes are added to the parent node, theloadChildNodes(DbControl, OverviewContext, Node)
is called for each of the new nodes.- Specified by:
createForwardNode
in interfaceNodeLoader<I>
- Parameters:
dc
- The DbControl to use for database accesscontext
- The overview contextparentNode
- The parent node- Returns:
- The node that the parent node loader creates (may be null)
-
createPropertyNode
public Node createPropertyNode(DbControl dc, OverviewContext context, Node parentNode)
Call the same method on the 'parent' node loader. If one or more child nodes are added to the parent node, theloadChildNodes(DbControl, OverviewContext, Node)
is called for each of the new nodes.- Specified by:
createPropertyNode
in interfaceNodeLoader<I>
- Parameters:
dc
- The DbControl to use for database accesscontext
- The overview contextparentNode
- The parent node- Returns:
- The node that the parent node loader creates (may be null)
-
createReverseNode
public Node createReverseNode(DbControl dc, OverviewContext context, Node childNode)
Call the same method on the 'parent' node loader. If one or more child nodes are added to the parent node, theloadChildNodes(DbControl, OverviewContext, Node)
is called for each of the new nodes.- Specified by:
createReverseNode
in interfaceNodeLoader<I>
- Parameters:
dc
- The DbControl to use for database accesscontext
- The overview contextchildNode
- The child node- Returns:
- The node that the parent node loader creates (may be null)
-
createRootNode
public Node createRootNode(DbControl dc, OverviewContext context, I item)
Call the same method on the 'parent' node loader. If a node is createdloadChildNodes(DbControl, OverviewContext, Node)
is called on the new node.- Specified by:
createRootNode
in interfaceNodeLoader<I>
- Parameters:
dc
- The DbControl to use for database accesscontext
- The overview contextitem
- The root item- Returns:
- The node that the parent node loader creates (may be null)
-
loadChildNodes
public boolean loadChildNodes(DbControl dc, OverviewContext context, Node node)
Call the same method on the 'parent' node loader.- Specified by:
loadChildNodes
in interfaceNodeLoader<I>
- Parameters:
dc
- The DbControl to use for database accesscontext
- The overview contextnode
- The node- Returns:
- The result of the parent call
-
-