    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class jclass.bwt.JCMultiColumnListComponent

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.Canvas
                       |
                       +----jclass.bwt.JCComponent
                               |
                               +----jclass.bwt.JCListComponent
                                       |
                                       +----jclass.bwt.JCMultiColumnListComponent

public class JCMultiColumnListComponent
extends JCListComponent
implements JCMultiColumnInterface

A list of text and/or image items. To create a scrollable list, use a JCMultiColumnList.

See Also:
  JCMultiColumnList

##

data
  The object which maintains the multi-column data.

##

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

##

addItem(Applet, String, char)
  Parses a string and adds the specified item to the end of the list.
addItem(String, char)
  Parses a string and adds the specified item to the end of the list.
addNotify()
  If NumColumns has not been set, it is set to the largest number of items in all items.
calcSize(int, boolean)
  Recalculates the list's internal sizes based on the row.
calcWidth(int)
  Calculates the width of a column for all rows.
draw(Graphics, Object, int, Rectangle)
  Draws the value as a String, JCString or Image.
drawHighlight(Graphics, boolean)
  Draws or clears the highlight rectangle (called by paint).
getColumnAlignment(int)
  Gets a column's alignment (default: BWTEnum.MIDDLELEFT).
getColumnAlignments()
  Gets the column alignments.
getColumnLeftMargin(int)
  Gets the column's left margin value (pixels) (default: 5).
getColumnPosition(int)
  Gets the physical position of the left boundary of the column (accounting for horizontal scrolling).
getColumnRightMargin(int)
getColumnWidth(int)
  Gets the current width of a column, or 0 if the column does not exist.
getColumnWidths()
  Gets a list of the column widths.
getItemsStrings()
  Gets the list's values as a list of Strings.
getMultiColumnData()
  Gets the component's JCMultiColumnData instance.
getNumColumns()
  Gets the current number of columns.
getParameters()
  Reads the parameter values from the HTML page using the component's applet.
preferredWidth()
  Returns the width of the widest item.
setBatched(boolean)
  If false (default), the component is repainted every time an item is changed.
setColumnAlignment(int, int)
  Sets a column's alignment.
setColumnAlignments(int[])
  Sets the column's alignments.

  This value may be set from an HTML file using a PARAM tag with a "ColumnAlignments" name and a comma-separated list of enums.

setColumnButtons(JCVector)
  If the list is a child of a JCMultiColumnList, sets a header for the window with buttons with the specified labels.
setColumnLabels(JCVector)
  If the list is a child of a JCMultiColumnList, sets a header for the window with the specified labels.
setColumnLeftMargin(int, int)
  Sets the column's left margin value (pixels) (default: 5).
setColumnRightMargin(int, int)
  Sets the column's right margin value (pixels) (default: 5).

  The values for all columns may be set from an HTML file using a PARAM tag with a "ColumnRightMargins" name and a comma-separated list of ints.

setColumnWidth(int, int)
  Sets the width of a column.
setColumnWidths(int[])
  Sets the list of column widths.
setFont(Font)
  Sets the font of the component.
setItems(String[])
  Sets the list's values as an array of Strings.
setNumColumns(int)
  Sets the current number of columns.
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.

##

data

     protected JCMultiColumnData data

  The object which maintains the multi-column data.

##

JCMultiColumnListComponent

     public JCMultiColumnListComponent()

  Creates an empty list with no visible rows. No parameters are read from an HTML file.

JCMultiColumnListComponent

     public JCMultiColumnListComponent(JCVector items)

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

  See Also:
    setItems

JCMultiColumnListComponent

     public JCMultiColumnListComponent(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

JCMultiColumnListComponent

     public JCMultiColumnListComponent(int rows,
                                       boolean multipleSelections)

  Creates a list with the specified number of visible lines.

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

##

getParameters

     protected void getParameters()

  Reads the parameter values from the HTML page using the component's applet. The values will override those previously set.

  Overrides:
    getParameters in class JCListComponent

setFont

     public void setFont(Font f)

  Sets the font of the component. HTML param name/value: "Font"/font

  Overrides:
    setFont in class JCListComponent
  See Also:
    toFont

setItems

     public void setItems(String items[])

  Sets the list's values as an array of Strings. The value for each column is separated by commas.

  Overrides:
    setItems in class JCListComponent

getItemsStrings

     public synchronized String[] getItemsStrings()

  Gets the list's values as a list of Strings. The value for each column is separated by commas.

  Overrides:
    getItemsStrings in class JCListComponent
  See Also:
    setItems

setColumnLabels

     public void setColumnLabels(JCVector labels)

  If the list is a child of a JCMultiColumnList, sets a header for the window with the specified labels.

  See Also:
    setColumnLabels

setColumnButtons

     public void setColumnButtons(JCVector labels)

  If the list is a child of a JCMultiColumnList, sets a header for the window with buttons with the specified labels.

  See Also:
    setColumnButtons

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.

  Overrides:
    setBatched in class JCListComponent

calcSize

     protected void calcSize(int row,
                             boolean new_row)

  Recalculates the list's internal sizes based on the row.

  Parameters:
    new_row - whether this is a new item
  Overrides:
    calcSize in class JCListComponent

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 JCVector is created using the tokens in the string.
    delim - delimiter separating each token in the string
  See Also:
    toVector

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

draw

     protected void draw(Graphics gc,
                         Object value,
                         int alignment,
                         Rectangle draw_rect)

  Draws the value as a String, JCString or Image.

  Parameters:
    alignment - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT
    draw_rect - rectangle within which to draw the value
  Overrides:
    draw in class JCListComponent

drawHighlight

     protected void drawHighlight(Graphics gc,
                                  boolean on)

  Draws or clears the highlight rectangle (called by paint).

  Parameters:
    on - if true, draws the highlight rectangle; otherwise clears the rect If false, draws a 1-pixel rectangle
  Overrides:
    drawHighlight in class JCComponent

addNotify

     public void addNotify()

  If NumColumns has not been set, it is set to the largest number of items in all items.

  Overrides:
    addNotify in class JCListComponent

preferredWidth

     protected int preferredWidth()

  Returns the width of the widest item.

  Overrides:
    preferredWidth in class JCListComponent

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.

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: JCqsort.ASCENDING or DESCENDING

calcWidth

     public int calcWidth(int col)

  Calculates the width of a column for all rows.

getColumnWidths

     public int[] getColumnWidths()

  Gets a list of the column widths.

  See Also:
    setColumnWidths

setColumnWidths

     public void setColumnWidths(int widths[])

  Sets the list of column widths. If a column's value is set to BWTEnum.VARIABLE, the width is set to the widest value in the column.

  This value may be set from an HTML file using a PARAM tag with a "ColumnWidths" name and a comma-separated list of ints.

getColumnWidth

     public int getColumnWidth(int col)

  Gets the current width of a column, or 0 if the column does not exist.

setColumnWidth

     public void setColumnWidth(int col,
                                int width)

  Sets the width of a column. If the value is set to BWTEnum.VARIABLE, the width is set to the widest value in the column.

getNumColumns

     public int getNumColumns()

  Gets the current number of columns.

setNumColumns

     public void setNumColumns(int v)

  Sets the current number of columns. If set to BWTEnum.VARIABLE (default), all columns are displayed.

  HTML param name/value: "NumColumns"/int

getColumnAlignments

     public int[] getColumnAlignments()

  Gets the column alignments.

getColumnAlignment

     public int getColumnAlignment(int col)

  Gets a column's alignment (default: BWTEnum.MIDDLELEFT).

setColumnAlignment

     public void setColumnAlignment(int col,
                                    int align)

  Sets a column's alignment.

  Parameters:
    alignment - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT

setColumnAlignments

     public void setColumnAlignments(int align[])

  Sets the column's alignments.

  This value may be set from an HTML file using a PARAM tag with a "ColumnAlignments" name and a comma-separated list of enums.

  Parameters:
    align - one of: BWTEnum.TOPLEFT, TOPCENTER, TOPRIGHT, MIDDLELEFT, MIDDLECENTER, MIDDLERIGHT, BOTTOMLEFT, BOTTOMCENTER and BOTTOMRIGHT

getColumnPosition

     public int getColumnPosition(int col)

  Gets the physical position of the left boundary of the column (accounting for horizontal scrolling).

getColumnLeftMargin

     public int getColumnLeftMargin(int col)

  Gets the column's left margin value (pixels) (default: 5).

setColumnLeftMargin

     public void setColumnLeftMargin(int col,
                                     int value)

  Sets the column's left margin value (pixels) (default: 5). The values for all columns may be set from an HTML file using a PARAM tag with a "ColumnLeftMargins" name and a comma-separated list of ints.

getColumnRightMargin

     public int getColumnRightMargin(int col)

setColumnRightMargin

     public void setColumnRightMargin(int col,
                                      int value)

  Sets the column's right margin value (pixels) (default: 5).

  The values for all columns may be set from an HTML file using a PARAM tag with a "ColumnRightMargins" name and a comma-separated list of ints.

getMultiColumnData

     public JCMultiColumnData getMultiColumnData()

  Gets the component's JCMultiColumnData instance.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index