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

  • Type Parameters:
    DATATYPE - tree item value type
    ITEMTYPE - tree item implementation type
    All Superinterfaces:
    IBasicTreeItem<DATATYPE,​ITEMTYPE>, 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 Implementing Classes:
    BasicTreeItem, DefaultTreeItem

    public interface ITreeItem<DATATYPE,​ITEMTYPE extends ITreeItem<DATATYPE,​ITEMTYPE>>
    extends IBasicTreeItem<DATATYPE,​ITEMTYPE>
    Base interface for simple tree items
    Author:
    Philip Helger
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ITEMTYPE createChildItem​(DATATYPE aData)
      Add a child item to this item.
      ITreeItemFactory<DATATYPE,​ITEMTYPE> getFactory()  
      com.helger.commons.state.EChange internalAddChild​(ITEMTYPE aChild)
      Add an existing child to this tree item.
      com.helger.commons.state.EChange removeChild​(ITEMTYPE aChild)
      Remove the passed node as a child node from this node.
      void reorderChildItems​(Comparator<? super ITEMTYPE> aComparator)
      Reorder the child items based on the item itself.
      • 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

      • internalAddChild

        @Nonnull
        com.helger.commons.state.EChange internalAddChild​(@Nonnull
                                                          ITEMTYPE aChild)
        Add an existing child to this tree item. Use only internally!
        Parameters:
        aChild - The child to be added. May not be null.
        Returns:
        EChange.UNCHANGED if the child is already contained, EChange.CHANGED upon success.
      • createChildItem

        @Nonnull
        ITEMTYPE createChildItem​(@Nullable
                                 DATATYPE aData)
        Add a child item to this item.
        Parameters:
        aData - the data associated with this item
        Returns:
        the created TreeItem object
      • removeChild

        @Nonnull
        com.helger.commons.state.EChange removeChild​(@Nonnull
                                                     ITEMTYPE aChild)
        Remove the passed node as a child node from this node.
        Parameters:
        aChild - The child to be removed. May not be null.
        Returns:
        EChange.CHANGED if the removal succeeded, EChange.UNCHANGED otherwise
      • reorderChildItems

        void reorderChildItems​(@Nonnull
                               Comparator<? super ITEMTYPE> aComparator)
        Reorder the child items based on the item itself.
        Parameters:
        aComparator - The comparator use. May not be null.