All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jclass.bwt.JCMultiColumnList

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----jclass.bwt.JCContainer
                                   |
                                   +----jclass.bwt.JCScrolledWindow
                                           |
                                           +----jclass.bwt.JCMultiColumnWindow
                                                   |
                                                   +----jclass.bwt.JCMultiColumnList

public class JCMultiColumnList
extends JCMultiColumnWindow
implements JCListInterface
A JCScrolledWindow which contains a JCMultiColumnListComponent.

Behavior
The column labels may be created as labels or buttons. Clicking on a column's button will cause the column to be sorted.

see JCList

Properties

UserDataList
Name Method
AllowMultipleSelections setAllowMultipleSelections
AutoSelect setAutoSelect
Background setBackground
Batched setBatched
ColumnAlignments setColumnAlignments
ColumnLabels setColumnLabels
ColumnLabelSort setColumnLabelSort
ColumnLabelSortMethod setColumnLabelSortMethod
ColumnLeftMargin setColumnLeftMargin
ColumnRightMargin setColumnRightMargin
ColumnWidths setColumnWidths
Font setFont
Foreground setForeground
Insets setInsets
Items setItems
NumColumns setNumColumns
PreferredSize setPreferredSize
RowHeight setRowHeight
ScrollbarDisplay setScrollbarDisplay
ScrollbarOffset setScrollbarOffset
SelectedBackground setSelectedBackground
SelectedForeground setSelectedForeground
Spacing setSpacing
UserData setUserData
setUserDataList
VisibleRows setVisibleRows

Events

Class Listener Description
JCActionEvent addActionListener Posted when an item is double-clicked, or the ENTER key is hit
JCListEvent addItemListener Posted when an item is clicked or the space key is hit


Constructor Index

 o JCMultiColumnList()
Creates an empty list.
 o JCMultiColumnList(int, boolean)
Creates an empty list with the specified number of visible lines.
 o JCMultiColumnList(JCVector)
Creates a list with the specified items.
 o JCMultiColumnList(JCVector, Applet, String)
Creates a list which reads parameters from the applet's HTML file.

Method Index

 o addActionListener(JCActionListener)
Adds the specified action listener to receive action events from this list.
 o addItem(Applet, String, char)
Parses a string and adds the specified item to the end of the list.
 o addItem(Object)
Adds the specified item to the end of the list.
 o addItem(Object, int)
Adds or inserts an item to the list.
 o addItem(String, char)
Parses a string and adds the specified item to the end of the list.
 o addItemListener(JCItemListener)
Adds the specified item listener to receive item events from this list.
 o allowsMultipleSelections()
Returns true if this list allows multiple selections.
 o clear()
Clears the list.
 o countItems()
Returns the number of items in the list.
 o deleteItem(int)
Deletes an item from the list.
 o deleteItems(int, int)
Delete multiple items from the list.
 o deselect(int)
Deselects the item at the specified row.
 o getAllowMultipleSelections()
Returns true if this list allows multiple selections.
 o getAutoSelect()
Gets the AutoSelect value.
 o getBatched()
Gets the Batched value.
 o getItem(int)
Gets the item associated with the specified index.
 o getItems()
Gets the list's values.
 o getItemsStrings()
Gets the list's values as a list of Strings.
 o getList()
Gets the internal list.
 o getRowHeight()
Gets the height of each row (pixels).
 o getRows()
Returns the number of visible lines in this list.
 o getSelectedBackground()
Gets the list's SelectedBackground value.
 o getSelectedForeground()
Gets the list's SelectedForeground value.
 o getSelectedIndex()
Gets the selected item on the list or BWTEnum.NOTFOUND if no item is selected.
 o getSelectedIndexes()
Returns the selected indexes on the list.
 o getSelectedItem()
Returns the selected item on the list or null if no item is selected.
 o getSelectedObjects()
Returns the selected items on the list as Strings.
 o getSpacing()
Gets the spacing between items.
 o getTopRow()
Gets the current top-most visible row.
 o getUserDataList()
Gets the UserDataList value.
 o getViewportHeight()
Sets the work area height to be the list's total height.
 o getVisibleIndex()
Gets the row of the item that was last made visible by the method makeVisible.
 o isSelected(int)
Returns true if the item at the specified row has been selected; false otherwise.
 o makeVisible(int)
Forces the item at the specified row to be visible.
 o paintRow(int)
Draws a row.
 o preferredWidth()
Gets the subclass' preferred width (default: 100).
 o removeActionListener(JCActionListener)
Removes the specified action listener so it no longer receives action events from this list.
 o removeItemListener(JCItemListener)
Removes the specified item listener so it no longer receives item events from this list.
 o replaceItem(Object, int)
Replaces the item at the given row.
 o select(int)
Selects the item at the specified row.
 o setAllowMultipleSelections(boolean)
Sets whether the list allows multiple selections.

HTML param name/value: "AllowMultipleSelections"/boolean

 o setAutoSelect(boolean)
If true, the item which currently has focus is also selected (default: false).

HTML param name/value: "AutoSelect"/boolean

 o setBatched(boolean)
If false (default), the component is repainted every time an item is changed.
 o setItems(JCVector)
Sets the list's values as a Vector of objects.

HTML param name/value: "Items"/string list

 o setItems(String[])
Sets the list's values as a list of Strings.
 o setItemsStrings(String[])
Sets the list's values as a list of Strings.
 o setList(JCMultiColumnListComponent)
Replaces the current internal list.
 o setRowHeight(int)
Sets the height of each row (pixels).

HTML param name/value: "RowHeight"/an int, "VARIABLE", or "FONT_HEIGHT"

 o setSelectedBackground(Color)
Sets the background color of selected rows (default: foreground color).

HTML param name/value: "SelectedBackground"/color

 o setSelectedForeground(Color)
Sets the foreground color of selected rows (default: background color).

HTML param name/value: "SelectedForeground"/color

 o setSpacing(int)
Sets the spacing between items (default: 0).
 o setTopRow(int)
Sets the top-most visible row.
 o setUserDataList(Object[])
Sets an application-defined list of objects that are maintained for each item.
 o setVisibleRows(int)
Sets the number of visible rows.
 o sortByColumn(int, JCSortInterface)
Sorts the rows in the list in ascending order based on a specified column, using the String equivalents of each value.
 o sortByColumn(int, JCSortInterface, int)
Sorts the rows in the list based on a specified column, using the String equivalents of each value.

Constructors

 o JCMultiColumnList
 public JCMultiColumnList()
Creates an empty list. No parameters are read from an HTML file.

 o JCMultiColumnList
 public JCMultiColumnList(JCVector items)
Creates a list with the specified items. No parameters are read from an HTML file.

See Also:
setItems
 o JCMultiColumnList
 public JCMultiColumnList(JCVector items,
                          Applet applet,
                          String name)
Creates a list which reads parameters from the applet's HTML file.

Parameters:
items - the initial items. Each element may be a String, JCString, or any object (in which case the object's toString() method is called to obtain a string)
applet - the applet whose PARAM tags are to be read
name - if this is not null, only parameters preceded by this name are read
See Also:
setItems, getParameter, JCString
 o JCMultiColumnList
 public JCMultiColumnList(int rows,
                          boolean multipleSelections)
Creates an empty list with the specified number of visible lines.

Parameters:
rows - the number of items to show.
multipleSelections - if true then multiple selections are allowed

Methods

 o getList
 public JCMultiColumnListComponent getList()
Gets the internal list.

 o setList
 public void setList(JCMultiColumnListComponent list)
Replaces the current internal list.

 o preferredWidth
 protected int preferredWidth()
Gets the subclass' preferred width (default: 100).

Overrides:
preferredWidth in class JCScrolledWindow
 o getViewportHeight
 protected int getViewportHeight()
Sets the work area height to be the list's total height.

Overrides:
getViewportHeight in class JCScrolledWindow
 o addItemListener
 public void addItemListener(JCItemListener l)
Adds the specified item listener to receive item events from this list. If the listener implements JCListListener (an JCItemListener subclass), it will be passed JCListEvents.

See Also:
JCItemEvent, JCListEvent, JCListListener
 o removeItemListener
 public void removeItemListener(JCItemListener l)
Removes the specified item listener so it no longer receives item events from this list.

 o addActionListener
 public void addActionListener(JCActionListener l)
Adds the specified action listener to receive action events from this list. Action events occur when a list item is double-clicked.

See Also:
JCActionEvent
 o removeActionListener
 public void removeActionListener(JCActionListener l)
Removes the specified action listener so it no longer receives action events from this list.

See Also:
addActionListener
 o getBatched
 public boolean getBatched()
Gets the Batched value.

See Also:
setBatched
 o setBatched
 public void setBatched(boolean v)
If false (default), the component is repainted every time an item is changed. If set to true, the component is only repainted (if necessary) when the value is again set to false.

 o getItems
 public JCVector getItems()
Gets the list's values.

See Also:
setItems
 o setItems
 public void setItems(JCVector items)
Sets the list's values as a Vector of objects.

HTML param name/value: "Items"/string list

Parameters:
items - each object may be a String, JCString, or any object (in which case the object's toString() method is called to obtain a string)
See Also:
JCString, toVector
 o setItems
 public void setItems(String items[])
Sets the list's values as a list of Strings.

 o getItemsStrings
 public synchronized String[] getItemsStrings()
Gets the list's values as a list of Strings.

See Also:
setItems
 o setItemsStrings
 public synchronized void setItemsStrings(String items[])
Sets the list's values as a list of Strings. The value for each column is separated by commas.

 o countItems
 public int countItems()
Returns the number of items in the list.

See Also:
getItem
 o getItem
 public Object getItem(int row)
Gets the item associated with the specified index.

Parameters:
row - the position of the item
See Also:
countItems
 o addItem
 public void addItem(Object item)
Adds the specified item to the end of the list.

Parameters:
item - the item to be added
 o addItem
 public void addItem(String item,
                     char delim)
Parses a string and adds the specified item to the end of the list.

Parameters:
item - the item to be added; a Vector is created using the tokens in the string
delim - delimiter separating each token in the string
 o addItem
 public void addItem(Applet applet,
                     String item,
                     char delim)
Parses a string and adds the specified item to the end of the list.

Parameters:
applet - the applet to be used for loading images contained in any JCStrings in the vector
item - the item to be added. A JCVector is created using the tokens in the string.
delim - delimiter separating each token in the string
See Also:
JCString
 o addItem
 public void addItem(Object item,
                     int row)
Adds or inserts an item to the list.

Parameters:
item - the item to be added This may be a String, JCString, or any object (in which case the object's toString() method is called to obtain a string)
row - the position at which to put the item; if row is -1, or greater than the number of items in the list, the item is added to the end
See Also:
JCString
 o replaceItem
 public void replaceItem(Object item,
                         int row)
Replaces the item at the given row.

Parameters:
item - the new value to replace the existing item
row - the position of the item to replace
 o clear
 public void clear()
Clears the list.

See Also:
deleteItem, deleteItems
 o deleteItem
 public void deleteItem(int row)
Deletes an item from the list.

 o deleteItems
 public void deleteItems(int start,
                         int end)
Delete multiple items from the list.

 o getSelectedIndex
 public int getSelectedIndex()
Gets the selected item on the list or BWTEnum.NOTFOUND if no item is selected.

See Also:
select, deselect, isSelected
 o getSelectedIndexes
 public int[] getSelectedIndexes()
Returns the selected indexes on the list.

See Also:
select, deselect, isSelected
 o getSelectedItem
 public Object getSelectedItem()
Returns the selected item on the list or null if no item is selected.

See Also:
select, deselect, isSelected
 o getSelectedObjects
 public Object[] getSelectedObjects()
Returns the selected items on the list as Strings.

See Also:
select, deselect, isSelected
 o select
 public void select(int row)
Selects the item at the specified row.

Parameters:
row - the position of the item to select
See Also:
getSelectedItem, deselect, isSelected
 o getAutoSelect
 public boolean getAutoSelect()
Gets the AutoSelect value.

See Also:
setAutoSelect
 o setAutoSelect
 public void setAutoSelect(boolean v)
If true, the item which currently has focus is also selected (default: false).

HTML param name/value: "AutoSelect"/boolean

See Also:
select
 o deselect
 public void deselect(int row)
Deselects the item at the specified row.

Parameters:
row - the position of the item to deselect
See Also:
select, getSelectedItem, isSelected
 o isSelected
 public boolean isSelected(int row)
Returns true if the item at the specified row has been selected; false otherwise.

Parameters:
row - the item to be checked
See Also:
select, deselect, isSelected
 o getSelectedBackground
 public Color getSelectedBackground()
Gets the list's SelectedBackground value.

See Also:
setSelectedBackground
 o setSelectedBackground
 public void setSelectedBackground(Color v)
Sets the background color of selected rows (default: foreground color).

HTML param name/value: "SelectedBackground"/color

See Also:
toColor
 o getSelectedForeground
 public Color getSelectedForeground()
Gets the list's SelectedForeground value.

See Also:
setSelectedForeground
 o setSelectedForeground
 public void setSelectedForeground(Color v)
Sets the foreground color of selected rows (default: background color).

HTML param name/value: "SelectedForeground"/color

See Also:
toColor
 o getRows
 public int getRows()
Returns the number of visible lines in this list.

 o setVisibleRows
 public void setVisibleRows(int v)
Sets the number of visible rows. If set to 0 (default), the list will attempt to resize itself so that all its items are visible.

HTML param name/value: "VisibleRows"/int

See Also:
setItems
 o getTopRow
 public int getTopRow()
Gets the current top-most visible row.

See Also:
setTopRow
 o setTopRow
 public void setTopRow(int row)
Sets the top-most visible row.

See Also:
makeVisible
 o allowsMultipleSelections
 public boolean allowsMultipleSelections()
Returns true if this list allows multiple selections.

See Also:
setAllowMultipleSelections
 o getAllowMultipleSelections
 public boolean getAllowMultipleSelections()
Returns true if this list allows multiple selections.

See Also:
setAllowMultipleSelections
 o setAllowMultipleSelections
 public void setAllowMultipleSelections(boolean v)
Sets whether the list allows multiple selections.

HTML param name/value: "AllowMultipleSelections"/boolean

See Also:
allowsMultipleSelections
 o getVisibleIndex
 public int getVisibleIndex()
Gets the row of the item that was last made visible by the method makeVisible.

 o makeVisible
 public void makeVisible(int row)
Forces the item at the specified row to be visible.

Parameters:
row - the position of the item
See Also:
getVisibleIndex
 o getRowHeight
 public int getRowHeight()
Gets the height of each row (pixels).

See Also:
setRowHeight
 o setRowHeight
 public void setRowHeight(int h)
Sets the height of each row (pixels).

HTML param name/value: "RowHeight"/an int, "VARIABLE", or "FONT_HEIGHT"

Parameters:
h - any int, or one of the following:

If set to BWTEnum.VARIABLE, the height will be calculated individually for each row.

If set to BWTEnum.FONT_HEIGHT (default), the height will be set to the height of the current font.

Throws: IllegalArgumentException
If an invalid value is set
 o getSpacing
 public int getSpacing()
Gets the spacing between items.

See Also:
setSpacing
 o setSpacing
 public void setSpacing(int v)
Sets the spacing between items (default: 0). This value increases the HighlightThickness value.

HTML param name/value: "Spacing"/int

See Also:
setHighlightThickness
 o sortByColumn
 public void sortByColumn(int column,
                          JCSortInterface sort_if)
Sorts the rows in the list in ascending order based on a specified column, using the String equivalents of each value.

Parameters:
sort_if - An optional interface whose compare method is called during sorting, to provide a mechanism for the application to specify whether one object is greater than another (similar to qsort's compare function). If this parameter is null, the column is sorted by numerical or string comparison as applicable.
Overrides:
sortByColumn in class JCMultiColumnWindow
 o sortByColumn
 public void sortByColumn(int column,
                          JCSortInterface sort_if,
                          int direction)
Sorts the rows in the list based on a specified column, using the String equivalents of each value.

Parameters:
sort_if - An optional interface whose compare method is called during sorting, to provide a mechanism for the application to specify whether one object is greater than another (similar to qsort's compare function). If this parameter is null, the column is sorted by numerical or string comparison as applicable.
direction - sort direction: ASCENDING or DESCENDING
Overrides:
sortByColumn in class JCMultiColumnWindow
 o paintRow
 public void paintRow(int row)
Draws a row.

 o getUserDataList
 public Object[] getUserDataList()
Gets the UserDataList value.

See Also:
setUserDataList
 o setUserDataList
 public void setUserDataList(Object v[])
Sets an application-defined list of objects that are maintained for each item.


All Packages  Class Hierarchy  This Package  Previous  Next  Index