2.17.2: 2011-06-17

net.sf.basedb.util.overview.loader
Class AutoChildNodeLoader<I>

java.lang.Object
  extended by 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 the create... 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 from OverviewContext.getNodeLoaderFactory() wrap all node loaders it create by an instance of this class.

Version:
2.10
Author:
Nicklas
Last modified
$Date: 2009-02-05 14:39:25 +0100 (Thu, 05 Feb 2009) $

Field Summary
private  NodeLoader<I> parent
           
 
Constructor Summary
AutoChildNodeLoader(NodeLoader<I> parent)
           
 
Method Summary
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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 a node is created loadChildNodes(DbControl, OverviewContext, Node) is called on the new node.

Specified by:
createForwardNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - 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 a node is created loadChildNodes(DbControl, OverviewContext, Node) is called on the new node.

Specified by:
createPropertyNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
parentNode - 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 a node is created loadChildNodes(DbControl, OverviewContext, Node) is called on the new node.

Specified by:
createReverseNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
childNode - 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 created loadChildNodes(DbControl, OverviewContext, Node) is called on the new node.

Specified by:
createRootNode in interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
item - 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 interface NodeLoader<I>
Parameters:
dc - The DbControl to use for database access
context - The overview context
node - The node
Returns:
The result of the parent call

toString

public String toString()
Overrides:
toString in class Object

2.17.2: 2011-06-17