net.sf.tacos.model.impl
Class BeanWithChildrenTreeContentProvider

java.lang.Object
  extended by net.sf.tacos.model.impl.BeanWithChildrenTreeContentProvider
All Implemented Interfaces:
IContentProvider, ITreeContentProvider

public class BeanWithChildrenTreeContentProvider
extends Object
implements ITreeContentProvider

A useful ITreeContentProvider that can recreate the tree structure using a root bean (of any type) and the property name that will return its children (a Collection of the same type). This class is meant to be used for quickly prototyping trees. You're advised to create your own implementation in order to tweek performance issues.

Author:
andyhot

Constructor Summary
BeanWithChildrenTreeContentProvider(Object root, String childProperty)
           
 
Method Summary
 Collection getChildren(Object parentElement)
          Returns all child elements of a parent.
 List getElements()
           
 Object getParent(Object childElement)
          Returns the parent of the given element, or null if the the parent can't be determined.
 boolean hasChildren(Object parentElement)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanWithChildrenTreeContentProvider

public BeanWithChildrenTreeContentProvider(Object root,
                                           String childProperty)
Method Detail

getChildren

public Collection getChildren(Object parentElement)
Description copied from interface: ITreeContentProvider
Returns all child elements of a parent. The returned collection is not modified by the viewer.

Specified by:
getChildren in interface ITreeContentProvider
Returns:
Collection of child nodes (never null)

hasChildren

public boolean hasChildren(Object parentElement)
Specified by:
hasChildren in interface ITreeContentProvider
Returns:

getParent

public Object getParent(Object childElement)
Description copied from interface: ITreeContentProvider
Returns the parent of the given element, or null if the the parent can't be determined. Revealing a specific element will not work in this case.

Specified by:
getParent in interface ITreeContentProvider
Returns:
parent or null

getElements

public List getElements()
Specified by:
getElements in interface IContentProvider
Returns:


Copyright © 2005-2008 SourceForge.net. All Rights Reserved.