Package org.bgerp.model.base.tree

# Class TreeItem<T,C extends TreeItem<T,C>>

java.lang.Object
org.bgerp.model.base.tree.TreeItem<T,C>

Type Parameters:
  `T` - type of node ID
  `C` - inherited subtype of node

All Implemented Interfaces:
  `Id<T>`, `IdTitle<T>`, `Title`, `TreeItem<T,C>`

Direct Known Subclasses:
  `IdStringTitleTreeItem`, `IdTitleTreeItem`, `InetDevice`, `InetService`, `ProcessCreateType`, `ProcessType`

public abstract class TreeItem<T,C extends TreeItem<T,C>> extends Object implements TreeItem<T,C>
Generic tree node item

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected List<C>`
  `children`
  `protected T`
  `id`
  `protected T`
  `parentId`
  `protected String`
  `title`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TreeItem()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `C`
  `addChild(C child)`
  `Set<T>`
  `getAllChildIds()`
  `TreeItem<T,C>`
  `getById(T id)`
  Finds node by ID over the node itself and all the children recursively.
  `C`
  `getChild(T id)`
  `int`
  `getChildCount()`
  `Set<T>`
  `getChildIds()`
  `List<C>`
  `getChildren()`
  `String`
  `getIcon()`
  `T`
  `getId()`
  `T`
  `getParentId()`
  `String`
  `getTextStyle()`
  `String`
  `getTitle()`
  `boolean`
  `isInPathTo(Set<T> ids)`
  Checks is ID set contains the item's ID or ID of any child of it
  `protected abstract boolean`
  `isRootNode()`
  `protected boolean`
  `isRootNodeWithIntegerId(Integer id, Integer parentId)`
  `void`
  `setChildren(List<C> children)`
  `void`
  `setId(T id)`
  `void`
  `setParentId(T parentId)`
  `void`
  `setTitle(String value)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### id

    protected T id

  - ### parentId

    protected T parentId

  - ### title

    protected String title

  - ### children

    protected List<C extends TreeItem<T,C>> children

- ## Constructor Details

  - ### TreeItem

    public TreeItem()

- ## Method Details

  - ### getId

    public T getId()
    Specified by:
      `getId` in interface `Id<T>`

  - ### setId

    public void setId(T id)

  - ### getParentId

    public T getParentId()
    Specified by:
      `getParentId` in interface `TreeItem<T,C extends TreeItem<T,C>>`

  - ### setParentId

    public void setParentId(T parentId)

  - ### getTitle

    public String getTitle()
    Specified by:
      `getTitle` in interface `Title`

  - ### setTitle

    public void setTitle(String value)

  - ### getChildren

    public List<C> getChildren()
    Specified by:
      `getChildren` in interface `TreeItem<T,C extends TreeItem<T,C>>`

  - ### setChildren

    public void setChildren(List<C> children)

  - ### addChild

    public C addChild(C child)

  - ### getChild

    public C getChild(T id)

  - ### getById

    public TreeItem<T,C> getById(T id)
    Finds node by ID over the node itself and all the children recursively.
    Parameters:
      `id` - the ID.
    Returns:
      found node or `null`.

  - ### getChildCount

    public int getChildCount()

  - ### getChildIds

    public Set<T> getChildIds()

  - ### getAllChildIds

    public Set<T> getAllChildIds()
    Returns:
      set with the node ID and all child IDs from all levels.

  - ### getIcon

    public String getIcon()
    Returns:
      icon HTML.

  - ### getTextStyle

    public String getTextStyle()
    Returns:
      style attribute for text span.

  - ### isRootNode

    protected abstract boolean isRootNode()

  - ### isRootNodeWithIntegerId

    protected boolean isRootNodeWithIntegerId(Integer id, Integer parentId)

  - ### isInPathTo

    public boolean isInPathTo(Set<T> ids)
    Checks is ID set contains the item's ID or ID of any child of it
    Parameters:
      `ids` - the IDs
    Returns: