All Packages Class Hierarchy This Package Previous Next Index
Class com.trumphurst.controls.TTreeListDocument
java.lang.Object
|
+----com.trumphurst.controls.TDocument
|
+----com.trumphurst.controls.TRowDocument
|
+----com.trumphurst.controls.TTreeListDocument
- public class TTreeListDocument
- extends TRowDocument
- implements KeyListener
A TRowDocument which contains a list of Tree structures.
Note that this is a list of tree structures, not a single
tree with one root. It was developed to show message threads in
a Usenet News reader.
When an item is double-clicked, the item will be expanded to show
its children (or contracted, if it is already expanded).
Perhaps, in a pure Document/View architecture, the expand/
contract functionality would be entirely contained in the view.
However, this way of doing things works fine, and enables lists of
trees to be displayed by the MultiColumnList without a single change
to the code.
- See Also:
- Tree, TMultiColumnList
-
TTreeListDocument(String)
-
-
action(int)
- The given row has been actioned (double-clicked).
-
addElement(Object, int)
- Add an object to the list at the specified row.
-
contract(int)
- Contract the given row.
-
expand(int, boolean)
- Expand the given row.
-
keyPressed(KeyEvent)
- Handle standard list keyboard stuff.
-
keyReleased(KeyEvent)
-
-
keyTyped(KeyEvent)
-
-
parentIndex(int)
-
-
rootIndex(int)
-
TTreeListDocument
public TTreeListDocument(String name)
addElement
public void addElement(Object item,
int index)
- Add an object to the list at the specified row.
Overrides the base class, in order to check the item
being added is a Tree.
- Throws: ClassCastException
- If the item being added is not an instance of Tree.
- Overrides:
- addElement in class TRowDocument
expand
public synchronized int expand(int row,
boolean children)
- Expand the given row.
- Parameters:
- row - The row to expand.
- children - True if the children are also to be expanded recursively.
- Returns:
- The row number of tha last row added to the list.
contract
public synchronized void contract(int row)
- Contract the given row.
- Parameters:
- row - The row to contract.
action
public void action(int row)
- The given row has been actioned (double-clicked).
Expands or contracts the row as necessary.
- Parameters:
- row - The row actioned.
- Overrides:
- action in class TRowDocument
keyPressed
public void keyPressed(KeyEvent e)
- Handle standard list keyboard stuff.
keyReleased
public void keyReleased(KeyEvent e)
keyTyped
public void keyTyped(KeyEvent e)
parentIndex
public synchronized int parentIndex(int row)
rootIndex
public synchronized int rootIndex(int row)
All Packages Class Hierarchy This Package Previous Next Index