Package jadex.commons.gui.jtreetable
Class DefaultTreeTableNode
- java.lang.Object
-
- javax.swing.tree.DefaultMutableTreeNode
-
- jadex.commons.gui.jtreetable.DefaultTreeTableNode
-
- All Implemented Interfaces:
TreeTableNode
,java.io.Serializable
,java.lang.Cloneable
,javax.swing.tree.MutableTreeNode
,javax.swing.tree.TreeNode
- Direct Known Subclasses:
SetTreeTableNode
public class DefaultTreeTableNode extends javax.swing.tree.DefaultMutableTreeNode implements TreeTableNode
Default implementation for tree table nodes. Based on swings mutable tree node implementation.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DefaultTreeTableModel
model
The model, used to generate events.protected TreeTableNodeType
type
The node type identifier.protected java.util.Map
values
The values.
-
Constructor Summary
Constructors Constructor Description DefaultTreeTableNode(TreeTableNodeType type, java.lang.Object object)
Create a tree table node with single initial value.DefaultTreeTableNode(TreeTableNodeType type, java.lang.Object object, java.util.Map values)
Create a tree table node with initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultTreeTableNode
getChild(java.lang.Object obj)
Get a child for the specified user object.TreeTableNode[]
getChildren()
Get all children of the node.protected DefaultTreeTableModel
getModel()
Get the model.TreeTableNodeType
getType()
Get the node type.java.lang.Object
getValue(int column)
Get the value at a specific column.java.util.Map
getValues()
Get all values at once.void
insert(javax.swing.tree.MutableTreeNode child, int index)
Addschild
to the receiver atindex
.boolean
instanceOf(TreeTableNodeType type)
Check if this node is an instance of the given treetable node type.void
remove(int index)
Removes the child atindex
from the receiver.protected void
setModel(DefaultTreeTableModel model)
Set the model.void
setValue(int column, java.lang.Object value)
Set the value at a specific column.void
setValues(java.util.Map values)
Set all values at once.java.lang.String
toString()
Get a string representation of this node.-
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
-
-
-
-
Field Detail
-
type
protected TreeTableNodeType type
The node type identifier.
-
values
protected java.util.Map values
The values.
-
model
protected DefaultTreeTableModel model
The model, used to generate events.
-
-
Constructor Detail
-
DefaultTreeTableNode
public DefaultTreeTableNode(TreeTableNodeType type, java.lang.Object object)
Create a tree table node with single initial value.- Parameters:
type
- The node type identifier.object
- The object represented by this node.
-
DefaultTreeTableNode
public DefaultTreeTableNode(TreeTableNodeType type, java.lang.Object object, java.util.Map values)
Create a tree table node with initial values.- Parameters:
type
- The node type identifier.object
- The object represented by this node.values
- The initial display values.
-
-
Method Detail
-
getType
public TreeTableNodeType getType()
Get the node type.- Returns:
- The node type identifier.
-
instanceOf
public boolean instanceOf(TreeTableNodeType type)
Check if this node is an instance of the given treetable node type.- Parameters:
type
- The treetabel node type.
-
getValue
public java.lang.Object getValue(int column)
Get the value at a specific column.- Specified by:
getValue
in interfaceTreeTableNode
- Parameters:
column
- The column.- Returns:
- The value or empty string, when column index is too large.
-
getValues
public java.util.Map getValues()
Get all values at once.- Returns:
- The values.
-
setValue
public void setValue(int column, java.lang.Object value)
Set the value at a specific column.- Parameters:
column
- The column.value
- The new value.
-
setValues
public void setValues(java.util.Map values)
Set all values at once.- Parameters:
values
- The new values.
-
insert
public void insert(javax.swing.tree.MutableTreeNode child, int index)
Addschild
to the receiver atindex
.child
will be messaged withsetParent
. Overridden to generate tree event.- Specified by:
insert
in interfacejavax.swing.tree.MutableTreeNode
- Overrides:
insert
in classjavax.swing.tree.DefaultMutableTreeNode
-
remove
public void remove(int index)
Removes the child atindex
from the receiver. Overridden to generate tree event.- Specified by:
remove
in interfacejavax.swing.tree.MutableTreeNode
- Overrides:
remove
in classjavax.swing.tree.DefaultMutableTreeNode
-
getChild
public DefaultTreeTableNode getChild(java.lang.Object obj)
Get a child for the specified user object.- Parameters:
obj
- The user object.- Returns:
- A child node with a user object equal to the the specified object (if any).
-
getChildren
public TreeTableNode[] getChildren()
Get all children of the node.
-
setModel
protected void setModel(DefaultTreeTableModel model)
Set the model.- Parameters:
model
- The model.
-
getModel
protected DefaultTreeTableModel getModel()
Get the model.
-
toString
public java.lang.String toString()
Get a string representation of this node.- Overrides:
toString
in classjavax.swing.tree.DefaultMutableTreeNode
-
-