wt.clients.util
Class WTMultiList

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bysymantec.itools.awt.MultiList
                  extended bywt.clients.util.WTMultiList
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, ItemListener, ItemSelectable, MenuContainer, Serializable
Direct Known Subclasses:
FraSelectFvDomain.FVWTMultiList, FvMultiList, SiteManager.AdjustableWTMultiList, WTList, WTList, WTList

public class WTMultiList
extends symantec.itools.awt.MultiList
implements ItemListener

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:
MultiList, #wt.clients.beans.query.WTSchema, Serialized Form

Nested Class Summary
 
Nested classes inherited from class symantec.itools.awt.MultiList
 
Nested classes inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  symantec.itools.beans.PropertyChangeSupport changes
           
private  boolean isSchemaAssigned
           
private  ItemListener itemListener
           
private  Vector itemListenerVector
           
private  WTObject[] myLastObj
           
private  WTObject[] myNewObj
           
private  WTSchema mySchema
           
private  ReferenceDelegateFactory referenceDelegateFactory
           
private  String[] relativeColumnWidths
           
private  symantec.itools.beans.VetoableChangeSupport vetos
           
 
Fields inherited from class symantec.itools.awt.MultiList
actionCommand, actionListener, allowResizingOfColumns, allowSorting, BORDER, cachedHeight, cachedLastSplitter, cachedWidth, cellAscent, cellDescent, cellFont, cellHeight, cells, CENTER, clickedInHeadings, CLICKTHRESHOLD, clickTime, colorBg, colorFg, colorHBg, colorHFg, columnAlignments, columnClicked, columnCompareCellsRoutines, columnSizes, defaultColumnAlignment, defaultColumnSorter, dragColumn, errors, focusIndicatedVisually, focusListener, forceColumnSizeRecalc, forceFullRedraw, forceRedraw, hasFocus, headingBg, headingFg, headingFont, headingHeight, headings, headingVisible, highlightedRows, horizontalScrollbar, hScrollbarLineIncrement, isDragging, isSun1_1, isSuppressRedraw, lastColumnClicked, LEFT, memoryClick, minColumnWidth, multiSelect, offscreenImage, offscreenImageGraphics, redrawWasSupressed, RESIZE_FUDGE_FACTOR, RIGHT, sbHPosition, sbHShow, sbVPosition, sbVShow, scrollbarHeight, selectedRow, splitters, topRow, verticalScrollbar, verticalScrollbarWidth, xDragLast
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WTMultiList()
          Constructs 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
 void addItemListener(ItemListener l)
          Adds the specified item listener to receive item events from this list.
 WTObject addObject(WTObject an_object)
          Add a modeled Windchill business object to the WTMultiList.
 void addObjects(WTObject[] aObjects)
          Add the specified WTObject array to the list
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener for all property change events.
 void addVetoableChangeListener(VetoableChangeListener listener)
          Adds a listener for all vetoable property change events.
 void addWTCellImpl(int row, int column, symantec.itools.awt.multiList.Cell cell)
          Adds a cell to the MultiList in the row and column specified.
protected  void drawRows(int cell_row, int num_rows_to_draw, boolean to_repaint)
          Draws the specifed rows into an offscreen image.
static String escapeColumnSeparator(String item)
          Escape special characters within the column text of a WTMultiList row.
 String[] getListItems()
          Returns the text contents of all the cells as a string array.
 int getNumberOfRows()
          Gets the current number of rows.
 WTObject getObject(int a_row)
          Returns the object at a particular row.
 int getObjectRow(WTObject an_object)
          Returns the number of the row containing a particular object.
private  ReferenceDelegateFactory getReferenceDelegateFactory()
          Returns the ReferenceDelegateFactory

Supported API: false
 String[] getRelativeColumnWidths()
          This is the public getter that will return an array of strings representing the relative widths of each column.
 WTObject getSelectedObject()
          Returns the currently selected object.
 Object[] getSelectedObjects()
          Returns the currently selected array of objects.
 WTCell getWTCell(int a_row)
          Returns the cell at a particular row.
private  boolean isDuplicateObject(WTObject an_object)
          Returns true if the specified object is already displayed in the list.
 void itemStateChanged(ItemEvent e)
          itemStateChanged is used to make event processing work similiar to how the JFC TreeView and JFC MultiList work.
static void main(String[] args)
           
private  void processEvent(ItemEvent aEvent)
          Propagates the item event to current listeners.
 void redraw()
          Paints this component into an offscreen image for cleaner screen repaints.
 void redrawColumns()
          This method should be called after the multilist is visible.
 void removeItemListener(ItemListener l)
          Removes the specified item listener from this list.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a listener for all property change events.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Removes a listener for all vetoable property change events.
 void setListItems(String[] items)
          Takes an array of Strings and puts them into a WTMultiList.
 void setRelativeColumnWidths(String[] widths)
          Sets the relativeColumnWidths property.
 void setSchema(WTSchema aSchema)
          Set the schema to use.
 void sort()
           
 int totalObjects()
          Deprecated. Use getNumberOfRows instead.
 void updateObject(WTObject an_object)
          Obtain new display values from the specified modeled Windchill business object.
private  void updateRow(int row, WTObject an_object)
          Replace a particular row with values from another modeled Windchill business object.
 
Methods inherited from class symantec.itools.awt.MultiList
addActionListener, addCell, addCell, addCellImpl, addImageCell, addNotify, addTextCell, adjustHeadings, calcHeadings, calculateHeadingHeight, calcVerticalScrollbarPosition, changeSelection, clear, createColumns, deselectAll, deselectRow, draw3DBox, drawColumnHeading, drawHeading, getCellBg, getCellFg, getCellFont, getCellImage, getCellText, getColumnAlignment, getColumnAlignments, getColumnSize, getColumnSizes, getColumnSizesFromSplitters, getColumnSorter, getDefaultColumnAlignment, getDefaultColumnSorter, getHeading, getHeadingBg, getHeadingFg, getHeadingFont, getHeadings, getMinColumnWidth, getNumberOfCols, getNumVisibleRows, getSelectedRow, getSelectedRows, intArrayToStringArray, internalCreateColumns, isAllowResizingOfColumns, isAllowSorting, isFocusIndicatedVisually, isFocusTraversable, isHeadingVisible, isMultipleMode, minimumSize, paint, paintSelection, preferredSize, rangeCheckAlignment, rangeCheckColumn, removeActionListener, removeNotify, removeRow, removeSelectionBorder, repaintFocus, resizeHeadings, selectAll, selectRow, setAllowResizingOfColumns, setAllowSorting, setCellBg, setCellColors, setCellFg, setCellFont, setColumnAlignment, setColumnAlignments, setColumns, setColumnSizes, setColumnSorter, setDefaultColumnAlignment, setDefaultColumnSorter, setFocusIndicatedVisually, setHeading, setHeading, setHeadingBg, setHeadingColors, setHeadingFg, setHeadingFont, setHeadings, setHeadingVisible, setLayout, setMinColumnWidth, setMultipleMode, setNumberOfCols, setSelectedRow, setSupressRedraw, sourceActionEvent, sourceItemEvent, tokenizeStringArrayIfNeeded, triggerRedraw, update
 
Methods inherited from class java.awt.Panel
getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, paintComponents, paramString, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

relativeColumnWidths

private String[] relativeColumnWidths

mySchema

private WTSchema mySchema

myNewObj

private WTObject[] myNewObj

myLastObj

private WTObject[] myLastObj

itemListener

private ItemListener itemListener

itemListenerVector

private Vector itemListenerVector

isSchemaAssigned

private boolean isSchemaAssigned

referenceDelegateFactory

private ReferenceDelegateFactory referenceDelegateFactory

vetos

private symantec.itools.beans.VetoableChangeSupport vetos

changes

private symantec.itools.beans.PropertyChangeSupport changes
Constructor Detail

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 columns
multi - true for multiple row selection, false otherwise

WTMultiList

public 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.

Supported API: true

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

setRelativeColumnWidths

public void setRelativeColumnWidths(String[] widths)
                             throws PropertyVetoException
Sets the relativeColumnWidths property. 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

public String[] 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

public void redrawColumns()
                   throws PropertyVetoException
This method should be called after the multilist is visible. It will calculate the new width of the WTMultiList and then distribute the widths to the columns based on that width. No column will be smaller than the minColumnWidth.

Supported API: true

Throws:
PropertyVetoException - if an error occurs setting the column sizes

drawRows

protected void drawRows(int cell_row,
                        int num_rows_to_draw,
                        boolean to_repaint)
Draws the specifed rows into an offscreen image. This method fixes a bug in the parent implementation of drawRows. If the very last entry in a MultiList is removed, selecting any other entry in the list will result in an IllegalArgumentException. This implementation provides a fix for this bug. This implementation was posted by Symantec and can be found by searching the Knowledge Base of their technical support for Visual Cafe for Java (search on multilist).

Supported API: false

Parameters:
cell_row - the zero-relative index of the first row to draw
num_rows_to_draw - the number of rows to draw
to_repaint - if true, calls the repaint method to update the screen

redraw

public void redraw()
Paints this component into an offscreen image for cleaner screen repaints. It is not typically called directly.

Supported API: false


addItemListener

public void addItemListener(ItemListener l)
Adds the specified item listener to receive item events from this list.

Supported API: true

Specified by:
addItemListener in interface ItemSelectable
Parameters:
l - the item listener.

removeItemListener

public void removeItemListener(ItemListener l)
Removes the specified item listener from this list.

Supported API: true

Specified by:
removeItemListener in interface ItemSelectable
Parameters:
l - the item listener.

processEvent

private void processEvent(ItemEvent aEvent)
Propagates the item event to current listeners.

Supported API: false


setSchema

public void setSchema(WTSchema aSchema)
Set the schema to use. The schema describes the Class and attributes that define the columns in the WTMultiList.

Supported API: false

See Also:
#wt.clients.beans.query.WTSchema

getNumberOfRows

public int getNumberOfRows()
Gets the current number of rows.

Supported API: false

Returns:
the current number of rows

totalObjects

public int totalObjects()
Deprecated. Use getNumberOfRows instead.

Gets the current number of rows.

Supported API: false

Returns:
the number of rows.
See Also:
getNumberOfRows()

getReferenceDelegateFactory

private ReferenceDelegateFactory getReferenceDelegateFactory()
                                                      throws WTException
Returns the ReferenceDelegateFactory

Supported API: false

Returns:
the Reference Delegate Factory.
Throws:
WTException - if an error occurs in obtaining the factory.

getObjectRow

public int getObjectRow(WTObject an_object)
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

public WTObject getObject(int a_row)
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

public WTObject getSelectedObject()
Returns the currently selected object.

Supported API: true

Returns:
the currently selected object.

getSelectedObjects

public Object[] getSelectedObjects()
Returns the currently selected array of objects.

Supported API: true

Specified by:
getSelectedObjects in interface ItemSelectable
Returns:
an array of currently selected objects.

isDuplicateObject

private boolean isDuplicateObject(WTObject an_object)
Returns true if the specified object is already displayed in the list.

Supported API: false

Parameters:
an_object - the object to check for duplicity.
Returns:
true if the object is already in the WTMultiList, otherwise false.

addObject

public WTObject addObject(WTObject an_object)
Add a modeled Windchill business object to the WTMultiList. 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.

addObjects

public void addObjects(WTObject[] aObjects)
Add the specified WTObject array to the list

Parameters:
aObjects - the array of objects to add to the details list

updateRow

private void updateRow(int row,
                       WTObject an_object)
Replace a particular row with values from another modeled Windchill business object.

Supported API: false

Parameters:
row - the row to replace.
an_object - the object to add to the specified row.

updateObject

public void updateObject(WTObject an_object)
Obtain new display values from the specified modeled Windchill business object.

Supported API: true

Parameters:
an_object - the object to be refreshed.

itemStateChanged

public void itemStateChanged(ItemEvent e)
itemStateChanged is used to make event processing work similiar to how the JFC TreeView and JFC MultiList work. It basically serializes all selection events as select and deselect event atoms(one at a time).

Supported API: false

Specified by:
itemStateChanged in interface ItemListener

sort

public void sort()

addWTCellImpl

public void addWTCellImpl(int row,
                          int column,
                          symantec.itools.awt.multiList.Cell cell)
Adds a cell to the MultiList in the row and column specified.

Supported API: false

Parameters:
row - the zero-relative row index
column - the zero-relative column index
cell - the cell that is being added to the MultiList

getWTCell

public WTCell getWTCell(int a_row)
Returns the cell at a particular row.

Supported API: false

Parameters:
a_row - the row of the cell.
Returns:
the cell at the specified row.

escapeColumnSeparator

public static String escapeColumnSeparator(String item)
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

public void setListItems(String[] items)
                  throws PropertyVetoException
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

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:


Supported API: true

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener for all property change events.

Parameters:
listener - the listener to add
See Also:


Supported API: true

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener for all property change events.

Parameters:
listener - the listener to remove
See Also:


Supported API: true

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Adds a listener for all vetoable property change events.

Parameters:
listener - the listener to add
See Also:


Supported API: true

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Removes a listener for all vetoable property change events.

Parameters:
listener - the listener to remove
See Also:


Supported API: true

main

public static void main(String[] args)