Class AbstractTreeViewNode<NODE extends AbstractTreeViewNode<?>>
- java.lang.Object
-
- com.hybris.cockpitng.widgets.collectionbrowser.mold.impl.treeview.AbstractTreeViewNode<NODE>
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
TreeViewCollectionBrowserNode
public abstract class AbstractTreeViewNode<NODE extends AbstractTreeViewNode<?>> extends java.lang.Object implements java.io.SerializableAbstract tree node class for Collection Browser widget. Parametrized with type of parent/children nodes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<NODE>childrenprotected static intLEAF_CHILDREN_COUNTstatic intTOP_LEVEL
-
Constructor Summary
Constructors Constructor Description AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible)AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, NODE parent)AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, NODE parent, java.util.List<NODE> children)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.util.List<java.lang.Object>applyConfiguration(java.util.List<java.lang.Object> dataAttributes, TreeCollectionNodes configuration)protected abstract NODEcreateChild(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, java.util.List<NODE> children)java.util.List<NODE>getCachedChildren()NODEgetChildAtIndex(int index)java.util.List<NODE>getChildren()This method implements the load-on-demand mechanism, as it dynamically loads and caches the children when necessaryintgetChildrenCount()<T> TgetData()intgetLevel()NODEgetParent()DataAttributegetSkippedDataAttribute()intindexOfChild(NODE child)booleanisAccessible()booleanisLeaf()booleanisSelectable()booleanisSkipOnlyAttributes()booleanisTopLevel()protected voidloadChildren()Load children of this tree node if user has read access to its underlying objectvoidsetSkipOnlyAttributes(boolean skipOnlyAttributes)voidsetSkippedDataAttribute(DataAttribute skippedDataAttribute)
-
-
-
Field Detail
-
TOP_LEVEL
public static final int TOP_LEVEL
- See Also:
- Constant Field Values
-
LEAF_CHILDREN_COUNT
protected static final int LEAF_CHILDREN_COUNT
- See Also:
- Constant Field Values
-
children
protected transient java.util.List<NODE extends AbstractTreeViewNode<?>> children
-
-
Constructor Detail
-
AbstractTreeViewNode
public AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible)
- Parameters:
helper- helper class to be used for data extraction; cannot benulldata- underlying object of a tree node; cannot benullaccessible- if user has access to the underlying object
-
AbstractTreeViewNode
public AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, NODE parent)
- Parameters:
helper- helper class to be used for data extraction; cannot benulldata- underlying object of a tree node; cannot benullaccessible- if user has access to the underlying objectparent- parent tree node;nullmeans it's a top-level node
-
AbstractTreeViewNode
public AbstractTreeViewNode(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, NODE parent, java.util.List<NODE> children)
- Parameters:
helper- helper class to be used for data extraction; cannot benulldata- underlying object of a tree node; cannot benullaccessible- if user has access to the underlying objectparent- parent tree node;nullmeans it's a top-level nodechildren- list of children nodes;nullwill cause load on demand
-
-
Method Detail
-
getData
public <T> T getData()
- Returns:
- tree node's underlying data object
-
getParent
public NODE getParent()
- Returns:
- tree node's parent or
nullif it's a top-level node
-
getChildren
public java.util.List<NODE> getChildren()
This method implements the load-on-demand mechanism, as it dynamically loads and caches the children when necessary- Returns:
- tree node's children or an empty list if there is none
-
getCachedChildren
public java.util.List<NODE> getCachedChildren()
- Returns:
- tree node's children from cache; empty list if the cache wasn't initialized yet or if there are no children
-
loadChildren
protected void loadChildren()
Load children of this tree node if user has read access to its underlying object
-
applyConfiguration
protected java.util.List<java.lang.Object> applyConfiguration(java.util.List<java.lang.Object> dataAttributes, TreeCollectionNodes configuration)
-
createChild
protected abstract NODE createChild(TreeViewCollectionBrowserHelper helper, java.lang.Object data, boolean accessible, java.util.List<NODE> children)
- Returns:
- new child node of current node with given underlying data and optional children
-
getChildAtIndex
public NODE getChildAtIndex(int index)
- Returns:
- child at given index
- Throws:
java.lang.IndexOutOfBoundsException- if the index is out of range
-
indexOfChild
public int indexOfChild(NODE child)
- Returns:
- index of given child or
-1if it's not a child of this node
-
getChildrenCount
public int getChildrenCount()
- Returns:
- children count
-
getLevel
public int getLevel()
- Returns:
- node's nesting level
-
isAccessible
public boolean isAccessible()
- Returns:
- if current user has read access to the underlying data object
-
isLeaf
public boolean isLeaf()
- Returns:
- if node is a leaf
-
isTopLevel
public boolean isTopLevel()
-
isSelectable
public boolean isSelectable()
- Returns:
- if node can be selected
-
isSkipOnlyAttributes
public boolean isSkipOnlyAttributes()
- Returns:
- true if the only data attribute should be skipped
-
setSkipOnlyAttributes
public void setSkipOnlyAttributes(boolean skipOnlyAttributes)
- Parameters:
skipOnlyAttributes- true if the only data attribute should be skipped
-
getSkippedDataAttribute
public DataAttribute getSkippedDataAttribute()
- Returns:
- data attribute that was skipped or null otherwise
-
setSkippedDataAttribute
public void setSkippedDataAttribute(DataAttribute skippedDataAttribute)
- Parameters:
skippedDataAttribute- data attribute that was skipped
-
-