Class 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: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
    • 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, the loadChildNodes(DbControl, OverviewContext, Node) is called for each of the new nodes.
        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 one or more child nodes are added to the parent node, the loadChildNodes(DbControl, OverviewContext, Node) is called for each of the new nodes.
        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 one or more child nodes are added to the parent node, the loadChildNodes(DbControl, OverviewContext, Node) is called for each of the new nodes.
        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)
      • 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