com.retek.commons.gui.widget
Class RComboBox

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JComboBox
                  extended bycom.retek.commons.gui.widget.RComboBox
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.ItemSelectable, java.awt.event.KeyListener, javax.swing.event.ListDataListener, java.awt.MenuContainer, java.io.Serializable, WidgetInterface

public class RComboBox
extends javax.swing.JComboBox
implements java.awt.event.KeyListener, WidgetInterface

This class sublcasses the standard JComboBox class in the Swing package to provide custom functionality for the Rcom client application. The popup window is made visible by hitting the SPACE key.

Retek Inc. Copyright (c) 2002

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComboBox
javax.swing.JComboBox.AccessibleJComboBox, javax.swing.JComboBox.KeySelectionManager
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JComboBox
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, selectedItemReminder
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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
RComboBox()
          Returns new RComboBox object.
 
Method Summary
 void clear()
          Removes all items from the combo box.
 java.lang.String getClusterName()
          Retrieves the cluster name of the widget.
 java.lang.Object getItemAt(int index)
          Retrieves the currently selected item.
 boolean getRequired()
          Retrieves whether or not a selection is required in the combo box.
 java.lang.String getSelectedDescription()
          Retrieves the description of the selected item.
 java.lang.Object getSelectedItem()
          Retrieves the currently selected item.
 java.lang.Object[] getSelectedObjects()
          Returns an array containing the selected item.
 java.lang.Object getType()
          Retrieves the type assigned to the combo box.
 boolean isEmptySelection()
          Retrieves whether or not there is a selection.
 boolean isErrorState()
          Retrieves whether or not the combo box is in an error state.
 boolean isModified()
          Retrieves whether or not the combo box has been modified since its previous state.
 void keyPressed(java.awt.event.KeyEvent event)
          Empty implementation of the KeyListener method.
 void keyReleased(java.awt.event.KeyEvent event)
          Displays the popup selection window after the SPACE key has been pressed and released.
 void keyTyped(java.awt.event.KeyEvent event)
          Empty implementation of the KeyListener method.
 void removeEmptySelection()
          Removes the empty selection from the combo box.
 void resetModified()
          Resets the modified state of the combo box to not modified.
 void setBackground(java.awt.Color color)
           
 void setClusterName(java.lang.String clusterName)
          Sets the cluster name of the widget.
 void setDefaultSize(int width, int height, int rows)
          Sets the minimum and preferred width and height of the combo box as well as the number of rows to display in its popup window.
 void setEmptySelection()
          Sets the current selection in the combo box to the empty selection.
 void setErrorState(boolean errorState)
          Sets the error state of the combo box - changing the color of the background and foreground.
 void setFocusedState()
          Sets the combo box to focused state.
 void setForeground(java.awt.Color color)
           
 void setItems(java.util.Collection collection)
          Assigns a series of objects in a collection to the combo box.
 void setItems(java.lang.Object[] array)
          Assigns a series of objects in an array to the combo box.
 void setMinimumSize(int width, int height)
          Sets the minimum and preferred width and height of the combo box.
 void setMinimumWidth(int width)
          Sets the minimum width of the combo box.
 void setRequired(boolean isRequired)
          Sets whether or not a selection is required in the combo box.
 void setSelectedIndex(int index)
          Sets the selected index in the combo box.
 void setSelectedItem(java.lang.Object object)
          Sets the selected item in the combo box.
 void setType(java.lang.Object object)
          Assigns a type to the combo box.
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, addActionListener, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeActionListener, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setUI, showPopup, 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, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.retek.commons.gui.core.WidgetInterface
getName, setName
 

Constructor Detail

RComboBox

public RComboBox()
Returns new RComboBox object.

Method Detail

setMinimumWidth

public void setMinimumWidth(int width)
Sets the minimum width of the combo box.

Parameters:
width - The minimum width in pixels to assign to the combo box.

setMinimumSize

public void setMinimumSize(int width,
                           int height)
Sets the minimum and preferred width and height of the combo box.

Parameters:
width - The width in pixels to assign to the combo box.
height - The height in pixels to assign to the combo box.

setDefaultSize

public void setDefaultSize(int width,
                           int height,
                           int rows)
Sets the minimum and preferred width and height of the combo box as well as the number of rows to display in its popup window.

Parameters:
width - The width in pixels to assign to the combo box.
height - The height in pixels to assign to the combo box.
rows - The number of rows to display in the popup window.

setRequired

public void setRequired(boolean isRequired)
Sets whether or not a selection is required in the combo box.

Parameters:
isRequired - True if a selection is required, false if not.

getRequired

public boolean getRequired()
Retrieves whether or not a selection is required in the combo box.

Returns:
True if a selection is required, false if not.

setType

public void setType(java.lang.Object object)
Assigns a type to the combo box.

Parameters:
object - An object to indicate the type of the combo box.

getType

public java.lang.Object getType()
Retrieves the type assigned to the combo box.

Returns:
The type associated to the combo box.

getSelectedDescription

public java.lang.String getSelectedDescription()
Retrieves the description of the selected item.

Returns:
The description of the selected object, or an empty string if none is selected.

getSelectedItem

public java.lang.Object getSelectedItem()
Retrieves the currently selected item. Note: If this item is EMPTY_SELECTION, then null should be returned.

Returns:
The selected object, or null if none is selected (or EMPTY_SELECTION is selected).

getItemAt

public java.lang.Object getItemAt(int index)
Retrieves the currently selected item. Note: If this item is EMPTY_SELECTION, then null should be returned.

Parameters:
index - - an integer indicating the list position, where the first item starts at zero
Returns:
The object located at the index, or null if none is selected (or EMPTY_SELECTION is selected).

getSelectedObjects

public java.lang.Object[] getSelectedObjects()
Returns an array containing the selected item. This method is implemented for compatibility with ItemSelectable.

Specified by:
getSelectedObjects in interface java.awt.ItemSelectable
Returns:
An object array of the selected objects.

setItems

public void setItems(java.util.Collection collection)
Assigns a series of objects in a collection to the combo box. This removes all the current items from the combo box and then assigns the new items in sequence. If more than one item is added (or none), then a blank item is included as the first option.

NOTE!!!!!! This method will NOT (!!!!) trigger the notification of the item that was selected. Do not rely on the standard SWING notification from the combo box when you add items and the first in the list is selected.

Parameters:
collection - A collection of objects.

setItems

public void setItems(java.lang.Object[] array)
Assigns a series of objects in an array to the combo box. This removes all the current items from the combo box and then assigns the new items in sequence. If more than one item is added (or none), then a blank item is included as the first option.

NOTE!!!!!! This method will NOT (!!!!) trigger the notification of the item that was selected. Do not rely on the standard SWING notification from the combo box when you add items and the first in the list is selected.

Parameters:
array - An array of objects.

setSelectedItem

public void setSelectedItem(java.lang.Object object)
Sets the selected item in the combo box. This will remove EMPTY_SELECTION if the combo box is a required value and something other than EMPTY_SELECTION has been selected.

Parameters:
object - The object to select in the combo box.

setSelectedIndex

public void setSelectedIndex(int index)
Sets the selected index in the combo box. This will remove EMPTY_SELECTION if the combo box is a required value and something other than EMPTY_SELECTION has been selected.

Parameters:
index - The index to select in the combo box.

setEmptySelection

public void setEmptySelection()
Sets the current selection in the combo box to the empty selection.


isEmptySelection

public boolean isEmptySelection()
Retrieves whether or not there is a selection.

Returns:
true if no selection exists and false if a selection exists.

removeEmptySelection

public void removeEmptySelection()
Removes the empty selection from the combo box.


clear

public void clear()
Removes all items from the combo box.


keyPressed

public void keyPressed(java.awt.event.KeyEvent event)
Empty implementation of the KeyListener method.

Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent event)
Displays the popup selection window after the SPACE key has been pressed and released. It must wait until released or the release event closes the window.

Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent event)
Empty implementation of the KeyListener method.

Specified by:
keyTyped in interface java.awt.event.KeyListener

setClusterName

public void setClusterName(java.lang.String clusterName)
Sets the cluster name of the widget. A cluster name associates a group of widgets.

Specified by:
setClusterName in interface WidgetInterface
Parameters:
clusterName - The cluster name to assign to the widget.

getClusterName

public java.lang.String getClusterName()
Retrieves the cluster name of the widget.

Specified by:
getClusterName in interface WidgetInterface

isModified

public boolean isModified()
Retrieves whether or not the combo box has been modified since its previous state.

Returns:
True if the combo box has been modified since its previous state, false if not.

resetModified

public void resetModified()
Resets the modified state of the combo box to not modified.


setBackground

public void setBackground(java.awt.Color color)
See Also:
in JComboBox.

setForeground

public void setForeground(java.awt.Color color)
See Also:
in JComboBox.

isErrorState

public boolean isErrorState()
Retrieves whether or not the combo box is in an error state.

Specified by:
isErrorState in interface WidgetInterface
Returns:
True if the combo box is in an error state, false if not

setFocusedState

public void setFocusedState()
Sets the combo box to focused state. Guarantees that an empty selection is colored the proper focus color by selecting it.

Specified by:
setFocusedState in interface WidgetInterface

setErrorState

public void setErrorState(boolean errorState)
Sets the error state of the combo box - changing the color of the background and foreground.

Specified by:
setErrorState in interface WidgetInterface
Parameters:
errorState - True if the combo box is in an error state, false if not. /


Copyright © 2004 Retek Inc. All Rights Reserved. - Generated at Fri, 10/22/2004 07:28