cern::gp::explorer::test::helpers::RecursiveChildrenListManager Class Reference

Inheritance diagram for cern::gp::explorer::test::helpers::RecursiveChildrenListManager:
Inheritance graph
[legend]
Collaboration diagram for cern::gp::explorer::test::helpers::RecursiveChildrenListManager:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 RecursiveChildrenListManager ()
 RecursiveChildrenListManager (int children)
 RecursiveChildrenListManager (int children, int childrenPerParent)
 RecursiveChildrenListManager (Class beanClass, int children, int childrenPerParent)
Comparator getComparator ()
void initChildrenList (NodeList nodeList)

Private Member Functions

Object createBean (String args)

Static Private Member Functions

static Constructor getConstructor (Class clazz)

Private Attributes

int count = 0
final int children
final int childrenPerParent
final Class beanClass
final Constructor beanConstructor

Static Private Attributes

static final int DEFAULT_CHILDREN = 10
static final int DEFAULT_CHILDREN_PER_PARENT = 3
static final Class DEFAULT_BEAN_CLASS = SimpleDemoBean.class

Detailed Description

an implementation of the ChildrenListManager to be used for testing and quick hacks. It recursively adds children of the same type to the parent, up to the number of children specified. This class is typically used in the following way:

     GPNode root = NodeFactory.createNode(new SimpleDemoBean("parent"), new RecursiveChildrenListManager(10, 3));
     expl = new TreeExplorer();
     expl.setRootNode(root);
 

This creates a tree, in which you can expand 10 parent nodes

Author:
Vito Baggiolini
Version:
Revision
1.2
Date
2006/09/25 08:52:36

Constructor & Destructor Documentation

cern::gp::explorer::test::helpers::RecursiveChildrenListManager::RecursiveChildrenListManager (  )  [inline]

Constructor to create a tree with a pre-defined number of children. This constructor uses SimpleDemoBean as Beans to display in the tree. If you need to change the default settings use a different constructor.

References DEFAULT_CHILDREN, and DEFAULT_CHILDREN_PER_PARENT.

cern::gp::explorer::test::helpers::RecursiveChildrenListManager::RecursiveChildrenListManager ( int  children  )  [inline]

constructor that allows to specify how many times children are added to the parents, when the user opens the branches of the tree. After this number has been reached, no further children will be added to the parent, trying to open further branch of the tree will simply result in leaf nodes.

Parameters:
children how many times children shall be added

References DEFAULT_BEAN_CLASS, and DEFAULT_CHILDREN_PER_PARENT.

cern::gp::explorer::test::helpers::RecursiveChildrenListManager::RecursiveChildrenListManager ( int  children,
int  childrenPerParent 
) [inline]

Constructor that allows to specify (1) how many times children are added to parents when the user opens the branches of the tree and (2) how many children are added to each parent.

Parameters:
children how many times children shall be added
childrenPerParent how many children shall be added to each parent

References DEFAULT_BEAN_CLASS.

cern::gp::explorer::test::helpers::RecursiveChildrenListManager::RecursiveChildrenListManager ( Class  beanClass,
int  children,
int  childrenPerParent 
) [inline]

constructor that allows to specify how many times children are added to the parents, and how many sibling children are added each time, and the Bean class to use

Parameters:
beanClass the class to use as bean. This class should either have a constructor that accepts a String (preferred) or at least a no-argument constructor.
children the number of times children shall be added
the number of sibling children added to each parent

References beanConstructor, and getConstructor().


Member Function Documentation

Object cern::gp::explorer::test::helpers::RecursiveChildrenListManager::createBean ( String  args  )  [inline, private]

helper method, uses the variable beanConstructor to create a new Bean

References beanClass, and beanConstructor.

Referenced by initChildrenList().

Comparator cern::gp::explorer::test::helpers::RecursiveChildrenListManager::getComparator (  )  [inline]

Returns a comparator that can be used to sort the collection of nodes managed by this class. null can be returned to specify that the collection should not be sorted. If a comparator is returned it should be able to compare two nodes belonging to the children managed by this manager. An adapter can be used to deal with the bean associated to the node instead of the nodes itself.

Returns:
a comparator for the node or null
See also:
BeanComparatorAdapter

Implements cern::gp::nodes::children::ChildrenManager.

static Constructor cern::gp::explorer::test::helpers::RecursiveChildrenListManager::getConstructor ( Class  clazz  )  [inline, static, private]

helper method, tries to find a suitable constructor from the class specified Currently, this must either be a constructor that accepts one string or a no-argument constructor.

Referenced by RecursiveChildrenListManager().

void cern::gp::explorer::test::helpers::RecursiveChildrenListManager::initChildrenList ( NodeList  nodeList  )  [inline]

Receives the NodeList that is managed by this manager and that can be used to add or remove children.

This method is called lazily once when the children are going to be displayed. It is similar to the addNotify() of a GUI component.

The implementation of this method should do two things. First it should initialize the list of children with the current children. For that it can use the method addNode of the nodeList. Second, and only if the children are dynamic and are changing based on some external events, it should keep the reference to the given nodeList for future use.

If the children are not dynamic, which means that they don't change after they have been initialized here, there is no need to keep a reference to the nodeList.

Parameters:
nodelist the list representing the children managed by this manager

Implements cern::gp::nodes::children::ChildrenListManager.

References cern::gp::nodes::children::NodeList::addNode(), children, childrenPerParent, count, and createBean().


Member Data Documentation

Referenced by createBean().

Referenced by initChildrenList().

Referenced by initChildrenList().

Referenced by initChildrenList().


The documentation for this class was generated from the following file:

Generated by  doxygen 1.6.2