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 DefaultTreeTableModelmodelThe model, used to generate events.protected TreeTableNodeTypetypeThe node type identifier.protected java.util.MapvaluesThe 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 DefaultTreeTableNodegetChild(java.lang.Object obj)Get a child for the specified user object.TreeTableNode[]getChildren()Get all children of the node.protected DefaultTreeTableModelgetModel()Get the model.TreeTableNodeTypegetType()Get the node type.java.lang.ObjectgetValue(int column)Get the value at a specific column.java.util.MapgetValues()Get all values at once.voidinsert(javax.swing.tree.MutableTreeNode child, int index)Addschildto the receiver atindex.booleaninstanceOf(TreeTableNodeType type)Check if this node is an instance of the given treetable node type.voidremove(int index)Removes the child atindexfrom the receiver.protected voidsetModel(DefaultTreeTableModel model)Set the model.voidsetValue(int column, java.lang.Object value)Set the value at a specific column.voidsetValues(java.util.Map values)Set all values at once.java.lang.StringtoString()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:
getValuein 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)Addschildto the receiver atindex.childwill be messaged withsetParent. Overridden to generate tree event.- Specified by:
insertin interfacejavax.swing.tree.MutableTreeNode- Overrides:
insertin classjavax.swing.tree.DefaultMutableTreeNode
-
remove
public void remove(int index)
Removes the child atindexfrom the receiver. Overridden to generate tree event.- Specified by:
removein interfacejavax.swing.tree.MutableTreeNode- Overrides:
removein 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:
toStringin classjavax.swing.tree.DefaultMutableTreeNode
-
-