|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.SpinBox
public class SpinBox
SpinBox is a class that combines a textField (JTextField) and a spinButton.
The value in the textField can be incremented by pressing the spinButton.
The SpinBox supports two types of models: an StaticOrderedCollectionInterface model or a
BoundedNumberInterface model. The collection model displays one item from the collection
in the textField and allows stepping throught the collection by using the spinButton.
The boundedNumber model displays the value of the boundedNumber in the textField and allows
it to be incremented or decremented by the spinButton. An AdjustmentEvent is fired any time
the value of the SpinBox changes. An ItemEvent is also fired when the model is a collection
and the value changes. The defaultModel for the SpinBox is a BoundedDouble.
Notes:
StaticOrderedCollectionInterface
,
BoundedNumberInterface
,
JTextField
,
SpinButton
,
Serialized FormField Summary | |
---|---|
protected java.awt.event.AdjustmentListener |
adjustmentListener
|
protected com.sas.swing.visuals.SpinBox.ArrowKeyAdapter |
arrowKeyAdapter
|
protected com.sas.models.BoundedNumberInterface |
boundedNumberModel
|
protected com.sas.models.BoundedNumberInterface |
defaultRangeModel
|
protected com.sas.util.transforms.TransformInterface |
displayTransform
|
protected GenericErrorHandlerInterface |
errorHandler
|
protected java.awt.event.ItemListener |
itemListener
|
static int |
LEFT_RIGHT
int values representing the orientation of the spinButton arrows- LEFT_RIGHT |
protected java.text.NumberFormat |
numberFormat
|
protected boolean |
numberFormatSet
|
protected double |
precision
|
protected boolean |
precisionDisplayed
|
protected PrefixPredicate |
prefixPredicate
|
static java.lang.String |
RB_KEY
|
protected SpinButton |
spinBtn
|
protected com.sas.collection.StaticOrderedCollectionInterface |
staticOrderedCollectionModel
|
protected javax.swing.JTextField |
text
|
protected boolean |
textInvoked
|
static int |
UP_DOWN
int values representing the orientation of the spinButton arrows- UP_DOWN |
protected ValidationInterface |
validator
|
protected boolean |
valueInvoked
|
Constructor Summary | |
---|---|
SpinBox()
Default constructor |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handles the action performed events on the textField in the spinBox. |
void |
addAdjustmentListener(java.awt.event.AdjustmentListener l)
Add a listener to receive adjustment events when the value of the SpinBox changes. |
void |
addItemListener(java.awt.event.ItemListener l)
Add a listener to receive item events when the state of the SpinBox changes. |
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Handle all adjustment events that are sent out by spinButton. |
void |
contentsChanged(com.sas.collection.ContentsChangedEvent e)
Handle contentsChanged events from a collection model. |
void |
focusGained(java.awt.event.FocusEvent e)
Handles the focus gained events on the textField in the spinBox. |
void |
focusLost(java.awt.event.FocusEvent e)
Handles the focus lost event on the textField in the spinBox. |
Alarm |
getAlarm()
Deprecated. |
int |
getArrowDirection()
Get the direction the SpinButton arrows are pointing. |
int |
getBlockIncrement()
Get the block value increment for the spinButton. |
java.lang.Number |
getBlockIncrementNumber()
Get the blockIncrement number value for the spinButton. |
int |
getColumns()
Get the number of columns of the textField. |
javax.swing.JButton |
getDecrementButton()
Returns the button that is used to deccrement in the spinBox. |
static int |
getDefaultHeight()
|
static int |
getDefaultWidth()
|
long |
getDelay()
Get the delay before the spinButton begins automatically incrementing its value. |
com.sas.util.transforms.TransformInterface |
getDisplayTransform()
Get the displayTransform used to transform the objects in the model before they are displayed. |
double |
getDoubleData()
Get the double data value of the SpinBox. |
GenericErrorHandlerInterface |
getErrorHandler()
Returns the error handler being used for the validator on the text in the textField of the SpinBox |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
|
javax.swing.JButton |
getIncrementButton()
Returns the button that is used to increment in the spinBox. |
int |
getMaximum()
Get the maximum integer value of the SpinBox. |
java.lang.Number |
getMaximumNumber()
Get the maximum number value for the SpinBox. |
int |
getMinimum()
Get the minimum integer value of the SpinBox. |
java.lang.Number |
getMinimumNumber()
Get the minimum number value for the SpinBox. |
com.sas.models.BoundedNumberInterface |
getModel()
Returns the BoundedNumberInterface model that is set on the spinBox. |
java.text.NumberFormat |
getNumberFormat()
Get the NumberFormat applied to the value set as the text in the textField. |
java.lang.Number |
getNumberValue()
Get the number value of the SpinBox. |
int |
getOrientation()
Get the orientation of the spinButton. |
double |
getPrecision()
Get the precision of the value displayed in the textField. |
java.util.Vector |
getRequiredInterfaces()
Returns the required interfaces Vector for this component. |
java.lang.Object[] |
getSelectedObjects()
Get the selected object when the model is a collection. |
long |
getStartInterval()
Get the start interval for the spinButton alarm to increment the value. |
com.sas.collection.StaticOrderedCollectionInterface |
getStaticOrderedCollectionModel()
Returns the StaticOrderedCollectionInterface model that is set on the spinBox. |
java.lang.String |
getText()
Get the text displayed in the textField. |
javax.swing.JTextField |
getTextField()
Returns the textField that is used in the spinBox. |
int |
getUnitIncrement()
Get the integer unitIncrement of the spinButton. |
java.lang.Number |
getUnitIncrementNumber()
Get the unitIncrement number value for the spinButton. |
ValidationInterface |
getValidator()
Returns the validator being used on the text in the textField of the SpinBox |
int |
getValue()
Get the integer value of the SpinBox. |
int |
getVisibleAmount()
Not used. |
protected void |
handleError()
Internal routine for displaying an error message when text fails the validation rules |
boolean |
isCycleOn()
Get if the spinButton is set to cycle through its values. |
boolean |
isDefaultModelAttached()
Returns true if the default model is being used, false otherwise. |
boolean |
isPrecisionDisplayed()
Get if the text in the textField is displayed correctly. |
void |
paintComponent(java.awt.Graphics g)
Paint the SpinBox. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events on complex properties. |
void |
refresh(com.sas.ModelInterface model)
Refresh the SpinBox with the specified model. |
void |
removeAdjustmentListener(java.awt.event.AdjustmentListener l)
Remove the adjustment listener. |
void |
removeItemListener(java.awt.event.ItemListener l)
Remove the item listener. |
void |
setAlarm(Alarm alarm)
Deprecated. |
void |
setArrowDirection(int d)
Sets the direction the SpinButton arrows are pointing. |
void |
setBackground(java.awt.Color color)
Sets the background color of the text field in the SpinBox |
void |
setBlockIncrement(int block)
Set the blockIncrement on the spinButton. |
void |
setBlockIncrementNumber(java.lang.Number block)
Set the blockIncrement number value for the spinButton. |
void |
setColumns(int cols)
Set the number of text columns on the textField. |
void |
setCycleOn(boolean cycle)
Set the spinButton to cycle through its values. |
static void |
setDefaultHeight(int newHeight)
|
void |
setDefaultValues()
Set the default internal values for the BaseButton. |
static void |
setDefaultWidth(int newWidth)
|
void |
setDelay(long delay)
Set the delay before the spinButton begins automatically incrementing its value. |
void |
setDisplayTransform(com.sas.util.transforms.TransformInterface transform)
Set the displayTransform used to transform the items in the model when the model of the SpinBox is a StaticOrderedCollectionInterface object. |
void |
setDoubleData(double d)
Set the double value of the SpinBox. |
void |
setEnabled(boolean e)
Set the SpinBox enabled. |
void |
setErrorHandler(GenericErrorHandlerInterface newErrorHandler)
Set the errorHandler for the validator of the text in the textField of the SpinBox. |
void |
setForeground(java.awt.Color color)
Sets the foreground color of the text in the SpinBox |
void |
setMaximum(int max)
Set the integer maximum value for the SpinBox. |
void |
setMaximumNumber(java.lang.Number max)
Set the maximum number value for the SpinBox. |
void |
setMinimum(int min)
Set the integer minimum value for the SpinBox. |
void |
setMinimumNumber(java.lang.Number min)
Set the minimum number value for the SpinBox. |
void |
setModel(com.sas.models.BoundedNumberInterface model)
Sets the BoundedNumberInterface model on the spinBox. |
void |
setNumberFormat(java.text.NumberFormat nf)
Set the NumberFormat applied to the value set as the text in the textField. |
void |
setNumberValue(java.lang.Number value)
Set the number value for the SpinBox. |
void |
setOrientation(int orient)
Set the orientation of the spinButton. |
void |
setStartInterval(long startInterval)
Set the start interval for the spinButton alarm to increment the value. |
void |
setStaticOrderedCollectionModel(com.sas.collection.StaticOrderedCollectionInterface model)
Sets the StaticOrderedCollectionInterface model on the spinBox. |
void |
setText(java.lang.String txt)
Set the text of the SpinBox. |
void |
setToolTipText(java.lang.String txt)
Registers the text to display in a tool tip. |
void |
setUnitIncrement(int unit)
Set the integer value of the unitIncrement. |
void |
setUnitIncrementNumber(java.lang.Number unit)
Set the unitIncrement number value for the SpinBox. |
void |
setValidator(ValidationInterface newValidator)
Set the validator for the text in the textField of the SpinBox. |
void |
setValue(int val)
Set the integer value of the SpinBox. |
void |
setVisibleAmount(int amt)
Not used. |
protected void |
updateText(java.lang.Number newValue)
Invoked when the text needs to be updated from a change in the value. |
protected void |
updateValue(java.lang.String txt)
Invoked when the value needs to be updated from a change in the text. |
Field Detail |
---|
public static final java.lang.String RB_KEY
protected SpinButton spinBtn
protected javax.swing.JTextField text
protected double precision
protected java.text.NumberFormat numberFormat
protected boolean numberFormatSet
protected com.sas.models.BoundedNumberInterface defaultRangeModel
protected com.sas.models.BoundedNumberInterface boundedNumberModel
protected com.sas.collection.StaticOrderedCollectionInterface staticOrderedCollectionModel
protected boolean precisionDisplayed
protected transient boolean textInvoked
protected transient boolean valueInvoked
protected transient PrefixPredicate prefixPredicate
protected transient com.sas.swing.visuals.SpinBox.ArrowKeyAdapter arrowKeyAdapter
protected transient java.awt.event.AdjustmentListener adjustmentListener
protected transient java.awt.event.ItemListener itemListener
protected ValidationInterface validator
protected GenericErrorHandlerInterface errorHandler
protected com.sas.util.transforms.TransformInterface displayTransform
public static final int UP_DOWN
public static final int LEFT_RIGHT
Constructor Detail |
---|
public SpinBox()
Method Detail |
---|
public static int getDefaultHeight()
public static int getDefaultWidth()
public static void setDefaultHeight(int newHeight)
public static void setDefaultWidth(int newWidth)
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public void addAdjustmentListener(java.awt.event.AdjustmentListener l)
addAdjustmentListener
in interface java.awt.Adjustable
Adjustable.addAdjustmentListener(java.awt.event.AdjustmentListener)
public void addItemListener(java.awt.event.ItemListener l)
addItemListener
in interface java.awt.ItemSelectable
ItemSelectable.addItemListener(java.awt.event.ItemListener)
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged
in interface java.awt.event.AdjustmentListener
public void contentsChanged(com.sas.collection.ContentsChangedEvent e)
contentsChanged
in interface com.sas.collection.ContentsChangedListener
public void setToolTipText(java.lang.String txt)
setToolTipText
in class javax.swing.JComponent
txt
- the string to display; if the text is null,
the tool tip is turned off for this componentpublic boolean isDefaultModelAttached()
ViewDefaultModel
public com.sas.models.BoundedNumberInterface getModel()
public void setModel(com.sas.models.BoundedNumberInterface model)
the
- model to set, null to dettach the modelpublic com.sas.collection.StaticOrderedCollectionInterface getStaticOrderedCollectionModel()
public void setStaticOrderedCollectionModel(com.sas.collection.StaticOrderedCollectionInterface model)
the
- model to set, null to dettach the modelpublic void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the graphics contextpublic void setForeground(java.awt.Color color)
setForeground
in class javax.swing.JComponent
color
- the new color for the text in the SpinBoxpublic void setBackground(java.awt.Color color)
setBackground
in class javax.swing.JComponent
color
- the new color for the text field in the SpinBoxpublic Alarm getAlarm()
SpinButton.getAlarm()
,
setAlarm(com.sas.util.Alarm)
public int getArrowDirection()
setArrowDirection(int)
public long getDelay()
getStartInterval()
,
setDelay(long)
public long getStartInterval()
getDelay()
,
setStartInterval(long)
public int getBlockIncrement()
getBlockIncrement
in interface java.awt.Adjustable
public int getColumns()
setColumns(int)
public com.sas.util.transforms.TransformInterface getDisplayTransform()
public final double getDoubleData()
getNumberValue()
method.
getDoubleData
in interface com.sas.lang.DoubleDataInterface
setDoubleData(double)
,
getNumberValue()
,
DoubleDataInterface
public int getMaximum()
getMaximum
in interface java.awt.Adjustable
Adjustable
,
getMaximumNumber()
,
setMaximum(int)
public int getMinimum()
getMinimum
in interface java.awt.Adjustable
Adjustable
,
getMinimumNumber()
,
setMinimum(int)
public java.lang.Number getBlockIncrementNumber()
Adjustable
,
SpinButton
,
setBlockIncrement(int)
public java.lang.Number getMaximumNumber()
BoundedNumberInterface
,
setMaximumNumber(java.lang.Number)
public java.lang.Number getMinimumNumber()
BoundedNumberInterface
,
setMinimumNumber(java.lang.Number)
public java.util.Vector getRequiredInterfaces()
ViewInterface.getRequiredInterfaces()
public java.lang.Number getUnitIncrementNumber()
Adjustable
,
SpinButton
,
setBlockIncrement(int)
public java.lang.Number getNumberValue()
setNumberValue(java.lang.Number)
public java.text.NumberFormat getNumberFormat()
NumberFormat
public int getOrientation()
getOrientation
in interface java.awt.Adjustable
Adjustable
,
SpinButton
,
setOrientation(int)
public double getPrecision()
public java.lang.Object[] getSelectedObjects()
getSelectedObjects
in interface java.awt.ItemSelectable
ItemSelectable
public java.lang.String getText()
getText
in interface com.sas.lang.StringDataInterface
StringDataInterface
,
setText(java.lang.String)
public javax.swing.JTextField getTextField()
public javax.swing.JButton getIncrementButton()
public javax.swing.JButton getDecrementButton()
public int getUnitIncrement()
getUnitIncrement
in interface java.awt.Adjustable
setUnitIncrement(int)
public int getValue()
getValue
in interface java.awt.Adjustable
Adjustable
,
SpinButton
,
setValue(int)
public int getVisibleAmount()
getVisibleAmount
in interface java.awt.Adjustable
Adjustable
,
setVisibleAmount(int)
public boolean isCycleOn()
setCycleOn(boolean)
public boolean isPrecisionDisplayed()
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
the
- action performed event on the textFieldpublic void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
the
- focus gained eventpublic void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
the
- focus lost event on the textFieldpublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
public void refresh(com.sas.ModelInterface model)
model
- the model to refresh the SpinBox with.public void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
removeAdjustmentListener
in interface java.awt.Adjustable
l
- the adjustment listeneraddAdjustmentListener(java.awt.event.AdjustmentListener)
,
AdjustmentEvent
public void removeItemListener(java.awt.event.ItemListener l)
removeItemListener
in interface java.awt.ItemSelectable
l
- the item listeneraddItemListener(java.awt.event.ItemListener)
,
ItemEvent
public void setAlarm(Alarm alarm)
alarm
- the spinButton alarmSpinButton.setAlarm(com.sas.util.Alarm)
public void setArrowDirection(int d)
d
- the UP_DOWN or the LEFT_RIGHT values.getArrowDirection()
public void setBlockIncrement(int block)
setBlockIncrement
in interface java.awt.Adjustable
Adjustable
,
SpinButton
,
getBlockIncrement()
public void setColumns(int cols)
cols
- the number of columns of textpublic void setCycleOn(boolean cycle)
cycle
- true if the values will be cycled through; false otherwise.isCycleOn()
public void setDefaultValues()
public void setDelay(long delay)
delay
- the delay before the spinButton begins incrementing its value.getDelay()
public void setStartInterval(long startInterval)
startInterval
- the start interval between spinButton value increments.getStartInterval()
public void setDisplayTransform(com.sas.util.transforms.TransformInterface transform)
transform
- the displayTransformpublic final void setDoubleData(double d)
setNumberValue(Number)
method.
setDoubleData
in interface com.sas.lang.DoubleDataInterface
d
- new double valuegetDoubleData()
,
setNumberValue(java.lang.Number)
,
DoubleDataInterface
public void setEnabled(boolean e)
setEnabled
in class javax.swing.JComponent
e
- true to enable the SpinBox; false to disable itpublic void setMaximum(int max)
setMaximum
in interface java.awt.Adjustable
max
- the integer maximum valuegetMaximum()
public void setMinimum(int min)
setMinimum
in interface java.awt.Adjustable
min
- the integer minimum valuegetMinimum()
public void setBlockIncrementNumber(java.lang.Number block)
Adjustable
,
SpinButton
,
setBlockIncrement(int)
public void setMaximumNumber(java.lang.Number max)
max
- the maximum number value for the SpinBoxBoundedNumberInterface
,
getMaximumNumber()
public void setMinimumNumber(java.lang.Number min)
min
- the minimum number value for the SpinBoxBoundedNumberInterface
,
getMinimumNumber()
public void setUnitIncrementNumber(java.lang.Number unit)
unit
- the unitIncrement number value for the SpinBoxBoundedNumberInterface
,
getUnitIncrementNumber()
public void setNumberValue(java.lang.Number value)
value
- the number value for the SpinBoxBoundedNumberInterface
,
getNumberValue()
public void setNumberFormat(java.text.NumberFormat nf)
nf
- the NumberFormat object used to format the value set as the text in the textFieldNumberFormat
public void setOrientation(int orient)
orient
- an orientation value from java.awt.AdjustableAdjustable
,
getOrientation()
public void setText(java.lang.String txt)
setText
in interface com.sas.lang.StringDataInterface
txt
- the new text of the SpinBoxgetText()
protected void handleError()
public void setUnitIncrement(int unit)
setUnitIncrement
in interface java.awt.Adjustable
unit
- the new unitIncrement.Adjustable
,
getUnitIncrement()
public void setValue(int val)
setValue
in interface java.awt.Adjustable
val
- the new integer valueAdjustable
,
getValue()
public void setValidator(ValidationInterface newValidator)
public ValidationInterface getValidator()
public void setErrorHandler(GenericErrorHandlerInterface newErrorHandler)
public GenericErrorHandlerInterface getErrorHandler()
public void setVisibleAmount(int amt)
setVisibleAmount
in interface java.awt.Adjustable
Adjustable
protected void updateText(java.lang.Number newValue)
protected void updateValue(java.lang.String txt)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |