@BeanSettings(useXdevCustomizer=true) public class XdevSpinner extends JSpinner implements NumberFormularComponent<XdevSpinner>, XdevFocusCycleComponent
JSpinner
.JSpinner
,
FormularComponent
,
XdevFocusCycleComponent
,
Serialized FormJSpinner.AccessibleJSpinner, JSpinner.DateEditor, JSpinner.DefaultEditor, JSpinner.ListEditor, JSpinner.NumberEditor
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
FormularComponent.ValueChangeListener
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DATA_FIELD_SEPARATOR
TAB_INDEX_PROPERTY
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
XdevSpinner()
Constructs a
XdevSpinner with an
Integer with initial value 0 and
no minimum or maximum limits. |
XdevSpinner(SpinnerModel model)
Constructs a complete
XdevSpinner with pair of next/previous
buttons and an editor for the SpinnerModel . |
Modifier and Type | Method and Description |
---|---|
void |
addFocusListener(FocusListener l) |
void |
addValidator(Validator validator)
Adds a validator to this component
|
void |
addValueChangeListener(FormularComponent.ValueChangeListener l)
Registers a
FormularComponent.ValueChangeListener . |
Color |
getBackground() |
String |
getDataField()
Returns the name of the bound data field of this formular component.
|
Operator |
getFilterOperator()
Returns the operator used in
Formular.createCondition(String) |
Font |
getFont() |
Color |
getForeground() |
String |
getFormularName()
Returns the name of the component in the formular context.
|
Object |
getFormularValue()
Returns the value of the component.
|
Number |
getNumber()
Returns the value of this
NumberFormularComponent as
Number . |
Number |
getNumber(Number defaultValue)
Returns the value of this
NumberFormularComponent as
Number . |
int |
getTabIndex()
Returns the tabindex assigned to this component.
|
JTextField |
getTextField()
Returns the component that displays and potentially changes the model's
value.
|
Validator[] |
getValidators()
Returns all validators of this component.
|
boolean |
hasStateChanged()
Checks if the component's state since the last call of
FormularComponent.saveState() has changed. |
boolean |
isMultiSelect()
Returns whether the component supports multi selection or not.
|
boolean |
isOpaque() |
boolean |
isReadOnly()
Determines whether this component is only used to display values.
|
void |
removeFocusListener(FocusListener l) |
void |
removeValidator(Validator validator)
Removes a validator from this component
|
void |
requestFocus() |
void |
restoreState()
Restores the internally saved state of the component.
|
void |
saveState()
Saves the state of the component internally.
|
void |
setBackground(Color bg) |
void |
setDataField(String dataField)
Sets the name of the bound data field of this formular component.
|
void |
setEnabled(boolean enabled) |
void |
setFilterOperator(Operator filterOperator)
Sets the filter operator used in
Formular.createCondition(String) |
void |
setFont(Font f) |
void |
setForeground(Color fg) |
void |
setFormularValue(VirtualTable vt,
int col,
Object value)
Deprecated.
|
void |
setFormularValue(VirtualTable vt,
Map<String,Object> record)
Sets the value of the component, taking the value(s) of the record
according to
FormularComponent.getDataField() . |
void |
setListModel(List<?> values)
Constructs a
SpinnerListModel whose sequence of values is defined
by the specified List and changes the model that represents the
value of this XdevSpinner . |
void |
setNumber(Number number)
Sets the number of this
NumberFormularComponent . |
void |
setNumberModel(int value,
int minimum,
int maximum,
int stepSize)
Constructs a
SpinnerNumberModel with the specified
value , minimum /maximum bounds, and
stepSize and changes the model that represents the value of
this XdevSpinner . |
void |
setOpaque(boolean b) |
void |
setReadOnly(boolean readOnly)
Sets if this form component is only used to display values.
|
void |
setTabIndex(int tabIndex)
Sets the tabindex of this component.
|
String |
toString() |
void |
updateUI() |
void |
validateState()
Calls
Validator.validate(Object) of all registered
Validator s. |
void |
validateState(Validation validation)
Calls
Validator.validate(Object) of all registered
Validator s. |
boolean |
verify()
Returns whether the component's value adheres all set constraints.
|
addChangeListener, commitEdit, createEditor, fireStateChanged, getAccessibleContext, getChangeListeners, getEditor, getModel, getNextValue, getPreviousValue, getUI, getUIClassID, getValue, removeChangeListener, setEditor, setModel, setUI, setValue
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getClientProperty, isEnabled, isVisible, putClientProperty
public XdevSpinner()
XdevSpinner
with an
Integer SpinnerNumberModel
with initial value 0 and
no minimum or maximum limits.JSpinner.setModel(SpinnerModel)
public XdevSpinner(SpinnerModel model)
XdevSpinner
with pair of next/previous
buttons and an editor for the SpinnerModel
.model
- the new SpinnerModel
for this XdevSpinner
public JTextField getTextField()
JTextField
that gives the user access to the
SpinnerDateModel's
value. If the editor is not a
DefaultEditor
, null is returned.public String getFormularName()
getFormularName
in interface FormularComponent<XdevSpinner>
public void setDataField(String dataField)
setDataField
in interface FormularComponent<XdevSpinner>
dataField
- the new bound data fieldpublic String getDataField()
getDataField
in interface FormularComponent<XdevSpinner>
@Deprecated public final void setFormularValue(VirtualTable vt, int col, Object value)
value
. The value is formatted using the column format of the
provided VirtualTable
and columnIndex
.setFormularValue
in interface FormularComponent<XdevSpinner>
vt
- VirtualTable
to use the format fromcol
- of the column to use the format fromvalue
- value to setpublic void setFormularValue(VirtualTable vt, Map<String,Object> record)
FormularComponent.getDataField()
.setFormularValue
in interface FormularComponent<XdevSpinner>
vt
- the underlying virtual tablerecord
- the data <column,value>public Object getFormularValue()
getFormularValue
in interface FormularComponent<XdevSpinner>
public void saveState()
A saved state can be restored using FormularComponent.restoreState()
.
saveState
in interface FormularComponent<XdevSpinner>
public void restoreState()
The state of the component can be saved using FormularComponent.saveState()
.
restoreState
in interface FormularComponent<XdevSpinner>
public boolean hasStateChanged()
FormularComponent.saveState()
has changed.hasStateChanged
in interface FormularComponent<XdevSpinner>
true
if the component's state has changed,
false
otherwisepublic void addValueChangeListener(FormularComponent.ValueChangeListener l)
FormularComponent.ValueChangeListener
.addValueChangeListener
in interface FormularComponent<XdevSpinner>
l
- the listener to registerpublic boolean isMultiSelect()
A component that supports multi selection can have more than one selected item / value.
isMultiSelect
in interface FormularComponent<XdevSpinner>
true
if the component supports multi
selection, false
otherwise.public boolean verify()
This is a alternative method for FormularComponent.validateState()
, but this
method returns a boolean depending on the validation's result and doesn't
throw an ValidationException
.
verify
in interface FormularComponent<XdevSpinner>
true
if the value of the component adheres all set
constraints; otherwise false
.public void addValidator(Validator validator)
addValidator
in interface FormularComponent<XdevSpinner>
validator
- the validator to addFormularComponent.validateState()
public void removeValidator(Validator validator)
removeValidator
in interface FormularComponent<XdevSpinner>
validator
- the validator to removeFormularComponent.validateState()
public Validator[] getValidators()
If no validator is present an empty array is returned.
getValidators
in interface FormularComponent<XdevSpinner>
public void validateState() throws ValidationException
Validator.validate(Object)
of all registered
Validator
s.validateState
in interface FormularComponent<XdevSpinner>
ValidationException
FormularComponent.verify()
public void validateState(Validation validation) throws ValidationException
Validator.validate(Object)
of all registered
Validator
s.
Every ValidationException
is recorded in the
validation
object, and if
Validation.continueValidation(ValidationException)
returns
false
this exception is re-thrown by this method.
validateState
in interface FormularComponent<XdevSpinner>
validation
- the validation process objectValidationException
FormularComponent.verify()
public void setFilterOperator(Operator filterOperator)
Formular.createCondition(String)
setFilterOperator
in interface FormularComponent<XdevSpinner>
filterOperator
- the new filter operatorpublic Operator getFilterOperator()
Formular.createCondition(String)
getFilterOperator
in interface FormularComponent<XdevSpinner>
public void setReadOnly(boolean readOnly)
setReadOnly
in interface FormularComponent<XdevSpinner>
readOnly
- true
to only display valuespublic boolean isReadOnly()
isReadOnly
in interface FormularComponent<XdevSpinner>
true
if this component is only used to display
values.public Number getNumber() throws NumberFormatException
NumberFormularComponent
as
Number
.getNumber
in interface NumberFormularComponent<XdevSpinner>
NumberFormularComponent
as
Number
.NumberFormatException
- if the value of this NumberFormularComponent
can not
be converted.NumberFormularComponent.getNumber(Number)
public Number getNumber(Number defaultValue)
NumberFormularComponent
as
Number
. If the internal value can not be converted into a
Number
, the defaultValue
is returned.getNumber
in interface NumberFormularComponent<XdevSpinner>
defaultValue
- the default Number
NumberFormularComponent
. If the
internal value can not be converted into a Number
, the
defaultValue
is returned.NumberFormularComponent.getNumber()
public void setNumber(Number number)
NumberFormularComponent
.setNumber
in interface NumberFormularComponent<XdevSpinner>
number
- the new numberpublic void setNumberModel(int value, int minimum, int maximum, int stepSize) throws IllegalArgumentException
SpinnerNumberModel
with the specified
value
, minimum
/maximum
bounds, and
stepSize
and changes the model that represents the value of
this XdevSpinner
.value
- the current value of the SpinnerNumberModel
minimum
- the first number in the sequencemaximum
- the last number in the sequencestepSize
- the difference between elements of the sequenceIllegalArgumentException
- if the following expression is false: minimum <= value <=
maximumpublic void setListModel(List<?> values) throws IllegalArgumentException
SpinnerListModel
whose sequence of values is defined
by the specified List
and changes the model that represents the
value of this XdevSpinner
.values
- the values of the SpinnerListModel
IllegalArgumentException
- if model is null
JSpinner.getModel()
,
JSpinner.getEditor()
,
JSpinner.setEditor(javax.swing.JComponent)
,
SpinnerListModel
public void setBackground(Color bg)
setBackground
in class JComponent
public Color getBackground()
getBackground
in class Component
public void setForeground(Color fg)
setForeground
in class JComponent
public Color getForeground()
getForeground
in class Component
public void setFont(Font f)
setFont
in class JComponent
public Font getFont()
getFont
in interface MenuContainer
getFont
in class Component
public void setOpaque(boolean b)
setOpaque
in class JComponent
public boolean isOpaque()
isOpaque
in class JComponent
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
public void requestFocus()
requestFocus
in class JComponent
public void addFocusListener(FocusListener l)
addFocusListener
in class Component
public void removeFocusListener(FocusListener l)
removeFocusListener
in class Component
public int getTabIndex()
getTabIndex
in interface XdevFocusCycleComponent
public void setTabIndex(int tabIndex)
To exclude this component from the focus cycle set tabindex to -1.
setTabIndex
in interface XdevFocusCycleComponent
tabIndex
- to be setCopyright © 2003–2022 XDEV Software. All rights reserved.