Class NavNodeChildLoador<T,​O,​M,​B extends NavBridge<M,​N>,​N extends NavNode<M,​N>>

java.lang.Object
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 nodes
N - type of node to used (to make possible full co-variance and no cast in fal implementations).
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
NavTreeNodeChildLoador, NavTreeTableNodeChildLoador

public abstract class NavNodeChildLoador<T,​O,​M,​B extends NavBridge<M,​N>,​N extends NavNode<M,​N>>
extends java.lang.Object
implements java.io.Serializable
Object to load childs of a node. It uses NavDataProvider in method loadChilds(NavBridge, NavNode, NavDataProvider) to obtain datas then build childs nodes. A factory of such objects can be found in NavHelper to make them reusable in other places than inside a NavNode to 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 - chemit@codelutin.com
See Also:
NavHelper, NavNode, Serialized Form
  • Field Summary

    Fields
    Modifier and Type Field Description
    protected java.lang.Class<O> beanType
    Type of data of the node
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected NavNodeChildLoador​(java.lang.Class<O> beanType)  
  • Method Summary

    Modifier and Type Method Description
    protected void addChildNodes​(N parentNode, java.util.List<T> datas, NavDataProvider dataProvider)
    Add childs to given parentNode using retrive datas from the data provider.
    abstract N createNode​(T data, NavDataProvider dataProvider)
    Hook to create a child node given his data.
    java.lang.Class<O> getBeanType()
    Returns the type of data associated with nodes to create.
    abstract java.util.List<T> getData​(java.lang.Class<?> parentClass, java.lang.String parentId, NavDataProvider dataProvider)
    Obtain the list of data used to create nodes.
    void loadChilds​(B bridge, N parentNode, NavDataProvider dataProvider)
    Load childs of the given parentnode.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • beanType

      protected final java.lang.Class<O> beanType
      Type of data of the node
  • Constructor Details

    • NavNodeChildLoador

      protected NavNodeChildLoador​(java.lang.Class<O> beanType)
  • Method Details

    • getData

      public abstract java.util.List<T> getData​(java.lang.Class<?> parentClass, java.lang.String parentId, NavDataProvider dataProvider) throws java.lang.Exception
      Obtain the list of data used to create nodes. If type T is O, we directly use the data associated with nodes.
      Parameters:
      parentClass - type of parent
      parentId - id of parent
      dataProvider - the data provider
      Returns:
      the list of data
      Throws:
      java.lang.Exception - if any problem
    • createNode

      public abstract N createNode​(T data, NavDataProvider dataProvider)
      Hook to create a child node given his data.
      Parameters:
      data - the data of the node to create
      dataProvider - the data provider
      Returns:
      the created node
    • getBeanType

      public java.lang.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) throws java.lang.Exception
      Load childs of the given parentnode.
      Parameters:
      bridge - the model owner of nodes
      parentNode - the parent node where to insert nodes
      dataProvider - data provider
      Throws:
      java.lang.Exception - pour tout probleme de recuperation de donnees
    • addChildNodes

      protected void addChildNodes​(N parentNode, java.util.List<T> datas, NavDataProvider dataProvider)
      Add childs to given parentNode using retrive datas from the data provider. This method is invoked by the loadChilds(NavBridge, NavNode, NavDataProvider).
      Parameters:
      parentNode - the node where to insert
      datas - the data used to create node
      dataProvider - the data provider