Package wt.clients.util
Class WTMultiList
java.lang.Object
wt.clients.util.WTMultiList
- All Implemented Interfaces:
ItemListener,EventListener
- Direct Known Subclasses:
WTList
WTMultiList is a multi column list which fixes bugs found in
symantec.itools.awt.MultiList. Most of the fixes involve improving
the display appearance on UNIX clients. It is possible to use this class
in place of using the symantec.itools.awt.MultiList.
WTMultiList can also be configured to display attributes of modeled
Windchill business objects, such as Parts, Documents, etc in a multi column
list. When taking advantage of this feature of WTMultiList,
it is necessary to specify the class and attributes that will be used by
the display methods. A wt.clients.beans.query.WTSchema object
is used to specify the class and attributes used by WTMultiList
for displaying Windchill business objects. The attributes defined by the
WTSchema object are used to obtain the column headings and values
for the cells within a column. Methods that allow adding/obtaining modeled
Windchill business objects are included in this class. An icon representing
the object associated with a particular row is always displayed in the
first column.
An example of using the WTMultiList to display modeled Windchill
business objects is presenting the results of a database search to the user.
After performing the database search, the objects obtained can be added to
a WTMultiList object for later selection by the user.
WTMultiList can be configured in single and multi-select mode.
The user cannot type or edit a selection in a WTMultiList.
The user can resize a column at run-time by dragging the column boundary
to a new position.
The following code demonstrates creating a WTMultiList in a Frame:
Frame f = new Frame();
f.setSize(400,200);
WTMultiList multi_list = new WTMultiList();
// Create a schema to display Name, Version and Description of
// objects with class wt.doc.WTDocument
WTSchema schema = new WTSchema("C:wt.doc.WTDocument; D:name; D:versionIdentifier; D:description;");
multi_list.setSchema(schema);
f.add(multi_list);
f.show();
Supported API: true
Extendable: false
- See Also:
-
symantec.itools.awt.MultiList
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new WTMultiList.WTMultiList(int cols) Constructs a new WTMultiList with the specified number of columns.WTMultiList(int cols, boolean multi) Constructs a new WTMultiList with the spcified number of columns and whether multiple row selection allowed.WTMultiList(int cols, boolean multi, Color bg) Constructs a new WTMultiList with the specified number of columns, whether multiple row selection is allowed, and given background color. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the specified item listener to receive item events from this list.Add a modeled Windchill business object to theWTMultiList.voidAdds a listener for all property change events.voidAdds a listener for all vetoable property change events.static StringescapeColumnSeparator(String item) Escape special characters within the column text of a WTMultiList row.String[]Returns the text contents of all the cells as a string array.getObject(int a_row) Returns the object at a particular row.intgetObjectRow(WTObject an_object) Returns the number of the row containing a particular object.String[]This is the public getter that will return an array of strings representing the relative widths of each column.Returns the currently selected object.Object[]Returns the currently selected array of objects.voidThis method should be called after the multilist is visible.voidRemoves the specified item listener from this list.voidRemoves a listener for all property change events.voidRemoves a listener for all vetoable property change events.voidsetListItems(String[] items) Takes an array of Strings and puts them into a WTMultiList.voidsetRelativeColumnWidths(String[] widths) Sets therelativeColumnWidthsproperty.voidupdateObject(WTObject an_object) Obtain new display values from the specified modeled Windchill business object.
-
Constructor Details
-
WTMultiList
public WTMultiList()Constructs a new WTMultiList.
Supported API: true -
WTMultiList
public WTMultiList(int cols) Constructs a new WTMultiList with the specified number of columns.
Supported API: true- Parameters:
cols- the number of columns
-
WTMultiList
public WTMultiList(int cols, boolean multi) Constructs a new WTMultiList with the spcified number of columns and whether multiple row selection allowed.
Supported API: true- Parameters:
cols- the number of columnsmulti- true for multiple row selection, false otherwise
-
WTMultiList
Constructs a new WTMultiList with the specified number of columns, whether multiple row selection is allowed, and given background color.
Supported API: true- Parameters:
cols- the number of columnsmulti- true for multiple row selection, false otherwisebg- the background color
-
-
Method Details
-
setRelativeColumnWidths
Sets therelativeColumnWidthsproperty. Pass an array of Strings that can be converted to ints. Use 1 to give that column a column width of 1 relative to the width of the whole table. Pass 0 for a hidden column. A value of 2 will create a column twice the width of the column with a value of 1.
Supported API: true- Parameters:
widths- the relative width for each column- Throws:
PropertyVetoException- if an error occurs setting the column sizes
-
getRelativeColumnWidths
This is the public getter that will return an array of strings representing the relative widths of each column. A value of 0 represents a hidden column. A value of 2 represents a column twice the width of the column with a value of 1.
Supported API: true- Returns:
- an array of relative column widths
-
redrawColumns
This method should be called after the multilist is visible. It will calculate the new width of theWTMultiListand then distribute the widths to the columns based on that width. No column will be smaller than theminColumnWidth.
Supported API: true- Throws:
PropertyVetoException- if an error occurs setting the column sizes
-
addItemListener
Adds the specified item listener to receive item events from this list.
Supported API: true- Parameters:
l- the item listener.
-
removeItemListener
Removes the specified item listener from this list.
Supported API: true- Parameters:
l- the item listener.
-
getObjectRow
Returns the number of the row containing a particular object.
Supported API: true- Parameters:
an_object- the object whose row number is to be found.- Returns:
- the number of the row containing a particular object.
-
getObject
Returns the object at a particular row.
Supported API: true- Parameters:
a_row- the row of the object.- Returns:
- the object at the specified row.
-
getSelectedObject
Returns the currently selected object.
Supported API: true- Returns:
- the currently selected object.
-
getSelectedObjects
Returns the currently selected array of objects.
Supported API: true- Returns:
- an array of currently selected objects.
-
addObject
Add a modeled Windchill business object to theWTMultiList. If the object is already in the list, the object will be updated to reflect the new values.
Supported API: true- Parameters:
an_object- the modeled Windchill business object to add.- Returns:
- true if the object is already in the list, otherwise false.
-
updateObject
Obtain new display values from the specified modeled Windchill business object.
Supported API: true- Parameters:
an_object- the object to be refreshed.
-
escapeColumnSeparator
Escape special characters within the column text of a WTMultiList row. Each row of a list is represented by a string and colums within the row are separated by a semicolon, so if the column text contains a semicolon, it must be escaped. Also escape the escape character ("\").
Supported API: true- Parameters:
item- the column item to be escaped
-
setListItems
Takes an array of Strings and puts them into a WTMultiList. Each element of the array denotes a row in the WTMultiList. Semicolons";" denote new cells. Escaped semicolons "\;" are included in the cell text as semicolons ";".
Supported API: true- Parameters:
items- the text to be displayed in the WTMultiList- Throws:
PropertyVetoException
-
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:
-
addPropertyChangeListener
Adds a listener for all property change events.- Parameters:
listener- the listener to add- See Also:
-
removePropertyChangeListener
Removes a listener for all property change events.- Parameters:
listener- the listener to remove- See Also:
-
addVetoableChangeListener
Adds a listener for all vetoable property change events.- Parameters:
listener- the listener to add- See Also:
-
removeVetoableChangeListener
Removes a listener for all vetoable property change events.- Parameters:
listener- the listener to remove- See Also:
-