Class GTreeTableNode

java.lang.Object
docking.widgets.gtreetable.GTreeTableNode
All Implemented Interfaces:
Serializable

public class GTreeTableNode extends Object implements Serializable
See Also:
  • Field Details

    • name

      protected final String name
    • icon

      protected Icon icon
    • expanded

      protected boolean expanded
    • parent

      protected GTreeTableNode parent
    • children

      protected List<GTreeTableNode> children
    • visible

      protected boolean visible
  • Constructor Details

    • GTreeTableNode

      public GTreeTableNode(String name)
  • Method Details

    • add

      public void add(GTreeTableNode newChild)
      Add new child to this node's children
      Parameters:
      newChild - New child to add
    • ancestors

      public Iterable<GTreeTableNode> ancestors()
      Get an iterable of all the ancestors of this node
      Returns:
      An iterable of ancestors
    • depthFirstSearchList

      public List<GTreeTableNode> depthFirstSearchList()
      Get a list of all descendants of this node in depth first search order
      Returns:
      List of descendants in DFS order
    • descendants

      public Iterable<GTreeTableNode> descendants()
      Get an iterable of all the descendants of this node
      Returns:
      An iterable of descendants
    • descendantsDFS

      public Iterable<GTreeTableNode> descendantsDFS()
      Get an iterable of all the descendants of this node in DFS order
      Returns:
      An iterable of descendants
    • expandedDescendants

      public Iterable<GTreeTableNode> expandedDescendants()
      Get an iterable of all the expanded descendants of this node
      Returns:
      An iterable of expanded descendants
    • find

      public List<GTreeTableNode> find(Predicate<GTreeTableNode> condition)
      Find nodes in descendants that match a certain condition
      Parameters:
      condition - Predicate to match nodes on
      Returns:
      List of nodes matching the condition
    • forEachAncestor

      public void forEachAncestor(Consumer<GTreeTableNode> action)
      Perform an action on each ancestor of this node
      Parameters:
      action - To perform on each ancestor
    • forEachDescendant

      public void forEachDescendant(Consumer<GTreeTableNode> action)
      Perform an action on each descendant of this node
      Parameters:
      action - To perform on each descendant
    • forEachDescendantDFS

      public void forEachDescendantDFS(Consumer<GTreeTableNode> action)
      Perform an action on each descendant of this node in DFS order
      Parameters:
      action - To perform on each descendant
    • forEachExpanded

      public void forEachExpanded(Consumer<GTreeTableNode> action)
      Perform an action on each expanded descendant of this node
      Parameters:
      action - To perform on each expanded descendant
    • getChildCount

      public int getChildCount()
      Get number of children
      Returns:
      Number of children
    • getChildren

      public List<GTreeTableNode> getChildren()
      Get list of children
      Returns:
      List of children
    • getExpanded

      public List<GTreeTableNode> getExpanded()
      Get list of descendants who are expanded
      Returns:
      List of expanded descendants
    • getIcon

      public Icon getIcon()
      Get icon
      Returns:
      icon
    • getLevel

      public int getLevel()
      Get tree depth from the root node
      Returns:
      Level from root node
    • getName

      public String getName()
      Get name of node
      Returns:
      name
    • getParent

      public GTreeTableNode getParent()
      Get parent of node
      Returns:
      parent
    • getPath

      public List<GTreeTableNode> getPath()
      Get list of ancestors in order leading to this node
      Returns:
      List of nodes leading to this one
    • getRoot

      public GTreeTableNode getRoot()
      Get root node
      Returns:
      root node
    • getTreeData

      public String getTreeData()
      Get data associated with this node
      Returns:
      data
    • hasChildren

      public boolean hasChildren()
      Check if node has children
      Returns:
      true/false if node has children
    • hasNodeInItsAncestry

      public boolean hasNodeInItsAncestry(GTreeTableNode anotherNode)
      Check if another node is in this node's ancestry, the current node will return true as being in its own ancestry
      Parameters:
      anotherNode - Node to check for in the current nodes ancestry
      Returns:
      true/false if other node is in the ancestry
    • hasVisibleChildren

      public boolean hasVisibleChildren()
      Check if this node has any visible children
      Returns:
      true/false if any children are visible
    • insert

      public void insert(GTreeTableNode newChild, int childIndex)
      Insert a new node into the children of this node
      Parameters:
      newChild - New child to insert
      childIndex - Index to insert child at
    • isExpanded

      public boolean isExpanded()
      Check if node is expanded
      Returns:
      true/false if expanded
    • isLeaf

      public boolean isLeaf()
      Check if node is leaf node
      Returns:
      true/false if leaf
    • isRoot

      public boolean isRoot()
      Check if node is root node (i.e. it has no parent)
      Returns:
      true/false if root
    • isVisible

      public boolean isVisible()
      Returns:
    • remove

      public void remove(GTreeTableNode aChild)
      Remove child from list of children
      Parameters:
      aChild - Child to remove
    • remove

      public void remove(int childIndex)
      Remove child from list of children
      Parameters:
      childIndex - Index of child to remove
    • setExpanded

      public void setExpanded(boolean expanded)
      Change node expanded state
      Parameters:
      expanded - Expanded state
    • setParent

      public void setParent(GTreeTableNode newParent)
      Set parent of node
      Parameters:
      newParent - Parent to set
    • setVisible

      public void setVisible(boolean visible)
      Change node visibility state
      Parameters:
      visible - Node visibility
    • toString

      public String toString()
      Overrides:
      toString in class Object