    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

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
UserDataList | 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

##

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

##

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

  HTML param name/value: "AllowMultipleSelections"/boolean

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

  HTML param name/value: "AutoSelect"/boolean

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

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

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

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

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

  HTML param name/value: "SelectedBackground"/color

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

  HTML param name/value: "SelectedForeground"/color

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

##

JCMultiColumnList

      public JCMultiColumnList()

  Creates an empty list. No parameters are read from an HTML file.

JCMultiColumnList

      public JCMultiColumnList(JCVector items)

  Creates a list with the specified items. No parameters are read from an HTML file.

  See Also:
    setItems

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

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

##

getList

      public JCMultiColumnListComponent getList()

  Gets the internal list.

setList

      public void setList(JCMultiColumnListComponent list)

  Replaces the current internal list.

preferredWidth

      protected int preferredWidth()

  Gets the subclass' preferred width (default: 100).

  Overrides:
    preferredWidth in class JCScrolledWindow

getViewportHeight

      protected int getViewportHeight()

  Sets the work area height to be the list's total height.

  Overrides:
    getViewportHeight in class JCScrolledWindow

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

removeItemListener

      public void removeItemListener(JCItemListener l)

  Removes the specified item listener so it no longer receives item events from this list.

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

removeActionListener

      public void removeActionListener(JCActionListener l)

  Removes the specified action listener so it no longer receives action events from this list.

  See Also:
    addActionListener

getBatched

      public boolean getBatched()

  Gets the Batched value.

  See Also:
    setBatched

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.

getItems

      public JCVector getItems()

  Gets the list's values.

  See Also:
    setItems

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

setItems

      public void setItems(String items[])

  Sets the list's values as a list of Strings.

getItemsStrings

      public synchronized String[] getItemsStrings()

  Gets the list's values as a list of Strings.

  See Also:
    setItems

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.

countItems

      public int countItems()

  Returns the number of items in the list.

  See Also:
    getItem

getItem

      public Object getItem(int row)

  Gets the item associated with the specified index.

  Parameters:
    row - the position of the item
  See Also:
    countItems

addItem

      public void addItem(Object item)

  Adds the specified item to the end of the list.

  Parameters:
    item - the item to be added

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

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

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

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

clear

      public void clear()

  Clears the list.

  See Also:
    deleteItem, deleteItems

deleteItem

      public void deleteItem(int row)

  Deletes an item from the list.

deleteItems

      public void deleteItems(int start,
                              int end)

  Delete multiple items from the list.

getSelectedIndex

      public int getSelectedIndex()

  Gets the selected item on the list or BWTEnum.NOTFOUND if no item is selected.

  See Also:
    select, deselect, isSelected

getSelectedIndexes

      public int[] getSelectedIndexes()

  Returns the selected indexes on the list.

  See Also:
    select, deselect, isSelected

getSelectedItem

      public Object getSelectedItem()

  Returns the selected item on the list or null if no item is selected.

  See Also:
    select, deselect, isSelected

getSelectedObjects

      public Object[] getSelectedObjects()

  Returns the selected items on the list as Strings.

  See Also:
    select, deselect, isSelected

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

getAutoSelect

      public boolean getAutoSelect()

  Gets the AutoSelect value.

  See Also:
    setAutoSelect

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

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

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

getSelectedBackground

      public Color getSelectedBackground()

  Gets the list's SelectedBackground value.

  See Also:
    setSelectedBackground

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

getSelectedForeground

      public Color getSelectedForeground()

  Gets the list's SelectedForeground value.

  See Also:
    setSelectedForeground

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

getRows

      public int getRows()

  Returns the number of visible lines in this list.

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

getTopRow

      public int getTopRow()

  Gets the current top-most visible row.

  See Also:
    setTopRow

setTopRow

      public void setTopRow(int row)

  Sets the top-most visible row.

  See Also:
    makeVisible

allowsMultipleSelections

      public boolean allowsMultipleSelections()

  Returns true if this list allows multiple selections.

  See Also:
    setAllowMultipleSelections

getAllowMultipleSelections

      public boolean getAllowMultipleSelections()

  Returns true if this list allows multiple selections.

  See Also:
    setAllowMultipleSelections

setAllowMultipleSelections

      public void setAllowMultipleSelections(boolean v)

  Sets whether the list allows multiple selections.

  HTML param name/value: "AllowMultipleSelections"/boolean

  See Also:
    allowsMultipleSelections

getVisibleIndex

      public int getVisibleIndex()

  Gets the row of the item that was last made visible by the method makeVisible.

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

getRowHeight

      public int getRowHeight()

  Gets the height of each row (pixels).

  See Also:
    setRowHeight

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

getSpacing

      public int getSpacing()

  Gets the spacing between items.

  See Also:
    setSpacing

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

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

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

paintRow

      public void paintRow(int row)

  Draws a row.

getUserDataList

      public Object[] getUserDataList()

  Gets the UserDataList value.

  See Also:
    setUserDataList

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