All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.trumphurst.controls.TRowDocument

java.lang.Object
   |
   +----com.trumphurst.controls.TDocument
           |
           +----com.trumphurst.controls.TRowDocument

public class TRowDocument
extends TDocument
implements ItemSelectable
A document which contains a list of objects, each representing a row, such as would be displayed in a scrolling list. Allows one object in the list to be "selected".

See Also:
TMultiColumnList, TTreeListDocument

Variable Index

 o actionListener
Event Multicaster
 o itemListener
Event Multicaster
 o list
The list of objects.

Constructor Index

 o TRowDocument(String)

Method Index

 o action(int)
The given row has been actioned (double-clicked or <cr> has been pressed).
 o addActionListener(ActionListener)
Add a Listener for when selected item is double-clicked.
 o addElement(Object)
Add an object to the list at the end.
 o addElement(Object, int)
Add an object to the list at the specified row.
 o addItemListener(ItemListener)
ItemSelectable - add a Listener for when selected item changes.
 o clear()
Remove all items from the list.
 o delElement(int)
Remove one object from the list.
 o delElements(int, int)
Remove multiple objects from the list.
 o elementAt(int)
Returns the object at a given row.
 o getSelectedIndex()
Find which row is selected.
 o getSelectedObject()
Find which object is selected.
 o getSelectedObjects()
ItemSelectable - return selected Objects (there is only one).
 o indexOf(Object)
Returns the row of a given object, or -1 if not found.
 o removeActionListener(ActionListener)
Remove a Listener.
 o removeItemListener(ItemListener)
ItemSelectable - remove a Listener.
 o select(int)
Select the given row.
 o size()
Returns the number of rows in the list.

Variables

 o itemListener
 protected ItemListener itemListener
Event Multicaster

 o actionListener
 protected ActionListener actionListener
Event Multicaster

 o list
 protected Vector list
The list of objects.

Constructors

 o TRowDocument
 public TRowDocument(String name)

Methods

 o size
 public int size()
Returns the number of rows in the list.

 o addElement
 public synchronized void addElement(Object item,
                                     int index)
Add an object to the list at the specified row.

Parameters:
item - The object to add.
index - Where to add the object (-1 = at end).
 o addElement
 public void addElement(Object item)
Add an object to the list at the end.

Parameters:
item - The object to add.
 o elementAt
 public synchronized Object elementAt(int index)
Returns the object at a given row.

Parameters:
index - The row to get.
Returns:
The object at that row, or null if index out of range
 o indexOf
 public synchronized int indexOf(Object o)
Returns the row of a given object, or -1 if not found.

Parameters:
o - The object to find.
Returns:
The row number, or -1 if object not in document
 o delElement
 public void delElement(int index)
Remove one object from the list.

Parameters:
index - The row number to remove.
 o delElements
 public synchronized void delElements(int start,
                                      int end)
Remove multiple objects from the list.

Parameters:
start - The first row to remove.
end - Tthe last row to remove.
 o clear
 public void clear()
Remove all items from the list.

 o getSelectedIndex
 public int getSelectedIndex()
Find which row is selected.

Returns:
The selected row, or -1 if none selected.
 o getSelectedObject
 public Object getSelectedObject()
Find which object is selected.

Returns:
The object at the selected row, or null if none selected.
 o select
 public synchronized void select(int row)
Select the given row.

Parameters:
row - The row to select. Must be in range, or -1 to deselect.
 o action
 public void action(int row)
The given row has been actioned (double-clicked or <cr> has been pressed). Normally overridden in subclasses.

Parameters:
row - The row actioned.
 o getSelectedObjects
 public Object[] getSelectedObjects()
ItemSelectable - return selected Objects (there is only one).

 o addItemListener
 public void addItemListener(ItemListener l)
ItemSelectable - add a Listener for when selected item changes.

 o removeItemListener
 public void removeItemListener(ItemListener l)
ItemSelectable - remove a Listener.

 o addActionListener
 public void addActionListener(ActionListener l)
Add a Listener for when selected item is double-clicked.

 o removeActionListener
 public void removeActionListener(ActionListener l)
Remove a Listener.


All Packages  Class Hierarchy  This Package  Previous  Next  Index