Package cz.vutbr.fit.layout.model
Interface GenericTreeNode<T extends GenericTreeNode<T>>
-
- All Known Subinterfaces:
Area,Box,LogicalArea
- All Known Implementing Classes:
DefaultArea,DefaultBox,DefaultLogicalArea,DefaultTreeContentRect,DefaultTreeNode
public interface GenericTreeNode<T extends GenericTreeNode<T>>A generic tree node interface.- Author:
- burgetr
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddUserAttribute(String name, Object value)Sets a user-defined attribute for the tree node.voidappendChild(T child)voidappendChildren(List<T> children)intgetDepth()TgetChildAt(int index)intgetChildCount()List<T>getChildren()intgetIndex(T child)intgetLeafCount()TgetNextSibling()TgetParent()TgetPreviousSibling()TgetRoot()<P> PgetUserAttribute(String name, Class<P> clazz)Obtains the user-defined attribute value assigned to the node.voidchildrenChanged()Signals that some children have been added or removed or their state changed.voidinsertChild(T child, int index)booleanisLeaf()booleanisRoot()voidremoveAllChildren()voidremoveChild(int index)voidremoveChild(T child)voidsetParent(T parent)voidsetRoot(T root)
-
-
-
Method Detail
-
getParent
T getParent()
-
setParent
void setParent(T parent)
-
getRoot
T getRoot()
-
setRoot
void setRoot(T root)
-
isRoot
boolean isRoot()
-
getChildCount
int getChildCount()
-
isLeaf
boolean isLeaf()
-
appendChild
void appendChild(T child)
-
insertChild
void insertChild(T child, int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
removeAllChildren
void removeAllChildren()
-
removeChild
void removeChild(int index) throws IndexOutOfBoundsException- Throws:
IndexOutOfBoundsException
-
removeChild
void removeChild(T child) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
getChildAt
T getChildAt(int index) throws IndexOutOfBoundsException
- Throws:
IndexOutOfBoundsException
-
getIndex
int getIndex(T child)
-
getPreviousSibling
T getPreviousSibling()
-
getNextSibling
T getNextSibling()
-
getDepth
int getDepth()
-
getLeafCount
int getLeafCount()
-
childrenChanged
void childrenChanged()
Signals that some children have been added or removed or their state changed.
-
addUserAttribute
void addUserAttribute(String name, Object value)
Sets a user-defined attribute for the tree node. This allows to assign multiple attributes identified by their names.- Parameters:
name- the attribute namevalue- the attribute value
-
getUserAttribute
<P> P getUserAttribute(String name, Class<P> clazz)
Obtains the user-defined attribute value assigned to the node.- Parameters:
name- the attribute nameclazz- the class of the required attribute- Returns:
- an object of the given class representing the value of the attribute (application-specific)
or
nullwhen no such attribute is present.
-
-