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.
-
CENTER
- Center-justify column alignment constant.
-
CLICKTHRESHOLD
- Maximum time inverval to register a double click (in milliseconds).
-
isSun1_1
-
-
LEFT
- Left-justify column alignment constant.
-
RIGHT
- Right-justify column alignment constant.
-
MultiList()
- Default constructor for MultiList.
-
MultiList(int)
- Constructs a new MultiList with the specified number of columns.
-
MultiList(int, boolean)
- Constructs a new MultiList with the specified number of columns
and whether multiple row selection is allowed.
-
MultiList(int, boolean, Color)
- Constructs a new MultiList with the specified number of columns,
whether multiple row selection is allowed, and given background color.
-
addCell(int, int, String, Image)
- Sets the contents of a cell, both text and image.
-
addImageCell(int, int, Image)
- Sets the image of a cell at the given row and column position.
-
addTextCell(int, int, String)
- Sets the text of a cell at the given row and column position.
-
adjustHeadings()
- Adjusts the columns to default width.
-
changeSelection(int, int)
- This routine changes the selected row, handling multiple selections
as needed.
-
clear()
- Removes all rows from the MultiList.
-
createColumns(int)
- Initializes the MultiList with the specified total numer of columns.
-
getCellBg()
- Gets the current background color of cell text.
-
getCellFg()
- Gets the current foreground color of cell text.
-
getCellFont()
- Returns the font currently used for text in all the cells.
-
getCellImage(int, int)
- Returns the image of the specified cell, if any.
-
getCellText(int, int)
- Returns the text of the specified cell.
-
getColumnAlignments()
- Gets a string array containing the alignment of each column.
-
getColumnSize(int)
- Get the column width, in pixels, for the specified column.
-
getColumnSizes()
- Returns a string array containing the width of each column in pixels.
-
getHeading(int)
- Returns the heading text of the specified column.
-
getHeadingBg()
- Returns the color of the column heading text background.
-
getHeadingFg()
- Returns the color of the column heading text foreground.
-
getHeadingFont()
- Returns the font for column heading text.
-
getHeadings()
- Get a String array of all of the column headings.
-
getListItems()
- Returns the text contents of all the cells as a string array.
-
getMinColumnWidth()
- Returns the minimum allowable column width in pixels.
-
getNumberOfCols()
- Returns the current number of columns.
-
getNumberOfRows()
- Gets the current number of columns.
-
getSelectedRow()
- Returns the zero-relative index of the currently selected row.
-
getSelectedRows()
- Returns an integer index for each selected row.
-
handleEvent(Event)
- Processes events for this component.
-
keyDown(Event, int)
- Processes KEY_PRESS and KEY_ACTION events.
-
minimumSize()
- Returns the minimum dimensions to properly display this component.
-
mouseDown(Event, int, int)
- Processes MOUSE_DOWN events.
-
mouseDrag(Event, int, int)
- Processes MOUSE_DRAG events.
-
mouseMove(Event, int, int)
- Processes MOUSE_MOVE events.
-
mouseUp(Event, int, int)
- Processes MOUSE_UP events.
-
paint(Graphics)
- Paints this component using the given graphics context.
-
preferredSize()
- Returns the recommended dimensions to properly display this component.
-
redraw()
- Paints this component into an offscreen image for cleaner screen repaints.
-
removeRow(int)
- Remove a single row from the MultiList.
-
reshape(int, int, int, int)
- Moves and/or resizes this component.
-
selectAll()
- Selects all the elements in the MuliList.
-
setCellBg(Color)
- Sets the background color of cell text.
-
setCellColors(Color, Color)
- Sets foreground and background colors of cell text.
-
setCellFg(Color)
- Sets the foreground color of cell text.
-
setCellFont(Font)
- Sets the font used for text in all the cells.
-
setColumnAlignment(int, int)
- Set the alignment of the text in the specified column.
-
setColumnAlignments(String[])
- Sets the alignment of each column.
-
setColumns(int)
- Initializes the MultiList with the specified total numer of columns.
-
setColumnSizes(String[])
- Sets the the width of each column in pixels.
-
setHeading(String, int, int)
- Sets a column's heading text and width.
-
setHeadingBg(Color)
- Sets the column heading text background color.
-
setHeadingColors(Color, Color)
- Sets the column heading text foreground and background colors.
-
setHeadingFg(Color)
- Sets the column heading text foreground color.
-
setHeadingFont(Font)
- Sets the font for column heading text.
-
setHeadings(String[])
- Initializes all the column headings with the given list.
-
setListItems(String[])
- Initializes all the MultiList cells with text.
-
setMinColumnWidth(int)
- Sets the minimum allowable column width.
-
setSelectedRow(int)
- Sets the specified row as the selected row.
-
update(Graphics)
- Handles redrawing of this component on the screen.
CLICKTHRESHOLD
public final static long CLICKTHRESHOLD
- Maximum time inverval to register a double click (in milliseconds).
LEFT
public final static int LEFT
- Left-justify column alignment constant.
CENTER
public final static int CENTER
- Center-justify column alignment constant.
RIGHT
public final static int RIGHT
- Right-justify column alignment constant.
isSun1_1
protected boolean isSun1_1
MultiList
public MultiList()
- Default constructor for MultiList.
MultiList
public MultiList(int cols)
- Constructs a new MultiList with the specified number of columns.
- Parameters:
- cols - the number of columns
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
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
selectAll
public void selectAll()
- Selects all the elements in the MuliList. Multiple select must be
enabled for this to have any effect.
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
getNumberOfRows
public int getNumberOfRows()
- Gets the current number of columns.
- Returns:
- the current number of columns
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
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
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.
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
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
setHeadingFont
public void setHeadingFont(Font f)
- Sets the font for column heading text.
- Parameters:
- f - the font for heading text
- See Also:
- getHeadingFont
getHeadingFont
public Font getHeadingFont()
- Returns the font for column heading text.
- See Also:
- setHeadingFont
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
getCellFont
public Font getCellFont()
- Returns the font currently used for text in all the cells.
- See Also:
- setCellFont
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
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
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
getHeadingFg
public Color getHeadingFg()
- Returns the color of the column heading text foreground.
- Returns:
- the current column heading foreground color
- See Also:
- setHeadingFg
getHeadingBg
public Color getHeadingBg()
- Returns the color of the column heading text background.
- Returns:
- the current column heading background color
- See Also:
- setHeadingBg
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
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
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
getCellFg
public Color getCellFg()
- Gets the current foreground color of cell text.
- Returns:
- the current cell foreground color
- See Also:
- setCellFg
getCellBg
public Color getCellBg()
- Gets the current background color of cell text.
- Returns:
- the current cell background color
- See Also:
- setCellBg
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
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
getColumnSizes
public String[] getColumnSizes()
- Returns a string array containing the width of each column in pixels.
- See Also:
- setColumnSizes
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
getColumnSize
public int getColumnSize(int i)
- Get the column width, in pixels, for the specified column.
- Parameters:
- i - the zero-relative column index
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
getNumberOfCols
public int getNumberOfCols()
- Returns the current number of columns.
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
getSelectedRow
public int getSelectedRow()
- Returns the zero-relative index of the currently selected row.
- See Also:
- setSelectedRow
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
setMinColumnWidth
public void setMinColumnWidth(int size)
- Sets the minimum allowable column width.
- Parameters:
- size - the minimum column width in pixels
- See Also:
- getMinColumnWidth
getMinColumnWidth
public int getMinColumnWidth()
- Returns the minimum allowable column width in pixels.
- See Also:
- setMinColumnWidth
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
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
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
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
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
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
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
clear
public void clear()
- Removes all rows from the MultiList.
- See Also:
- removeRow
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
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
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
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
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
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
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
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
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
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
redraw
public void redraw()
- Paints this component into an offscreen image for cleaner screen repaints.
It is not typically called directly.
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
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
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
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