Class tea.set.MultiList
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class tea.set.MultiList

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----tea.set.MultiList

public class MultiList
extends Panel
MultiList widget is a more sophisticated version of List widget. Each item of the MultiList widget is a row, which is a list of fields. A title row can be added to the MultiList widget. The operations supported by the MultiList widget is very similar to the List widget. Users can select a row or scroll through the list. A single click on a row selects the row and generates a LIST_SELECT event. A double click on a row selects the row and generates an ACTION_EVENT in addition to the LIST_SELECT event. The display of the scrollbar is automatic. It is shown only when necessary. An optional image can be attached to a row. If an image exists, it will be displayed at the lefthand side of the row.

Known Bug: AWT Scrollbar is highly buggy. It exhibits different behaviors in different environment (JDK, Netscape, ...) and different versions (1.01, 1.02, ...). To make sure all area are always shown, the scrollbar value may appear to to too large, which will cause excessive scrolling at the end.


Constructor Index

 o MultiList(int, int)
Construct a MultiList widget with ncol fields and each with w character wide.
 o MultiList(int, int, int)
Construct a MultiList widget with nrow rows, ncol fields, and each fields with width of w characters.
 o MultiList(int, int[])
Construct a MultiList widget with nrow rows, and the same number of fields as the w[] length.
 o MultiList(int[])
Construct a MultiList widget with the same number of fields as the length of w[].

Method Index

 o addRow(String, String)
Add a row to the list.
 o addRow(String, String, Image)
Add a row to the list.
 o addRow(String[])
Add a row to the list.
 o addRow(String[], Image)
Add a row to the list.
 o addRow(Vector)
Add a row to the list.
 o addRow(Vector, Image)
Add a row to the list.
 o clearRows()
Remove all rows from the list.
 o clearTitle()
Remove the title row.
 o countRows()
Return the total number of rows in the list.
 o getRow(int)
Return the row value at the specified index.
 o getSelectedRow()
Return the row number of the selected row.
 o handleEvent(Event)
A single click on a data row generates a LIST_SELECT event.
 o makeVisible(int)
Make the specified row visible.
 o removeRow(int)
Remove the specified row.
 o select(int)
Select the specified row.
 o setRow(String, String, Image, int)
Set the specified row to the row supplied.
 o setRow(String, String, int)
Set the specified row to the row supplied.
 o setRow(String[], Image, int)
Set the specified row to the row supplied.
 o setRow(String[], int)
Set the specified row to the row supplied.
 o setRow(Vector, Image, int)
Set the specified row to the row supplied.
 o setRow(Vector, int)
Set the specified row to the row supplied.
 o setTitle(String, String)
Add a title row to the list.
 o setTitle(String[])
Add a title row to the list.
 o setTitle(Vector)
Add a title row to the list.

Constructors

 o MultiList
  public MultiList(int ncol,
                   int w)
Construct a MultiList widget with ncol fields and each with w character wide. The width of the field is only used as a preferred value, and may change depending on the screen size.
Parameters:
ncol - number of columns.
width - of column in characters.
 o MultiList
  public MultiList(int w[])
Construct a MultiList widget with the same number of fields as the length of w[]. The width for each field is taken from w[]. The width values are used to calculate the preferred size, but may change with screen size. If the preferred width can't be met, the width in the w[] will be used to distribute space proportional to the values specified for each field.
Parameters:
width - array of columns.
 o MultiList
  public MultiList(int nrow,
                   int ncol,
                   int w)
Construct a MultiList widget with nrow rows, ncol fields, and each fields with width of w characters. All values specified are advisory and may change depending on the assigned size for this widget.
Parameters:
nrow - number of visible rows.
ncol - number of columns.
width - of column in characters.
 o MultiList
  public MultiList(int nrow,
                   int w[])
Construct a MultiList widget with nrow rows, and the same number of fields as the w[] length. The width for each field is specified in w[] array.
Parameters:
nrow - number of visible rows.
w - column width array.

Methods

 o addRow
  public void addRow(Vector row)
Add a row to the list. Row is a vector of Strings. If the number of strings in the vector is less than the number of field of this list, the vector will be padded with empty strings.
Parameters:
row - a vector with each item corresponds to a column in the row.
 o addRow
  public void addRow(String row[])
Add a row to the list. Row is an array of Strings. If the number of strings in the array is less than the number of field of this list, the array will be padded with empty strings.
Parameters:
row - an array with each item corresponds to a column in the row.
 o addRow
  public void addRow(String str,
                     String delim)
Add a row to the list. The fields will be parsed from the string with delim as the delimiter. If the number of fields in the string is less than the number of fields of this list, the remaining fields will be set to empty strings.
Parameters:
str - column list in delimited form.
delim - delimiter.
 o addRow
  public void addRow(Vector row,
                     Image img)
Add a row to the list. Row is a vector of Strings. If the number of strings in the vector is less than the number of field of this list, the vector will be padded with empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
row - a vector with each item corresponds to a column in the row.
img - image icon for the row.
 o addRow
  public void addRow(String row[],
                     Image img)
Add a row to the list. Row is an array of Strings. If the number of strings in the array is less than the number of field of this list, the array will be padded with empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
row - an array with each item corresponds to a column in the row.
img - image icon for the row.
 o addRow
  public void addRow(String str,
                     String delim,
                     Image img)
Add a row to the list. The fields will be parsed from the string with delim as the delimiter. If the number of fields in the string is less than the number of fields of this list, the remaining fields will be set to empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
str - column list in delimited form.
delim - delimiter.
img - image icon for the row.
 o setRow
  public void setRow(Vector row,
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. Row is a vector of Strings. If the number of strings in the vector is less than the number of field of this list, the vector will be padded with empty strings.
Parameters:
row - a vector with each item corresponds to a column in the row.
pos - row number.
 o setRow
  public void setRow(String row[],
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. Row is an array of Strings. If the number of strings in the array is less than the number of field of this list, the array will be padded with empty strings.
Parameters:
row - an array with each item corresponds to a column in the row.
pos - row number.
 o setRow
  public void setRow(String str,
                     String delim,
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. The fields will be parsed from the string with delim as the delimiter. If the number of fields in the string is less than the number of fields of this list, the remaining fields will be set to empty strings.
Parameters:
str - column list in delimited form.
delim - delimiter.
pos - row number.
 o setRow
  public void setRow(Vector row,
                     Image img,
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. Row is a vector of Strings. If the number of strings in the vector is less than the number of field of this list, the vector will be padded with empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
row - a vector with each item corresponds to a column in the row.
img - image icon for the row.
pos - row number.
 o setRow
  public void setRow(String row[],
                     Image img,
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. Row is an array of Strings. If the number of strings in the array is less than the number of field of this list, the array will be padded with empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
row - an array with each item corresponds to a column in the row.
img - image icon for the row.
pos - row number.
 o setRow
  public void setRow(String str,
                     String delim,
                     Image img,
                     int pos)
Set the specified row to the row supplied. If the position is out of range, this call is ignored. The fields will be parsed from the string with delim as the delimiter. If the number of fields in the string is less than the number of fields of this list, the remaining fields will be set to empty strings. An image can be supplied to be displayed at the left side of the row.
Parameters:
str - column list in delimited form.
delim - delimiter.
img - image icon for the row.
pos - row number.
 o clearTitle
  public void clearTitle()
Remove the title row.
 o removeRow
  public void removeRow(int pos)
Remove the specified row.
Parameters:
pos - row number.
 o clearRows
  public void clearRows()
Remove all rows from the list. This function will reset all parameters to the initial state.
 o setTitle
  public void setTitle(Vector row)
Add a title row to the list. Parameter is same as addRow().
Parameters:
row - a vector with each item corresponds to a column in the row.
 o setTitle
  public void setTitle(String row[])
Add a title row to the list. Parameter is same as addRow().
Parameters:
row - an array with each item corresponds to a column in the row.
 o setTitle
  public void setTitle(String str,
                       String delim)
Add a title row to the list. Parameter is same as addRow().
Parameters:
str - column list in delimited form.
delim - delimiter.
 o getSelectedRow
  public int getSelectedRow()
Return the row number of the selected row.
Parameters:
return - row number of the selected row.
 o select
  public void select(int row)
Select the specified row.
Parameters:
row - row number.
 o countRows
  public int countRows()
Return the total number of rows in the list.
Returns:
number of rows.
 o getRow
  public String[] getRow(int idx)
Return the row value at the specified index.
Parameters:
idx - row number.
Returns:
a row which is an array of columns.
 o makeVisible
  public void makeVisible(int row)
Make the specified row visible.
Parameters:
row - row number.
 o handleEvent
  public boolean handleEvent(Event e)
A single click on a data row generates a LIST_SELECT event. A double click on a data row generates an ACTION_EVENT. The arg is set to this MultiList for both events.
Parameters:
e - event object.
Overrides:
handleEvent in class Component

All Packages  Class Hierarchy  This Package  Previous  Next  Index