MutableTreeTableModel

Top  Previous  Next

 

MutableTreeTableModel provides for a TreeTableModel whose nodes can be added or removed dynamically anywhere in the tree.

In order to add a node, use the following method:

 

public void insertNodeInto(MutableTreeNode newChild, MutableTreeNode parent, int index);

 

and to remove a node:

 

public void removeNodeFromParent(MutableTreeNode node);

 

You should define the columns and their corresponding column values class upon construction time. This class assumes that javax.swing.tree.TreeNode objects will be used as the tree's nodes.

 

MutableTreeTableModel is an abstract class. Its subclasses should only implement the method:

 

public java.lang.Object getValueAt(java.lang.Object node, int column);

 

Next, we discuss ComparableTreeTableModel, whose tree structure is formed according to a set of rules dictated by TreeTableComparators.