Package de.xima.fc.common.form
Class TreeAccessorXItem
- java.lang.Object
-
- de.xima.fc.common.form.TreeAccessorXItem
-
- All Implemented Interfaces:
ITreeAccessor<XItem,String>
public final class TreeAccessorXItem extends Object implements ITreeAccessor<XItem,String>
AITreeAccessorforXItemthat accesses the children of an item. The hierarchy is specified by an item'sparent ID. TheIDisAXItemPropertiesData.getId().
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<XItem>getChildren(XItem xItem)StringgetId(XItem xItem)static ITreeAccessor<XItem,String>ofChildMap(Map<String,? extends List<XItem>> childMap)Creates a new tree accessor for XItems using the given precomputed child map.static ITreeAccessor<XItem,String>ofXForm(IXForm xForm)Creates a new tree accessor for the XItems of the given form.static ITreeAccessor<XItem,String>ofXItems(Iterable<XItem> xItems)Creates a new tree accessor for the given XItems.
-
-
-
Method Detail
-
getChildren
public List<XItem> getChildren(XItem xItem)
- Specified by:
getChildrenin interfaceITreeAccessor<XItem,String>- Parameters:
xItem- The node for which to get the children.- Returns:
- A list of all children of the given tree node, empty array if it is a leaf node.
-
getId
public String getId(XItem xItem)
- Specified by:
getIdin interfaceITreeAccessor<XItem,String>- Parameters:
xItem- A node for which to retrieve its ID.- Returns:
- The (unique) identifier of the given tree node.
-
ofChildMap
public static ITreeAccessor<XItem,String> ofChildMap(Map<String,? extends List<XItem>> childMap)
Creates a new tree accessor for XItems using the given precomputed child map.- Parameters:
childMap- A map from theIDof an item to its children.- Returns:
- A tree accessor for XItems.
-
ofXForm
public static ITreeAccessor<XItem,String> ofXForm(IXForm xForm)
Creates a new tree accessor for the XItems of the given form.- Parameters:
xForm- A form with XItems.- Returns:
- A tree accessor for XItems.
-
ofXItems
public static ITreeAccessor<XItem,String> ofXItems(Iterable<XItem> xItems)
Creates a new tree accessor for the given XItems.- Parameters:
xItems- A list of items that form a hierarchy.- Returns:
- A tree accessor for XItems.
-
-