Interface IBasicTreeItem<DATATYPE,​ITEMTYPE extends IBasicTreeItem<DATATYPE,​ITEMTYPE>>

  • Type Parameters:
    DATATYPE - Data type of the items.
    ITEMTYPE - tree item type
    All Superinterfaces:
    com.helger.commons.traits.IGenericImplTrait<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildren<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenRecursive<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenSorted<ITEMTYPE>, com.helger.commons.hierarchy.IHasParent<ITEMTYPE>
    All Known Subinterfaces:
    IFolderTreeItem<KEYTYPE,​DATATYPE,​COLLTYPE,​ITEMTYPE>, ITreeItem<DATATYPE,​ITEMTYPE>, ITreeItemWithID<KEYTYPE,​DATATYPE,​ITEMTYPE>
    All Known Implementing Classes:
    BasicFolderTreeItem, BasicTreeItem, BasicTreeItemWithID, DefaultFolderTreeItem, DefaultTreeItem, DefaultTreeItemWithID

    public interface IBasicTreeItem<DATATYPE,​ITEMTYPE extends IBasicTreeItem<DATATYPE,​ITEMTYPE>>
    extends com.helger.commons.hierarchy.IHasParent<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenSorted<ITEMTYPE>, com.helger.commons.hierarchy.IHasChildrenRecursive<ITEMTYPE>, com.helger.commons.traits.IGenericImplTrait<ITEMTYPE>
    Base interface both for normal tree items and tree items with ID.
    Author:
    Philip Helger
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.helger.commons.state.ESuccess changeParent​(ITEMTYPE aNewParent)
      Change the parent node of this node to another node (subordination).
      com.helger.commons.collection.impl.ICommonsList<DATATYPE> getAllChildDatas()
      Get the data values of all contained children.
      DATATYPE getData()  
      int getLevel()  
      DATATYPE getParentData()  
      boolean isRootItem()  
      boolean isSameOrChildOf​(ITEMTYPE aParent)
      Check if this item is the same or a child of the passed item.
      void setData​(DATATYPE aData)
      Change the data associated with this node.
      • Methods inherited from interface com.helger.commons.traits.IGenericImplTrait

        thisAsT
      • Methods inherited from interface com.helger.commons.hierarchy.IHasChildren

        forAllChildren, forAllChildren, forAllChildrenBreakable, forAllChildrenMapped, getChildCount, getChildren, hasChildren, hasNoChildren
      • Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenRecursive

        forAllChildrenRecursive, forAllChildrenRecursive
      • Methods inherited from interface com.helger.commons.hierarchy.IHasChildrenSorted

        findFirstChild, findFirstChildMapped, getAllChildren, getChildAtIndex, getFirstChild, getLastChild
      • Methods inherited from interface com.helger.commons.hierarchy.IHasParent

        getParent, hasParent
    • Method Detail

      • getData

        @Nullable
        DATATYPE getData()
        Returns:
        the data associated with this node. May be null.
      • getParentData

        @Nullable
        DATATYPE getParentData()
        Returns:
        the data associated with the parent node. May be null. This is like a shortcut for getParent().getData() with implicit null handling.
      • getLevel

        @Nonnegative
        int getLevel()
        Returns:
        The nesting level of this node. The root node has level 0. A child of the root item has level 1 etc.
        Since:
        5.5.0
      • getAllChildDatas

        @Nullable
        com.helger.commons.collection.impl.ICommonsList<DATATYPE> getAllChildDatas()
        Get the data values of all contained children.
        Returns:
        null if this item does not have children. Use IHasChildren.hasChildren() to check for the existence.
      • setData

        void setData​(@Nullable
                     DATATYPE aData)
        Change the data associated with this node.
        Parameters:
        aData - The data associated with this node. May be null.
        Throws:
        IllegalArgumentException - If the data is not valid (depending on any custom validator).
      • isRootItem

        boolean isRootItem()
        Returns:
        true if this is the internal root item without a parent, false if this is a public item.
      • isSameOrChildOf

        boolean isSameOrChildOf​(@Nonnull
                                ITEMTYPE aParent)
        Check if this item is the same or a child of the passed item. This is not limited to direct children but to children on all levels.
        Parameters:
        aParent - The parent item to check whether this is a child of it. May not be null.
        Returns:
        true if this is the same or a child of aParent.
      • changeParent

        @Nonnull
        com.helger.commons.state.ESuccess changeParent​(@Nonnull
                                                       ITEMTYPE aNewParent)
        Change the parent node of this node to another node (subordination).
        Parameters:
        aNewParent - The new parent to use. May not be null. To make it a root item, pass the owning tree's root item.
        Returns:
        ESuccess