planetj.gui
Class CMListJ

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JList
                          |
                          +--planetj.gui.CMListJ
All Implemented Interfaces:
Accessible, EventListener, ImageObserver, ListSelectionListener, MenuContainer, PropertyChangeListener, Scrollable, Serializable

public class CMListJ
extends JList
implements PropertyChangeListener, ListSelectionListener

Common Swing JComboBox that provides I18N and business object support.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.JList
HORIZONTAL_WRAP, VERTICAL, VERTICAL_WRAP
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
CMListJ()
          Insert the method's description here.
CMListJ(ListModel dataModel)
          CMListJ constructor comment.
CMListJ(Object[] listData)
          CMListJ constructor comment.
CMListJ(Vector listData)
          CMListJ constructor comment.
 
Method Summary
 void addBusinessObject(Object obj)
          Adds a business object into the business object vector Creation date: (8/8/00 12:11:03 PM)
 List getBusinessObjects()
          Returns a List of businessObjects
 String getGetterMethod()
          Gets the getterMethod String.
 List getItems()
          Gets the Items in a List of Strings that has been translated.
 List getOriginalStrings()
          Return a List of Strings that are the pre-translated Strings displayed in this component.
 Object getSelectedBusinessObject()
          Return a businessObject that is being selected from the ComboBox
 String getSelectedBusinessObjectAsString()
          Return a businessObject that is being selected from the ComboBox as a String
 List getSelectedBusinessObjects()
          Return a businessObject that is being selected from the ComboBox
 String getSelectedId()
          Gets the selected translationId.
 String getSelectedOriginalString()
          Return the original (pre - translation) string that is currently being selected.
 boolean isAutoReloadBusinessObjectsOnPropertyChangeEnabled()
          isAutoReloadBusinessObjectsOnPropertyChangeEnabled method tells whether or not to reload the business objects in the list if a property change occurs from one of the business objects in the list.
 boolean isEmpty()
           
 boolean isMoveDownEnabled()
          This method will return false if the selected business object = the last element of the vector else it will return true
 boolean isMoveUpEnabled()
          This method will return false if the selected business object = 0 else it will return true
static void main(String[] args)
          main entrypoint - starts the part when it is run as an application
 void propertyChange(PropertyChangeEvent evt)
          propertyChange processes property changes for the items that this class is listening to.
 void refresh()
          This method derives the strings from the getter methods via reflection and displays them in the list.
 void removeAllBusinessObjects()
          Removes a business object from the business object vector Creation date: (8/8/00 12:11:03 PM)
 void removeBusinessObject(Object obj)
          Removes a business object from the business object collection Creation date: (8/8/00 12:11:03 PM)
 void setAutoReloadBusinessObjectsOnPropertyChangeEnabled(boolean value)
          setAutoReloadBusinessObjectsOnPropertyChangeEnabled method sets whether or not to reload the business objects in the list if a property change occurs from one of the business objects in the list.
 void setBusinessObjects(List businessObjects)
          Set a Collection of business objects into the component.
 void setGetterMethod(String getterMethod)
          Set a methodName to be used to query a business objects for a String that will be used as the items within a JComboBox.
 void setListData(List newItems)
          Translate the Vector of Strings and then set the translated Strings in the component.
 void setListDataDirectly(List stringList)
          Add a Vector of Strings to the ComboBox directly.
 void setPropertyChangeListeners(IPropertyChangeSource propertyChangeObject, boolean addListeners)
          This method was added during performance enhancements.
 void setRetainSelectedIndices(boolean value)
          setRetainSelectedIndices sets whether or not retain selected indices is needed.
 void setSelectedBusinessObject(Object selectedBusinessObject)
          Sets item selected in the comboBox to the businessObject passed in
 void setSelectedBusinessObjects(List selBusinessObjects)
          Sets item selected in the comboBox to the businessObject passed in
 void setSelectedId(String translationId)
          Sets the selected translationId.
 void setSelectedOriginalString(String originalString)
          Set the comboBox's selected index to the position occupied by the originalString
 void valueChanged(ListSelectionEvent e)
          Method to handle events for the ListSelectionListener interface.
 
Methods inherited from class javax.swing.JList
addListSelectionListener, addSelectionInterval, clearSelection, ensureIndexIsVisible, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getCellRenderer, getDragEnabled, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, removeListSelectionListener, removeSelectionInterval, setCellRenderer, setDragEnabled, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setModel, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setSelectionModel, setUI, setValueIsAdjusting, setVisibleRowCount, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CMListJ

public CMListJ()
Insert the method's description here. Creation date: (12/18/99 11:09:48 AM)


CMListJ

public CMListJ(Object[] listData)
CMListJ constructor comment.

Parameters:
listData - java.lang.Object[]

CMListJ

public CMListJ(Vector listData)
CMListJ constructor comment.

Parameters:
listData - java.util.Vector

CMListJ

public CMListJ(ListModel dataModel)
CMListJ constructor comment.

Parameters:
dataModel - javax.swing.ListModel
Method Detail

addBusinessObject

public void addBusinessObject(Object obj)
Adds a business object into the business object vector Creation date: (8/8/00 12:11:03 PM)

Parameters:
obj - java.lang.Object

getBusinessObjects

public List getBusinessObjects()
Returns a List of businessObjects


getGetterMethod

public String getGetterMethod()
Gets the getterMethod String. This method is used to query the businessObjects for a displayable String.

Returns:
The getterMethod String value.
See Also:
setGetterMethod(java.lang.String)

getItems

public List getItems()
Gets the Items in a List of Strings that has been translated.

Returns:
the List of Strings that has been translated.

getOriginalStrings

public List getOriginalStrings()
Return a List of Strings that are the pre-translated Strings displayed in this component.


getSelectedBusinessObject

public Object getSelectedBusinessObject()
Return a businessObject that is being selected from the ComboBox


getSelectedBusinessObjectAsString

public String getSelectedBusinessObjectAsString()
Return a businessObject that is being selected from the ComboBox as a String


getSelectedBusinessObjects

public List getSelectedBusinessObjects()
Return a businessObject that is being selected from the ComboBox


getSelectedId

public String getSelectedId()
Gets the selected translationId.

Returns:
the translationId of the currently selected translation as a String.

getSelectedOriginalString

public String getSelectedOriginalString()
Return the original (pre - translation) string that is currently being selected.


isAutoReloadBusinessObjectsOnPropertyChangeEnabled

public boolean isAutoReloadBusinessObjectsOnPropertyChangeEnabled()
isAutoReloadBusinessObjectsOnPropertyChangeEnabled method tells whether or not to reload the business objects in the list if a property change occurs from one of the business objects in the list.

Returns:
boolean

isEmpty

public boolean isEmpty()
Returns:
boolean

isMoveDownEnabled

public boolean isMoveDownEnabled()
This method will return false if the selected business object = the last element of the vector else it will return true

Returns:
boolean

isMoveUpEnabled

public boolean isMoveUpEnabled()
This method will return false if the selected business object = 0 else it will return true

Returns:
boolean

main

public static void main(String[] args)
main entrypoint - starts the part when it is run as an application

Parameters:
args - java.lang.String[]

propertyChange

public void propertyChange(PropertyChangeEvent evt)
propertyChange processes property changes for the items that this class is listening to.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - java.beans.propertyChangeEvent

refresh

public void refresh()
This method derives the strings from the getter methods via reflection and displays them in the list. Creation date: (9/6/2001 4:50:06 PM)


removeAllBusinessObjects

public void removeAllBusinessObjects()
Removes a business object from the business object vector Creation date: (8/8/00 12:11:03 PM)


removeBusinessObject

public void removeBusinessObject(Object obj)
Removes a business object from the business object collection Creation date: (8/8/00 12:11:03 PM)

Parameters:
obj - java.lang.Object

setAutoReloadBusinessObjectsOnPropertyChangeEnabled

public void setAutoReloadBusinessObjectsOnPropertyChangeEnabled(boolean value)
setAutoReloadBusinessObjectsOnPropertyChangeEnabled method sets whether or not to reload the business objects in the list if a property change occurs from one of the business objects in the list.

Parameters:
value - boolean

setBusinessObjects

public final void setBusinessObjects(List businessObjects)
Set a Collection of business objects into the component. All objects are assumed to be of the same Class. The method depends on having the getter method set. The getter method is used to dynamically query the business objects and return a List of strings to be used as the list elements in this component.


setGetterMethod

public void setGetterMethod(String getterMethod)
Set a methodName to be used to query a business objects for a String that will be used as the items within a JComboBox. This methodName must match a method in the business object class. It does not need the () at the end. For example: Consider the need to select from a list of ExtractField objects, this CMComboBoxJ would be set as follows. aCMComboxBoxJ.setGetterMethod("getName"); aCMComboxBoxJ.setBusinessObjects(someVectorOfExtractFields);


setListData

public void setListData(List newItems)
Translate the Vector of Strings and then set the translated Strings in the component.


setListDataDirectly

public void setListDataDirectly(List stringList)
Add a Vector of Strings to the ComboBox directly. Assumes translation has already been done or is not needed.


setPropertyChangeListeners

public void setPropertyChangeListeners(IPropertyChangeSource propertyChangeObject,
                                       boolean addListeners)
This method was added during performance enhancements. It allows an object to be passed in, then the list will become a listener on the object. The main purpose for this method is to allow subclasses to override this method for setting specific listener properties on specific objects.

Parameters:
propertyChangeObject - IPropertyChangeSource object to add or remove listener(s) from
addListeners - boolean flag to indicate whether to add (true) or remove (false) listener(s) from object %WK 2-14-2001

setRetainSelectedIndices

public void setRetainSelectedIndices(boolean value)
setRetainSelectedIndices sets whether or not retain selected indices is needed.

Parameters:
value - boolean

setSelectedBusinessObject

public void setSelectedBusinessObject(Object selectedBusinessObject)
Sets item selected in the comboBox to the businessObject passed in


setSelectedBusinessObjects

public void setSelectedBusinessObjects(List selBusinessObjects)
Sets item selected in the comboBox to the businessObject passed in


setSelectedId

public void setSelectedId(String translationId)
Sets the selected translationId.

Parameters:
translationId - the String that identifies the translation to be selected within the Choice.

setSelectedOriginalString

public void setSelectedOriginalString(String originalString)
Set the comboBox's selected index to the position occupied by the originalString


valueChanged

public void valueChanged(ListSelectionEvent e)
Method to handle events for the ListSelectionListener interface.

Specified by:
valueChanged in interface ListSelectionListener
Parameters:
e - javax.swing.event.ListSelectionEvent