All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class symantec.itools.awt.MultiList

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----symantec.itools.awt.MultiList

public class MultiList
extends Panel
This class implements a multi-column listbox component. Use to create a box that displays a matrix of items that the user can select. The user cannot type or edit a selection in a list box.

The user can resize a column at run-time by dragging the column boundary to a new position.


Variable Index

 o CENTER
Center-justify column alignment constant.
 o CLICKTHRESHOLD
Maximum time inverval to register a double click (in milliseconds).
 o isSun1_1
 o LEFT
Left-justify column alignment constant.
 o RIGHT
Right-justify column alignment constant.

Constructor Index

 o MultiList()
Default constructor for MultiList.
 o MultiList(int)
Constructs a new MultiList with the specified number of columns.
 o MultiList(int, boolean)
Constructs a new MultiList with the specified number of columns and whether multiple row selection is allowed.
 o MultiList(int, boolean, Color)
Constructs a new MultiList with the specified number of columns, whether multiple row selection is allowed, and given background color.

Method Index

 o addCell(int, int, String, Image)
Sets the contents of a cell, both text and image.
 o addImageCell(int, int, Image)
Sets the image of a cell at the given row and column position.
 o addTextCell(int, int, String)
Sets the text of a cell at the given row and column position.
 o adjustHeadings()
Adjusts the columns to default width.
 o changeSelection(int, int)
This routine changes the selected row, handling multiple selections as needed.
 o clear()
Removes all rows from the MultiList.
 o createColumns(int)
Initializes the MultiList with the specified total numer of columns.
 o getCellBg()
Gets the current background color of cell text.
 o getCellFg()
Gets the current foreground color of cell text.
 o getCellFont()
Returns the font currently used for text in all the cells.
 o getCellImage(int, int)
Returns the image of the specified cell, if any.
 o getCellText(int, int)
Returns the text of the specified cell.
 o getColumnAlignments()
Gets a string array containing the alignment of each column.
 o getColumnSize(int)
Get the column width, in pixels, for the specified column.
 o getColumnSizes()
Returns a string array containing the width of each column in pixels.
 o getHeading(int)
Returns the heading text of the specified column.
 o getHeadingBg()
Returns the color of the column heading text background.
 o getHeadingFg()
Returns the color of the column heading text foreground.
 o getHeadingFont()
Returns the font for column heading text.
 o getHeadings()
Get a String array of all of the column headings.
 o getListItems()
Returns the text contents of all the cells as a string array.
 o getMinColumnWidth()
Returns the minimum allowable column width in pixels.
 o getNumberOfCols()
Returns the current number of columns.
 o getNumberOfRows()
Gets the current number of columns.
 o getSelectedRow()
Returns the zero-relative index of the currently selected row.
 o getSelectedRows()
Returns an integer index for each selected row.
 o handleEvent(Event)
Processes events for this component.
 o keyDown(Event, int)
Processes KEY_PRESS and KEY_ACTION events.
 o minimumSize()
Returns the minimum dimensions to properly display this component.
 o mouseDown(Event, int, int)
Processes MOUSE_DOWN events.
 o mouseDrag(Event, int, int)
Processes MOUSE_DRAG events.
 o mouseMove(Event, int, int)
Processes MOUSE_MOVE events.
 o mouseUp(Event, int, int)
Processes MOUSE_UP events.
 o paint(Graphics)
Paints this component using the given graphics context.
 o preferredSize()
Returns the recommended dimensions to properly display this component.
 o redraw()
Paints this component into an offscreen image for cleaner screen repaints.
 o removeRow(int)
Remove a single row from the MultiList.
 o reshape(int, int, int, int)
Moves and/or resizes this component.
 o selectAll()
Selects all the elements in the MuliList.
 o setCellBg(Color)
Sets the background color of cell text.
 o setCellColors(Color, Color)
Sets foreground and background colors of cell text.
 o setCellFg(Color)
Sets the foreground color of cell text.
 o setCellFont(Font)
Sets the font used for text in all the cells.
 o setColumnAlignment(int, int)
Set the alignment of the text in the specified column.
 o setColumnAlignments(String[])
Sets the alignment of each column.
 o setColumns(int)
Initializes the MultiList with the specified total numer of columns.
 o setColumnSizes(String[])
Sets the the width of each column in pixels.
 o setHeading(String, int, int)
Sets a column's heading text and width.
 o setHeadingBg(Color)
Sets the column heading text background color.
 o setHeadingColors(Color, Color)
Sets the column heading text foreground and background colors.
 o setHeadingFg(Color)
Sets the column heading text foreground color.
 o setHeadingFont(Font)
Sets the font for column heading text.
 o setHeadings(String[])
Initializes all the column headings with the given list.
 o setListItems(String[])
Initializes all the MultiList cells with text.
 o setMinColumnWidth(int)
Sets the minimum allowable column width.
 o setSelectedRow(int)
Sets the specified row as the selected row.
 o update(Graphics)
Handles redrawing of this component on the screen.

Variables

 o CLICKTHRESHOLD
  public final static long CLICKTHRESHOLD
Maximum time inverval to register a double click (in milliseconds).

 o LEFT
  public final static int LEFT
Left-justify column alignment constant.

 o CENTER
  public final static int CENTER
Center-justify column alignment constant.

 o RIGHT
  public final static int RIGHT
Right-justify column alignment constant.

 o isSun1_1
  protected boolean isSun1_1

Constructors

 o MultiList
  public MultiList()
Default constructor for MultiList.

 o MultiList
  public MultiList(int cols)
Constructs a new MultiList with the specified number of columns.

Parameters:
cols - the number of columns
 o MultiList
  public MultiList(int cols,
                   boolean multi)
Constructs a new MultiList with the specified number of columns and whether multiple row selection is allowed.

Parameters:
cols - the number of columns
multi - true for multiple row selection, false otherwise
 o MultiList
  public MultiList(int cols,
                   boolean multi,
                   Color bg)
Constructs a new MultiList with the specified number of columns, whether multiple row selection is allowed, and given background color.

Parameters:
cols - the number of columns
multi - true for multiple row selection, false otherwise
bg - the background color

Methods

 o selectAll
  public void selectAll()
Selects all the elements in the MuliList. Multiple select must be enabled for this to have any effect.

 o setColumns
  public void setColumns(int i)
Initializes the MultiList with the specified total numer of columns. All old column data is lost. Row data is preserved. Note that this method is identical to method createColumns().

Parameters:
i - the new number of columns
See Also:
createColumns, getNumberOfCols
 o getNumberOfRows
  public int getNumberOfRows()
Gets the current number of columns.

Returns:
the current number of columns
 o setHeading
  public void setHeading(String h,
                         int i,
                         int pixels)
Sets a column's heading text and width.

Parameters:
h - the new column heading text
i - the zero-relative index of the column
pixels - the new width of the column in pixels
See Also:
getHeading
 o getHeading
  public String getHeading(int i)
Returns the heading text of the specified column.

Parameters:
i - the zero-relative index of the column
See Also:
setHeading
 o adjustHeadings
  public void adjustHeadings()
Adjusts the columns to default width. The width of the columns is adjusted so that all columns fit into the overall width of the MultiList.

 o setHeadings
  public void setHeadings(String list[])
Initializes all the column headings with the given list. For each string in the given list, create a column, use the string as its heading, and give it a default width.

Parameters:
list - array of heading strings
See Also:
getHeadings
 o getHeadings
  public String[] getHeadings()
Get a String array of all of the column headings.

Returns:
an array of all of the current headings
See Also:
setHeadings
 o setHeadingFont
  public void setHeadingFont(Font f)
Sets the font for column heading text.

Parameters:
f - the font for heading text
See Also:
getHeadingFont
 o getHeadingFont
  public Font getHeadingFont()
Returns the font for column heading text.

See Also:
setHeadingFont
 o setCellFont
  public void setCellFont(Font f)
Sets the font used for text in all the cells.

Parameters:
f - the font for cell text
See Also:
getCellFont
 o getCellFont
  public Font getCellFont()
Returns the font currently used for text in all the cells.

See Also:
setCellFont
 o setHeadingColors
  public void setHeadingColors(Color fg,
                               Color bg)
Sets the column heading text foreground and background colors.

Parameters:
fg - foreground color for heading text
bg - background color for heading text
See Also:
setHeadingFg, setHeadingBg
 o setHeadingFg
  public void setHeadingFg(Color c)
Sets the column heading text foreground color.

Parameters:
c - foreground color for heading text
See Also:
getHeadingFg, setHeadingBg, setHeadingColors
 o setHeadingBg
  public void setHeadingBg(Color c)
Sets the column heading text background color.

Parameters:
c - background color for heading text
See Also:
getHeadingBg, setHeadingFg, setHeadingColors
 o getHeadingFg
  public Color getHeadingFg()
Returns the color of the column heading text foreground.

Returns:
the current column heading foreground color
See Also:
setHeadingFg
 o getHeadingBg
  public Color getHeadingBg()
Returns the color of the column heading text background.

Returns:
the current column heading background color
See Also:
setHeadingBg
 o setCellColors
  public void setCellColors(Color fg,
                            Color bg)
Sets foreground and background colors of cell text.

Parameters:
fg - the foreground color of cell text
bg - the background color of cell text
See Also:
setCellFg, setCellBg, getCellFg, getCellBg
 o setCellFg
  public void setCellFg(Color c)
Sets the foreground color of cell text.

Parameters:
c - the foreground color of cell text
See Also:
getCellFg, setCellBg, setCellColors
 o setCellBg
  public void setCellBg(Color c)
Sets the background color of cell text.

Parameters:
c - the background color of cell text
See Also:
getCellBg, setCellFg, setCellColors
 o getCellFg
  public Color getCellFg()
Gets the current foreground color of cell text.

Returns:
the current cell foreground color
See Also:
setCellFg
 o getCellBg
  public Color getCellBg()
Gets the current background color of cell text.

Returns:
the current cell background color
See Also:
setCellBg
 o getColumnAlignments
  public String[] getColumnAlignments()
Gets a string array containing the alignment of each column. The possible values for each element are "Left", "Center", or "Right".

Returns:
an array of strings containing the alignment for each column.
See Also:
setColumnAlignments
 o setColumnAlignments
  public void setColumnAlignments(String list[])
Sets the alignment of each column.

Parameters:
list - an array of strings that determines column alignment. Each item should contain one of the following: "Left", "Center", or "Right"
See Also:
getColumnAlignments
 o getColumnSizes
  public String[] getColumnSizes()
Returns a string array containing the width of each column in pixels.

See Also:
setColumnSizes
 o setColumnSizes
  public void setColumnSizes(String list[])
Sets the the width of each column in pixels.

Parameters:
list - a string array containing column sizes in pixels
See Also:
getColumnSizes
 o getColumnSize
  public int getColumnSize(int i)
Get the column width, in pixels, for the specified column.

Parameters:
i - the zero-relative column index
 o setColumnAlignment
  public void setColumnAlignment(int i,
                                 int align)
Set the alignment of the text in the specified column.

Parameters:
i - the zero-relative column index
align - one of the values: LEFT, CENTER, or RIGHT
See Also:
LEFT, CENTER, RIGHT
 o getNumberOfCols
  public int getNumberOfCols()
Returns the current number of columns.

 o setSelectedRow
  public void setSelectedRow(int r) throws IllegalArgumentException
Sets the specified row as the selected row.

Parameters:
r - the zero-relative index of the row to select
See Also:
getSelectedRow
 o getSelectedRow
  public int getSelectedRow()
Returns the zero-relative index of the currently selected row.

See Also:
setSelectedRow
 o getSelectedRows
  public int[] getSelectedRows()
Returns an integer index for each selected row.

Returns:
the zero-relative indexes of the selected rows. May return null (no rows selected)
See Also:
getSelectedRow, setSelectedRow
 o setMinColumnWidth
  public void setMinColumnWidth(int size)
Sets the minimum allowable column width.

Parameters:
size - the minimum column width in pixels
See Also:
getMinColumnWidth
 o getMinColumnWidth
  public int getMinColumnWidth()
Returns the minimum allowable column width in pixels.

See Also:
setMinColumnWidth
 o mouseDown
  public boolean mouseDown(Event e,
                           int x,
                           int y)
Processes MOUSE_DOWN events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DOWN event. These events occur when the mouse button is pressed while inside this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDown in class Component
See Also:
mouseUp, handleEvent
 o mouseDrag
  public boolean mouseDrag(Event e,
                           int x,
                           int y)
Processes MOUSE_DRAG events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_DRAG event. These events occur when the mouse is moved around inside this component while the button is pressed.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseDrag in class Component
See Also:
mouseMove, handleEvent
 o mouseUp
  public boolean mouseUp(Event e,
                         int x,
                         int y)
Processes MOUSE_UP events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_UP event. These events occur when the mouse button is released while inside this component.

Parameters:
e - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
true if the event was handled
Overrides:
mouseUp in class Component
See Also:
mouseDown, handleEvent
 o mouseMove
  public boolean mouseMove(Event ev,
                           int x,
                           int y)
Processes MOUSE_MOVE events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a MOUSE_MOVE event. These events occur when the mouse is moved around inside this component while the button is NOT pressed.

Parameters:
ev - the event
x - the component-relative horizontal coordinate of the mouse
y - the component-relative vertical coordinate of the mouse
Returns:
always true since the event was handled
Overrides:
mouseMove in class Component
See Also:
mouseDrag, handleEvent
 o keyDown
  public boolean keyDown(Event ev,
                         int key)
Processes KEY_PRESS and KEY_ACTION events. This is a standard Java AWT method which gets called by the AWT method handleEvent() in response to receiving a KEY_PRESS or KEY_ACTION event. These events occur when this component has the focus and the user presses a "normal" or an "action" (F1, page up, etc) key.

Parameters:
ev - the Event
key - the key that was pressed
Returns:
true if the event was handled
Overrides:
keyDown in class Component
See Also:
keyUp, handleEvent
 o handleEvent
  public boolean handleEvent(Event e)
Processes events for this component. This is a standard Java AWT method which gets called by the AWT to handle this component's events. The default handler for components dispatches to one of the following methods as needed: action(), gotFocus(), lostFocus(), keyDown(), keyUp(), mouseEnter(), mouseExit(), mouseMove(), mouseDrag(), mouseDown(), or mouseUp().

Parameters:
e - the event to handle
Returns:
true if the event was handled and no further action is needed, false to pass the event to this component's parent
Overrides:
handleEvent in class Component
See Also:
action, gotFocus, lostFocus, keyDown, keyUp, mouseEnter, mouseExit, mouseMove, mouseDrag, mouseDown, mouseUp
 o createColumns
  public void createColumns(int i)
Initializes the MultiList with the specified total numer of columns. All old column data is lost. Row data is preserved. Note that this method is identical to method setColumns().

Parameters:
i - the new number of columns
See Also:
setColumns, getNumberOfCols
 o clear
  public void clear()
Removes all rows from the MultiList.

See Also:
removeRow
 o removeRow
  public void removeRow(int row)
Remove a single row from the MultiList.

Parameters:
row - the zero-relative index of the row to remove
See Also:
clear
 o addTextCell
  public void addTextCell(int r,
                          int c,
                          String s)
Sets the text of a cell at the given row and column position.

Parameters:
r - the zero-relative row index
c - the zero-relative column index
s - the new cell text
See Also:
addImageCell, addCell
 o addImageCell
  public void addImageCell(int r,
                           int c,
                           Image i)
Sets the image of a cell at the given row and column position.

Parameters:
r - the zero-relative row index
c - the zero-relative column index
i - the new cell image
See Also:
addTextCell, addCell
 o addCell
  public void addCell(int r,
                      int c,
                      String s,
                      Image i)
Sets the contents of a cell, both text and image.

Parameters:
r - the zero-relative row index
c - the zero-relative column index
s - the new cell text
i - the new cell image
See Also:
addTextCell, addImageCell
 o getCellText
  public String getCellText(int r,
                            int c)
Returns the text of the specified cell.

Parameters:
r - the zero-relative row index
c - the zero-relative column index
Returns:
the cell text or the empty string ("") if the cell is not allocated
See Also:
getCellImage
 o getCellImage
  public Image getCellImage(int r,
                            int c)
Returns the image of the specified cell, if any.

Parameters:
r - the zero-relative row index
c - the zero-relative column index
Returns:
the cell image or null if the cell is not allocated
See Also:
getCellText
 o setListItems
  public void setListItems(String items[])
Initializes all the MultiList cells with text. Each string in the provided array initializes one row. The contents of each column are separated by ";". For example, the string "col0;col1;col2" would result in "col0" being placed in column 0, "col1" in column 1, and "col2" in column 2. Any remaining columns will get cleared.

Parameters:
items - the string array used to initialize all cell contents
See Also:
getListItems
 o getListItems
  public String[] getListItems()
Returns the text contents of all the cells as a string array. A new string is used for each row. The contents of each row's column are separated by ";". For example, the string "col0;;col2" would result from a "col0" in column 0, an empty column 1, and "col2" in column 2.

Returns:
the string array containing the text of all the cells
See Also:
setListItems
 o update
  public void update(Graphics g)
Handles redrawing of this component on the screen. This is a standard Java AWT method which gets called by the Java AWT (repaint()) to handle repainting this component on the screen. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner. Typically this method paints the background color to clear the component's drawing space, sets graphics context to be the foreground color, and then calls paint() to draw the component. It is overridden here to eliminate the unneeded repainting of the background.

Parameters:
g - the graphics context
Overrides:
update in class Component
See Also:
repaint, paint
 o paint
  public void paint(Graphics g)
Paints this component using the given graphics context. This is a standard Java AWT method which typically gets called by the AWT to handle painting this component. It paints this component using the given graphics context. The graphics context clipping region is set to the bounding rectangle of this component and its <0,0> coordinate is this component's top-left corner.

Parameters:
g - the graphics context used for painting
Overrides:
paint in class Container
See Also:
repaint, update
 o redraw
  public void redraw()
Paints this component into an offscreen image for cleaner screen repaints. It is not typically called directly.

 o reshape
  public synchronized void reshape(int x,
                                   int y,
                                   int width,
                                   int height)
Moves and/or resizes this component. This is a standard Java AWT method which gets called to move and/or resize this component. Components that are in containers with layout managers should not call this method, but rely on the layout manager instead.

Parameters:
x - horizontal position in the parent's coordinate space
y - vertical position in the parent's coordinate space
width - the new width
height - the new height
Overrides:
reshape in class Component
 o changeSelection
  public void changeSelection(int newSelection,
                              int meta)
This routine changes the selected row, handling multiple selections as needed.

Parameters:
newSelection - the zero-relative index of the newly selected row
meta - the state of the modifier keys from Event.modifiers
See Also:
setSelectedRow, CTRL_MASK, SHIFT_MASK
 o preferredSize
  public synchronized Dimension preferredSize()
Returns the recommended dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the recommended size of this component.

Overrides:
preferredSize in class Container
See Also:
minimumSize
 o minimumSize
  public synchronized Dimension minimumSize()
Returns the minimum dimensions to properly display this component. This is a standard Java AWT method which gets called to determine the minimum size of this component.

Overrides:
minimumSize in class Container
See Also:
preferredSize

All Packages  Class Hierarchy  This Package  Previous  Next  Index