Class AbstractTreeViewNode<NODE extends AbstractTreeViewNode<?>>

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    TreeViewCollectionBrowserNode

    public abstract class AbstractTreeViewNode<NODE extends AbstractTreeViewNode<?>>
    extends java.lang.Object
    implements java.io.Serializable
    Abstract tree node class for Collection Browser widget. Parametrized with type of parent/children nodes.
    See Also:
    Serialized Form
    • Constructor Detail

      • AbstractTreeViewNode

        public AbstractTreeViewNode​(TreeViewCollectionBrowserHelper helper,
                                    java.lang.Object data,
                                    boolean accessible)
        Parameters:
        helper - helper class to be used for data extraction; cannot be null
        data - underlying object of a tree node; cannot be null
        accessible - 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 be null
        data - underlying object of a tree node; cannot be null
        accessible - if user has access to the underlying object
        parent - parent tree node; null means 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 be null
        data - underlying object of a tree node; cannot be null
        accessible - if user has access to the underlying object
        parent - parent tree node; null means it's a top-level node
        children - list of children nodes; null will 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 null if 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 -1 if 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