com.webmethods.caf.faces.data.tree.object
Class TreeBuilder
java.lang.Object
com.webmethods.caf.faces.data.tree.object.TreeBuilder
public class TreeBuilder
- extends Object
Helper class for building trees.
Method Summary |
static List |
buildFromChildIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding childIdsBinding)
Build a tree out a list of rows,
where the tree structure is determined by child-ids bindings
(ie each row contains a field with the ids of its children). |
static List |
buildFromParentIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding parentIdBinding)
Build a tree out a list of rows,
where the tree structure is determined by parent-id bindings
(ie each row contains a field with the id of its parent). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TreeBuilder
public TreeBuilder()
buildFromParentIds
public static List buildFromParentIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding parentIdBinding)
- Build a tree out a list of rows,
where the tree structure is determined by parent-id bindings
(ie each row contains a field with the id of its parent).
- Parameters:
rows
- List of rows. This may be empty, but not null.rowVariable
- Row variable used in row-id and parent-id bindings.
For example, if the row-id binding is #{row.id}, the row variable is "row".rowIdBinding
- Binding expression that calculates the row-id for the current row.
This must return a unique string id for each row.parentIdBinding
- Binding expression that calculates the parent-id for the current row.
This must return null for rows that represent roots, and a valid parent row-id for all other rows.
- Returns:
- List of
INode
roots of the tree.
Never null; may be empty if original list of rows was empty.
buildFromChildIds
public static List buildFromChildIds(List rows,
String rowVariable,
ValueBinding rowIdBinding,
ValueBinding childIdsBinding)
- Build a tree out a list of rows,
where the tree structure is determined by child-ids bindings
(ie each row contains a field with the ids of its children).
- Parameters:
rows
- List of rows. This may be empty, but not null.rowVariable
- Row variable used in row-id and child-ids bindings.
For example, if the row-id binding is #{row.id}, the row variable is "row".rowIdBinding
- Binding expression that calculates the row-id for the current row.
This must return a unique string id for each row.childIdsBinding
- Binding expression that calculates the child-ids for the current row.
This must return a comma-separated String
of row-ids, a Collection
of row-ids,
an array of String
row-ids, or null. It may return an empty string, collection, or array.
- Returns:
- List of
INode
roots of the tree.
Never null; may be empty if original list of rows was empty.