JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field
Class JCSpinField

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.util.swing.AbstractSpinBox
                          |
                          +--com.klg.jclass.field.JCSpinField
All Implemented Interfaces:
ImageObserver, JCFieldComponent, MenuContainer, Serializable
Direct Known Subclasses:
DSdbSpinField, JBdbSpinField, JCDateTimeValidator.TimeSpin, JCSpinFieldCellEditor, JCSpinFieldCellRenderer

public class JCSpinField
extends AbstractSpinBox
implements JCFieldComponent

A spin field allows the user to spin through a range of values. The range of values shown in the spin field is determined by one of two mechanisms. The upper and lower limits on the range can be determined by predefining min and max values. The intermediate values are controlled by the increment property. A pick list offers all the possible values that the spin field can contain. This has precedence over the increment method. Only one value at a time is shown in the spin field. Up and down arrow buttons are used to change the value by “spinning.” The spin field has access to the same validator functions as the text field.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.klg.jclass.util.swing.AbstractSpinBox
AbstractSpinBox.ArrowButton, AbstractSpinBox.MetalArrowButton, AbstractSpinBox.MetalBorder
 
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  boolean required
           
protected  JTextField text
           
static String version
          Contains the version number of the JClass product.
 
Fields inherited from class com.klg.jclass.util.swing.AbstractSpinBox
arrowKeySpinningAllowed, buttonTimer, continuousScroll, currentButton, DECREMENT, downArrow, editable, editor, editorIsValidateRoot, INCREMENT, l, metalBorder, minimumHeight, NONE, renderer, renderPanel, rl, upArrow, userFont, valueListeners, valueModel
 
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
JCSpinField()
          Constructs a JCSpinField.
JCSpinField(Class c)
          Constructs an empty JCSpinField, which expects an object of the specified class.
JCSpinField(Class c, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCSpinField, which expects an object of the specified class (which uses the specified validator).
JCSpinField(com.klg.jclass.util.value.JCValueModel m)
          Constructs an empty JCSpinField, which uses the specified value model to contain its value.
JCSpinField(com.klg.jclass.util.value.JCValueModel m, com.klg.jclass.field.validate.JCValidator v)
          Constructs an empty JCSpinField, which uses the specified value model to contain its value and which uses the specified validator.
 
Method Summary
 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.
protected  void checkArrowButtons()
          Abstract method that check if arrows should be enabled or disabled.
 void commitEdit()
          Commits the current field under edit.
protected  void createField(com.klg.jclass.field.validate.JCValidator validator)
           
protected  Object doSpin(boolean spin_up)
          Performs spinning given the direction.
 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.
 boolean getSelectOnEnter()
          Returns a flag indicating the selection status on entering the field.
 int getState()
          Returns the state of the component: VALID, INVALID, or UNDER_EDIT.
 com.klg.jclass.field.validate.JCValidator getValidator()
          Returns the validator currently in use.
 Object getValue()
          Returns the value for the text field.
 com.klg.jclass.util.value.JCValueModel getValueModel()
          Returns the data model being used by the field.
 boolean isRequired()
          Returns true if the field is required.
protected  int preferredHeightOfView()
          Returns the text field's preferred height.
protected  void processFocusLost(FocusEvent e)
           
 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.
 void setAbout(String s)
          Sets the value of the About property.
 void setBackground(Color background)
          Sets the background of the spin 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 setEditable(boolean aFlag)
          Determines whether the JCSpinBox field is editable.
 void setForeground(Color foreground)
          Sets the foreground of the spin field.
 void setInvalidInfo(com.klg.jclass.field.JCInvalidInfo info)
          Sets the Invalid properties.
 void setLocale(Locale l)
          Sets the locale being used by the spin field; sets it on the validator as well.
 void setRequired(boolean required)
          Sets the required property for the current field.
 void setSelectOnEnter(boolean select)
          Sets a flag to determines whether or the value in the field is selected when the component gains focus.
 void setValidator(com.klg.jclass.field.validate.JCValidator v)
          Sets the validator to use.
 void setValue(Object value)
          Sets the value for the text field.
 void setValueModel(com.klg.jclass.util.value.JCValueModel model)
          Sets the data model being used by the field.
protected  Object spinDown()
          Returns the new value generated when spinning down a notch.
protected  Object spinUp()
          Returns the new value generated when spinning up a notch.
 
Methods inherited from class com.klg.jclass.util.swing.AbstractSpinBox
compareToValue, configureArrowButtons, createDecrArrow, createIncrArrow, doBorder, doFocusedLook, doLayout, doNonFocusedLook, getDecrementArrow, getEditor, getIncrementArrow, getPreferredSize, getRenderer, handleKeyPressed, isArrowKeySpinningAllowed, isContinuousScroll, isEditable, isEnabled, isFocusTraversable, paint, preferredWidthOfView, processValueChanged, processValueChanging, requestFocus, setArrowEnabled, setArrowKeySpinningAllowed, setContinuousScroll, setEditor, setEnabled, setFont, setLayout, setRenderer, setUI, swapEditorRenderer, updateUI
 
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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, 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, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, 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, 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, isFocusable, isFocusOwner, 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

text

protected JTextField text

required

protected boolean required

version

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

Constructor Detail

JCSpinField

public JCSpinField()
Constructs a JCSpinField.


JCSpinField

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

Parameters:
c -

JCSpinField

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

Parameters:
c -
v -

JCSpinField

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

Parameters:
m -

JCSpinField

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

Parameters:
m -
v -
Method Detail

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

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

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

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
Overrides:
addValueListener in class AbstractSpinBox
Parameters:
listener -

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
Overrides:
removeValueListener in class AbstractSpinBox
Parameters:
listener -

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 -

preferredHeightOfView

protected int preferredHeightOfView()
Returns the text field's preferred height. Designed to be overridden.

Overrides:
preferredHeightOfView in class AbstractSpinBox
Returns:
text field's preferred height

setEditable

public void setEditable(boolean aFlag)
Determines whether the JCSpinBox field is editable. An editable JCSpinBox allows the user to type into the field or select an item from the list to initialize the field, after which it can be edited. (The editing affects only the field, the list item remains intact.) A non editable JCSpinBox displays the selected item in the field, but the selection cannot be modified.

Overrides:
setEditable in class AbstractSpinBox
Parameters:
aFlag - a boolean value, where true indicates that the field is editable

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 spin field.

Overrides:
setBackground in class AbstractSpinBox
Parameters:
background -

setForeground

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

Overrides:
setForeground in class AbstractSpinBox
Parameters:
foreground -

checkArrowButtons

protected void checkArrowButtons()
Description copied from class: AbstractSpinBox
Abstract method that check if arrows should be enabled or disabled. Use setArrowEnabled to enable/disable the arrow buttons. This will do so in a thread and state friendly manner.

Specified by:
checkArrowButtons in class AbstractSpinBox
See Also:
AbstractSpinBox.setArrowEnabled(javax.swing.JButton, boolean)

doSpin

protected Object doSpin(boolean spin_up)
Performs spinning given the direction.

Parameters:
spin_up - true means to spin up and false means to spin down
Returns:

spinUp

protected Object spinUp()
Returns the new value generated when spinning up a notch.

Specified by:
spinUp in class AbstractSpinBox
Returns:
new value generated when spinning up a notch

spinDown

protected Object spinDown()
Returns the new value generated when spinning down a notch.

Specified by:
spinDown in class AbstractSpinBox
Returns:
new value generated when spinning down a notch

processFocusLost

protected void processFocusLost(FocusEvent e)
Overrides:
processFocusLost in class AbstractSpinBox

getValue

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

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

setValue

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

Specified by:
setValue in interface JCFieldComponent
Overrides:
setValue in class AbstractSpinBox
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
Overrides:
getValueModel in class AbstractSpinBox
Returns:
data model 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
Overrides:
setValueModel in class AbstractSpinBox
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: VALID, INVALID, or UNDER_EDIT.

Specified by:
getState in interface JCFieldComponent
Returns:
VALID, INVALID, or UNDER_EDIT

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 determines whether or 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

setRequired

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

Specified by:
setRequired in interface JCFieldComponent
Parameters:
required -

setLocale

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

Overrides:
setLocale in class AbstractSpinBox
Parameters:
l - the new locale to be used
See Also:
Component.setLocale(java.util.Locale)

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