com.levigo.util.swing.flextree
Interface TreeContentProvider

All Superinterfaces:
TreeModule

public interface TreeContentProvider
extends TreeModule

Instances are able to provide content (that is, children) for a node in a FlexibleTree. Retrieving content is a two-step process:

  1. For each node being displayed, the TreeContentProviders are asked whether or not they want to provide any contents. This is done via hasChildren(TreePath). The result of this call is used to determine This first call serves as a quick way of deciding whether or not a TreeContentProvider should be taken into account for a given tree node.
  2. Actual content retrieval via getChildren(TreePath). This method is only called if the requested content is actually needed. The reason is that contents assembly potentially takes longer than just deciding whether or not any content shall be contributed.
For content which changes over time, it is possible to additionally implement DynamicTreeModule. Using its facilities, implementors are indirectly able to trigger new requests to hasChildren(TreePath).

See Also:
DynamicTreeModule

Method Summary
 EventList<? extends Object> getChildren(TreePath treePath)
          Returns a EventList containing all the contents (children) for the last tree path component of given tree path.
 boolean hasChildren(TreePath treePath)
          Determines whether the last tree path component can have children.
 

Method Detail

getChildren

EventList<? extends Object> getChildren(TreePath treePath)
Returns a EventList containing all the contents (children) for the last tree path component of given tree path. If no children should be contributed (neither now, nor in the future) this method should return null.

Parameters:
treePath - to supply children for
Returns:
Return an EventList of children or null.

hasChildren

boolean hasChildren(TreePath treePath)
Determines whether the last tree path component can have children. This method serves as a quick indication. Even if true is returned from a call to this method, it is still allowed to return null or an empty list from calls to getChildren(TreePath).

Parameters:
treePath - to analyse
Returns:
true if the last tree path component can have children, otherwise false.


Copyright © 1995-2020 levigo holding gmbh. All Rights Reserved.