JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field
Class JCComboField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JComboBox
                          |
                          +--com.klg.jclass.field.JCComboField
All Implemented Interfaces:
Accessible, ActionListener, EventListener, ImageObserver, ItemSelectable, JCFieldComponent, ListDataListener, MenuContainer, Serializable
Direct Known Subclasses:
DSdbComboField, JBdbComboField, JCComboFieldCellEditor, JCComboFieldCellRenderer, JCPopupField

public class JCComboField
extends JComboBox
implements JCFieldComponent

JCComboField has all the capability of JComboBox, as well as the ability to validate its contents.

See Also:
JComboBox, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComboBox
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
protected  com.klg.jclass.field.Field field
           
protected  ListModel original_picklist
           
protected  String[] prefixList
           
protected  boolean required
           
static String version
          Contains the version number of the JClass product.
 
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 com.klg.jclass.field.JCFieldComponent
INVALID, UNDEREDIT, VALID
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JCComboField()
          Constructs a JCComboField.
JCComboField(Class c)
          Constructs an empty JCComboField which expects an object of the specified class.
JCComboField(Class c, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCComboField, which expects an object of the specified class and which uses the specified validator.
JCComboField(com.klg.jclass.util.value.JCValueModel m)
          Constructs an empty JCComboField, which uses the specified value model to contain its value.
JCComboField(com.klg.jclass.util.value.JCValueModel m, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCComboField, which uses the specified value model to contain its value and which uses the specified validator.
 
Method Summary
 void add(String item)
          Adds an item to the list.
 void addActionListener(ActionListener l)
          Adds an ActionListener.
 void addNotify()
          Initializes the field object.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener to the listener list.
 void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
          Adds a listener for changes to the value.
 void commitEdit()
          Commits the current field under edit.
protected  void createField(com.klg.jclass.field.validate.JCValidator validator)
           
 String getAbout()
          Gets the value of the About property.
 com.klg.jclass.field.DataProperties getDataProperties()
          Gets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 com.klg.jclass.field.JCInvalidInfo getInvalidInfo()
          Returns the Invalid properties.
protected  ListModel getOriginalPickList()
          Gets the original pick list.
 ListModel getPickList()
          Gets the current pick list.
 String[] getPrefixList()
          Returns the value of PrefixList.
 boolean getSelectOnEnter()
          Returns a flag indicating the selection status on entering the field.
 int getState()
          Returns the state of the component: one of VALID, INVALID, or UNDER_EDIT.
protected  JTextField getTextFieldEditor()
          Convenience method that returns the TextField Editor Component.
 com.klg.jclass.field.validate.JCValidator getValidator()
          Returns the validator currently in use.
 Object getValue()
          Returns the value for the combo field.
 com.klg.jclass.util.value.JCValueModel getValueModel()
          Returns the data model being used by the field.
 boolean isAutoAppend()
          Returns true if the field has autoAppend turned on.
 boolean isAutoComplete()
          Returns true if the field has autoComplete turned on.
 boolean isAutoRefinement()
          Returns true if the field has autoRefinement turned on.
 boolean isAutoSuggest()
          Returns true if the field has autoSuggest turned on.
 boolean isRequired()
          Returns true if the field is required.
 void removeActionListener(ActionListener l)
          Removes an ActionListener.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a PropertyChangeListener from the listener list.
 void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
          Removes a listener for changes to the value.
protected  void restoreOriginalPickList()
          Restores picklist to its original (could have been modified through AutoRefinement).
 void setAbout(String s)
          Sets the value of the About property.
 void setAutoComplete(boolean autoComplete, boolean autoAppend, boolean autoSuggest, boolean autoRefinement, String[] prefixList)
          Sets the autoComplete property and its corresponding attributes.
 void setBackground(Color background)
          Sets the background of the combo field.
 void setDataProperties(com.klg.jclass.field.DataProperties dp)
          Sets the Bean property which wraps the validator, data model, and Field objects properties into one property.
 void setForeground(Color foreground)
          Sets the foreground of the combo field.
 void setInvalidInfo(com.klg.jclass.field.JCInvalidInfo info)
          Sets the Invalid properties.
 void setItems(String[] items)
          Sets the list of choices.
 void setLocale(Locale l)
          Sets the locale being used by the combo field.
 void setPickList(ListModel picklist)
          Sets the pick list (may have been modified through AutoRefinement).
 void setRequired(boolean required)
          Sets the required property for the current field.
 void setSelectOnEnter(boolean select)
          Sets a flag to determine whether the value in the field is selected when the component gains focus.
protected  void setTemporaryPickList(ListModel picklist)
          Sets a temporary pick list (for AutoRefinement feature of AutoComplete).
 void setUI(ComboBoxUI ui)
          Sets the look and feel for this component.
 void setValidator(com.klg.jclass.field.validate.JCValidator v)
          Sets the validator to use.
 void setValue(Object value)
          Sets the value for the combo field.
 void setValueModel(com.klg.jclass.util.value.JCValueModel model)
          Sets the data model being used by the field.
 void updateUI()
          Updates the look and feel for this component.
 
Methods inherited from class javax.swing.JComboBox
actionPerformed, addItem, addItemListener, addPopupMenuListener, configureEditor, configurePropertiesFromAction, contentsChanged, createActionPropertyChangeListener, createDefaultKeySelectionManager, fireActionEvent, fireItemStateChanged, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getAccessibleContext, getAction, getActionCommand, getActionListeners, getEditor, getItemAt, getItemCount, getItemListeners, getKeySelectionManager, getMaximumRowCount, getModel, getPopupMenuListeners, getPrototypeDisplayValue, getRenderer, getSelectedIndex, getSelectedItem, getSelectedObjects, getUI, getUIClassID, hidePopup, insertItemAt, installAncestorListener, intervalAdded, intervalRemoved, isEditable, isLightWeightPopupEnabled, isPopupVisible, paramString, processKeyEvent, removeAllItems, removeItem, removeItemAt, removeItemListener, removePopupMenuListener, selectedItemChanged, selectWithKeyChar, setAction, setActionCommand, setEditable, setEditor, setEnabled, setKeySelectionManager, setLightWeightPopupEnabled, setMaximumRowCount, setModel, setPopupVisible, setPrototypeDisplayValue, setRenderer, setSelectedIndex, setSelectedItem, showPopup
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, 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, 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, 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
 

Field Detail

field

protected com.klg.jclass.field.Field field

required

protected boolean required

original_picklist

protected ListModel original_picklist

prefixList

protected String[] prefixList

version

public static final String version
Contains the version number of the JClass product.

Constructor Detail

JCComboField

public JCComboField()
Constructs a JCComboField.


JCComboField

public JCComboField(Class c)
Constructs an empty JCComboField which expects an object of the specified class.

Parameters:
c -

JCComboField

public JCComboField(Class c,
                    com.klg.jclass.field.validate.JCValidator v)
Constructs an empty JCComboField, which expects an object of the specified class and which uses the specified validator.

Parameters:
c -
v -

JCComboField

public JCComboField(com.klg.jclass.util.value.JCValueModel m)
Constructs an empty JCComboField, which uses the specified value model to contain its value.

Parameters:
m - The value model

JCComboField

public JCComboField(com.klg.jclass.util.value.JCValueModel m,
                    com.klg.jclass.field.validate.JCValidator v)
Constructs an empty JCComboField, which uses the specified value model to contain its value and which uses the specified validator.

Parameters:
m - The value model
v - The validator
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.

Overrides:
addPropertyChangeListener in class JComponent
Parameters:
listener - the PropertyChangeListener to be added

addValueListener

public void addValueListener(com.klg.jclass.util.value.JCValueListener listener)
Adds a listener for changes to the value.

Specified by:
addValueListener in interface JCFieldComponent
Parameters:
listener - The listener to add

removeValueListener

public void removeValueListener(com.klg.jclass.util.value.JCValueListener listener)
Removes a listener for changes to the value.

Specified by:
removeValueListener in interface JCFieldComponent
Parameters:
listener - The listener to remove

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Overrides:
removePropertyChangeListener in class JComponent
Parameters:
listener - the PropertyChangeListener to be removed

getDataProperties

public com.klg.jclass.field.DataProperties getDataProperties()
Gets the Bean property which wraps the validator, data model, and Field objects properties into one property.

Specified by:
getDataProperties in interface JCFieldComponent
Returns:
See Also:
JCValidator, JCValueModel, JCInvalidInfo

setDataProperties

public void setDataProperties(com.klg.jclass.field.DataProperties dp)
Sets the Bean property which wraps the validator, data model, and Field objects properties into one property.

Specified by:
setDataProperties in interface JCFieldComponent
Parameters:
dp -
See Also:
JCValidator, JCValueModel, JCInvalidInfo

createField

protected void createField(com.klg.jclass.field.validate.JCValidator validator)

getAbout

public String getAbout()
Gets the value of the About property. The About property displays contact information for Quest Software in the Bean box.

Returns:

setAbout

public void setAbout(String s)
Sets the value of the About property. The About property displays contact information for Quest Software in the Bean box.

Parameters:
s -

addNotify

public void addNotify()
Initializes the field object. This method should not need to be called.

Overrides:
addNotify in class JComponent

setBackground

public void setBackground(Color background)
Sets the background of the combo field.

Overrides:
setBackground in class JComponent
Parameters:
background -

setForeground

public void setForeground(Color foreground)
Sets the foreground of the combo field.

Overrides:
setForeground in class JComponent
Parameters:
foreground -

getTextFieldEditor

protected JTextField getTextFieldEditor()
Convenience method that returns the TextField Editor Component.

Returns:
TextField Editor component

getValue

public Object getValue()
Returns the value for the combo field.

Specified by:
getValue in interface JCFieldComponent
Returns:
value for the combo field

setValue

public void setValue(Object value)
Sets the value for the combo field.

Specified by:
setValue in interface JCFieldComponent
Parameters:
value -

getValueModel

public com.klg.jclass.util.value.JCValueModel getValueModel()
Returns the data model being used by the field.

Specified by:
getValueModel in interface JCFieldComponent
Returns:
data model being used by the field
See Also:
JCValueModel

setValueModel

public void setValueModel(com.klg.jclass.util.value.JCValueModel model)
Sets the data model being used by the field.

Specified by:
setValueModel in interface JCFieldComponent
Parameters:
model -
See Also:
JCValueModel

getValidator

public com.klg.jclass.field.validate.JCValidator getValidator()
Returns the validator currently in use.

Specified by:
getValidator in interface JCFieldComponent
Returns:
validator currently in use
See Also:
JCValidator

setValidator

public void setValidator(com.klg.jclass.field.validate.JCValidator v)
Sets the validator to use.

Specified by:
setValidator in interface JCFieldComponent
Parameters:
v -
See Also:
JCValidator

getInvalidInfo

public com.klg.jclass.field.JCInvalidInfo getInvalidInfo()
Returns the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.

Specified by:
getInvalidInfo in interface JCFieldComponent
Returns:
Invalid properties

setInvalidInfo

public void setInvalidInfo(com.klg.jclass.field.JCInvalidInfo info)
Sets the Invalid properties. The Invalid properties are beepOnInvalid, invalidForeground, invalidBackground, defaultValue, and invalidPolicy.

Specified by:
setInvalidInfo in interface JCFieldComponent
Parameters:
info -

getState

public int getState()
Returns the state of the component: one of VALID, INVALID, or UNDER_EDIT.

Specified by:
getState in interface JCFieldComponent
Returns:
state of the component

getSelectOnEnter

public boolean getSelectOnEnter()
Returns a flag indicating the selection status on entering the field.

Specified by:
getSelectOnEnter in interface JCFieldComponent
Returns:
flag indicating the selection status on entering the field
See Also:
setSelectOnEnter(boolean)

setSelectOnEnter

public void setSelectOnEnter(boolean select)
Sets a flag to determine whether the value in the field is selected when the component gains focus. The default value is false.

Specified by:
setSelectOnEnter in interface JCFieldComponent
Parameters:
select -

commitEdit

public void commitEdit()
Commits the current field under edit.

Specified by:
commitEdit in interface JCFieldComponent

isRequired

public boolean isRequired()
Returns true if the field is required.

Specified by:
isRequired in interface JCFieldComponent
Returns:
true if the field is required

getPickList

public ListModel getPickList()
Gets the current pick list.

Returns:

getOriginalPickList

protected ListModel getOriginalPickList()
Gets the original pick list.

Returns:

setPickList

public void setPickList(ListModel picklist)
Sets the pick list (may have been modified through AutoRefinement).

Parameters:
picklist -

setTemporaryPickList

protected void setTemporaryPickList(ListModel picklist)
Sets a temporary pick list (for AutoRefinement feature of AutoComplete).

Parameters:
picklist -

restoreOriginalPickList

protected void restoreOriginalPickList()
Restores picklist to its original (could have been modified through AutoRefinement).


setAutoComplete

public void setAutoComplete(boolean autoComplete,
                            boolean autoAppend,
                            boolean autoSuggest,
                            boolean autoRefinement,
                            String[] prefixList)
Sets the autoComplete property and its corresponding attributes.

Parameters:
autoComplete - Turns on/off whether auto complete mode is enabled. If this value is false, the values of the attributes are ignored.
autoAppend - appends the completion to the partial completed text in reverse video
autoSuggest - pops up the combo box's popup as a suggestion list upon typing a character
autoRefinement - If autoSuggest is true, refines the popup list to include all possible matches as well as the currently typed text.
Note: If AutoSuggest is false, this attribute will also be set to false.
prefixList - Sets the PrefixList. If non-null, the combo box will ignore the given prefixes when matching items. The longest matching prefix is always used.
Note: Although it is permitted to use a prefix list without AutoSuggest being true, the resulting behavior maybe be quite non-intuitive for the user.

isAutoComplete

public boolean isAutoComplete()
Returns true if the field has autoComplete turned on.

Returns:
true if autoComplete is on

isAutoSuggest

public boolean isAutoSuggest()
Returns true if the field has autoSuggest turned on.

Returns:
true if autoSuggest is on

isAutoAppend

public boolean isAutoAppend()
Returns true if the field has autoAppend turned on.

Returns:
true if the field has autoAppend turned on

isAutoRefinement

public boolean isAutoRefinement()
Returns true if the field has autoRefinement turned on.

Returns:
true if the field has autoRefinement turned on

getPrefixList

public String[] getPrefixList()
Returns the value of PrefixList.

Returns:
value of PrefixList
See Also:
setAutoComplete(boolean, boolean, boolean, boolean, java.lang.String[])

setRequired

public void setRequired(boolean required)
Sets the required property for the current field.

Specified by:
setRequired in interface JCFieldComponent
Parameters:
required -

setUI

public void setUI(ComboBoxUI ui)
Sets the look and feel for this component. This method is used internally. You should not have to call it.

Overrides:
setUI in class JComboBox
Parameters:
ui -

updateUI

public void updateUI()
Updates the look and feel for this component. This method is used internally. You should not have to call it.

Overrides:
updateUI in class JComboBox

addActionListener

public void addActionListener(ActionListener l)
Adds an ActionListener. An action event is generated when the edited item changes.

Overrides:
addActionListener in class JComboBox
Parameters:
l -

removeActionListener

public void removeActionListener(ActionListener l)
Removes an ActionListener.

Overrides:
removeActionListener in class JComboBox
Parameters:
l -

setItems

public void setItems(String[] items)
Sets the list of choices. This method is for internal use only. To set the list, use the setPickList method in the AbstractValidator class.

Parameters:
items -
See Also:
AbstractValidator.setPickList(javax.swing.ListModel)

add

public void add(String item)
Adds an item to the list. This method is for internal use only. To set the list, use the setPickList method in the AbstractValidator class.

Parameters:
item -
See Also:
AbstractValidator.setPickList(javax.swing.ListModel)

setLocale

public void setLocale(Locale l)
Sets the locale being used by the combo field. Sets it on the validator as well.

Overrides:
setLocale in class Component
Parameters:
l - the new locale to be used

Copyright © 2004 Quest Software Inc..
All rights reserved.