com.sas.visuals
Class SpinButton

com.sas.visuals.SpinButton
All Implemented Interfaces:
com.sas.awt.print.PrintableInterface, VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.models.IncrementInterface, AlarmListener, com.sas.ViewDefaultModelInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.awt.Adjustable, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener

public class SpinButton
implements java.awt.Adjustable, AlarmListener, java.beans.PropertyChangeListener, com.sas.models.IncrementInterface, com.sas.ViewDefaultModelInterface

SpinButton is a class that creates a component with two opposing arrow buttons that can be pressed to increment or decrement a value field.

Creating a SpinButton Component

A valid instance is created by instantiating an object of SpinButton from one of the two constructors.

 // Default Constructor
 SpinButton spinButton1 = new SpinButton();
 // Sets the initial values
 SpinButton spinButton2 = new SpinButton( initialValue, minimum, maximum, unitIncrement, blockIncrement, orientation );
 

Usage

Setting up a Model

The SpinButton component uses a model that implements the com.sas.models.BoundedNumberInterface. A default model of BoundedLong is created and attached in setDefaultValues(). If the model is ever set to null, the default model is reattached.

Range

The range of the SpinButton can be set using the setMinium(int) and setMaximum(int) methods. The SpinButton value will increment/decrement to the minimum and maximum values, inclusively. A click of the increment or decrement button will change the value by the unitIncrement amount.

Orientation

The SpinButton arrows can be positioned either horizontally or vertically based on the orientation of the SpinButton. If the arrows are oriented horizontally the increment button is the right arrow and the decrement is the left arrow. If the arrows are oriented vertically the increment button is the top arrow and the decrement button is the bottom arrow. The functions of the buttons can be swapped by calling swapButtonFunctions().

Cycle

The SpinButton can be set to allow the value to cycle from minimum to maximum and back to minimum.

Alarm

An Alarm object can be set on the SpinButton to cause the buttons to increment everytime the alarm is fired while a button is held down. The start delay of the alarm allows time for a user to press and release the button without starting the alarm. Once the alarm is started, the interval used to fire the alarm is decremented by 100ms every time the alarm fires, to speed up the firing rate of the alarm, until the interval is less than or equal to 100ms.

Handling Events

The SpinButton sends out java.beans.PropertyChangeEvent events for all of its properties and also sends out java.awt.event.AdjustmentEvent events when the value is changed.
Notes:


See Also:
SpinBox, BoundedLong, BoundedDouble, BoundedNumberInterface, Serialized Form

Field Summary
protected  com.sas.models.BoundedNumberInterface defaultRangeModel
          the default range model for the spin button
protected  long delay
           
static int LEFT_RIGHT
          int values representing the orientation of the spinButton- LEFT_RIGHT
protected  long startInterval
           
static int UP_DOWN
          int values representing the orientation of the spinButton- UP_DOWN
protected  Alarm valueChangeAlarm
           
 
Constructor Summary
SpinButton()
          Default constructor.
SpinButton(int value, int min, int max, int unit, int block, int orient)
          Constructor taking all the neccessary variables needed to create a spinButton.
 
Method Summary
 void addAdjustmentListener(java.awt.event.AdjustmentListener l)
          Add a listener to receive adjustment events when the value of the SpinButton changes.
protected  void checkEnabled()
          Check if the buttons should be enabled or disabled based on the value and the maximum and the minimum.
 java.awt.Dimension computePreferredSize()
          Get the preferredSize of the RadioButton.
 void detachModel(com.sas.ModelInterface model)
          Detach the specified model from the SpinBox.
 void fireAlarm(AlarmEvent evt)
          Invoked when a AlarmEvent is fired by the alarm.
 Alarm getAlarm()
          Deprecated.  
 int getArrowDirection()
          Get the direction the arrows are pointing.
 int getBlockIncrement()
          Get the integer value of the blockIncrement property.
 java.lang.Number getBlockIncrementNumber()
          Get the blockIncrement number based on the model.
 int getButtonGap()
          Get the pixel value of the buttonGap property.
static int getDefaultHeight()
          Returns the default height in pixels
static int getDefaultWidth()
          Returns the default width in pixels
 long getDelay()
          Get the delay before the alarm begins sending AlarmEvents.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a SpinButton.
 int getMaximum()
          Get the value of the maximum property.
 java.lang.Number getMaximumNumber()
          Get the maximum bounds number based on the model.
 int getMinimum()
          Get the value of the minimum property.
 java.lang.Number getMinimumNumber()
          Get the minimum bounds number based on the model.
 java.awt.Dimension getMinimumSize()
          Get the preferredSize of the RadioButton.
 java.lang.Number getNumberValue()
          Get the value number based on the model.
 int getOrientation()
          Get the value of the orientation property.
 java.util.Vector getRequiredInterfaces()
          Returns the required interfaces Vector for this component.
 long getStartInterval()
          Get the start interval for the alarm.
 int getUnitIncrement()
          Get the value of the unitIncrement property.
 java.lang.Number getUnitIncrementNumber()
          Get the unitIncrement number based on the model.
 int getValue()
          Get the integer value of the value property.
 int getVisibleAmount()
          NOT USED, only here to satisfy Adjustable interface and alway returns 0
 java.lang.Number incrementBy(int increment, int incrementType)
          Increment, by unit or block increment amount, the current value by the specified number of increments.
 boolean isCycleOn()
          Indicates whether the spinButton value is cycled to the opposite bound when the increment exceeds the bounds.
 boolean isDecrementEnabled()
          Get the enabled state of the button that decrements the value.
 boolean isDefaultModelAttached()
          Returns whether the model is attached or not
 boolean isIncrementEnabled()
          Get the enabled state of the button that increments the value.
 void paint(java.awt.Graphics g)
          Paint the SpinButton.
protected  void processAdjustmentEvent(java.awt.event.AdjustmentEvent e)
          Process adjustment events.
protected  void processEvent(java.awt.AWTEvent e)
          Process events.
protected  void processMouseEvent(java.awt.event.MouseEvent evt)
          Process the any MouseEvents on the SpinButton.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Invoked when a bound property is changed.
 void refresh(com.sas.ModelInterface model)
          Refresh the spinButton based on its model.
 void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
          Remove the adjustment listener.
 void setAlarm(Alarm alarm)
          Deprecated.  
 void setArrowDirection(int d)
          Sets the direction the arrows are pointing.
 void setBlockIncrement(int block)
          Sets the integer value of the blockIncrement property.
 void setBlockIncrementNumber(java.lang.Number block)
          Sets the blockIncrement number.
 void setBounds(int x, int y, int width, int height)
          Call super.setBounds() and then repaint the entire component.
 void setButtonGap(int gap)
          Sets the pixel value of the gap between the arrow buttons.
 void setCycleOn(boolean cycle)
          Sets the SpinButton to cycle the value to the opposite bound when the bounds are reached.
 void setDecrementEnabled(boolean decrEnabled)
          Sets the decrement button enabled.
static void setDefaultHeight(int newHeight)
          Sets the default height in pixels
 void setDefaultValues()
          Sets the initial values to the default values.
static void setDefaultWidth(int newWidth)
          Sets the default width in pixels
 void setDelay(long d)
          Sets the delay before the alarm begins sending AlarmEvents.
 void setEnabled(boolean enabled)
          Sets the SpinButton enabled for user input.
 void setIncrementEnabled(boolean incrEnabled)
          Sets the increment button enabled.
 void setMaximum(int max)
          Sets the integer value of the maximum bounds.
 void setMaximumNumber(java.lang.Number max)
          Sets the maximum bounds number.
 void setMinimum(int min)
          Sets the integer value of the minimum property.
 void setMinimumNumber(java.lang.Number min)
          Sets the minimum bounds number.
 void setNumberValue(java.lang.Number newValue)
          Sets the number value.
 void setOrientation(int orient)
          Sets the value of the orientation property, which determines the orientation of the SpinButton arrow buttons.
 void setStartInterval(long interval)
          Sets the start interval for the alarm in milliseconds.
 void setUnitIncrement(int unit)
          Sets the integer value of the unitIncrement for the SpinButton.
 void setUnitIncrementNumber(java.lang.Number unit)
          Sets the unitIncrement number.
 void setValue(int newValue)
          Sets the integer value of the value property.
 void setVisibleAmount(int amount)
          NOT USED, only here to satisfy Adjustable interface.
 int swapButtonFunction()
          Swaps the increment and decrement buttons, so if the incrementer was the Top or Left button, it is now the Bottom or Right button.
 
Methods inherited from class com.sas.awt.ComponentVisualComponent
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, clone, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getModelInterface, getPageBounds, getPreferredSize, getPrePainter, getPrintOptionsPanel, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, pageExists, print, printFinalize, printInitialize, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setComponentDescription, setComponentSupportInfo, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, update, validateObject
 

Field Detail

valueChangeAlarm

protected Alarm valueChangeAlarm

startInterval

protected long startInterval

delay

protected long delay

defaultRangeModel

protected com.sas.models.BoundedNumberInterface defaultRangeModel
the default range model for the spin button


UP_DOWN

public static final int UP_DOWN
int values representing the orientation of the spinButton- UP_DOWN

See Also:
Constant Field Values

LEFT_RIGHT

public static final int LEFT_RIGHT
int values representing the orientation of the spinButton- LEFT_RIGHT

See Also:
Constant Field Values
Constructor Detail

SpinButton

public SpinButton()
Default constructor.


SpinButton

public SpinButton(int value,
                  int min,
                  int max,
                  int unit,
                  int block,
                  int orient)
Constructor taking all the neccessary variables needed to create a spinButton.

Parameters:
value - the current value within the range
min - the minimum value
max - the maximum value
unit - the unit increment
block - the block increment
orient - the orientation of the SpinButton arrow Buttons.
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a SpinButton.

Returns:
the ExtendedBeanInfo for this class

getDefaultHeight

public static int getDefaultHeight()
Returns the default height in pixels

Returns:
pixel value of the default height
See Also:
setDefaultHeight(int)

getDefaultWidth

public static int getDefaultWidth()
Returns the default width in pixels

Returns:
pixel value of default width
See Also:
setDefaultWidth(int)

setDefaultHeight

public static void setDefaultHeight(int newHeight)
Sets the default height in pixels

Parameters:
newHeight - - the desired default height in pixels
See Also:
getDefaultHeight()

setDefaultWidth

public static void setDefaultWidth(int newWidth)
Sets the default width in pixels

Parameters:
newWidth - - the desired default width in pixels
See Also:
setDefaultWidth(int)

addAdjustmentListener

public void addAdjustmentListener(java.awt.event.AdjustmentListener l)
Add a listener to receive adjustment events when the value of the SpinButton changes.

Specified by:
addAdjustmentListener in interface java.awt.Adjustable
Parameters:
l - the adjustment listener
See Also:
Adjustable.addAdjustmentListener(java.awt.event.AdjustmentListener), AdjustmentEvent

removeAdjustmentListener

public void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
Remove the adjustment listener.

Specified by:
removeAdjustmentListener in interface java.awt.Adjustable
Parameters:
l - the adjustment listener
See Also:
addAdjustmentListener(java.awt.event.AdjustmentListener), AdjustmentEvent

checkEnabled

protected void checkEnabled()
Check if the buttons should be enabled or disabled based on the value and the maximum and the minimum. Nothing is disabled if cycleValue is on. The incrementor is disabled when the value equals the maximum and the decrementor is disabled when the value equals the minimum.


computePreferredSize

public java.awt.Dimension computePreferredSize()
Get the preferredSize of the RadioButton.

Specified by:
computePreferredSize in interface VisualInterface
Overrides:
computePreferredSize in class ComponentVisualComponent
Returns:
the minimumSize if no resizing has been done, otherwise the current size.
See Also:
VisualInterface.computePreferredSize()

detachModel

public void detachModel(com.sas.ModelInterface model)
Detach the specified model from the SpinBox. The defaultModel will be attached if the model is set to null.

Specified by:
detachModel in interface com.sas.ViewInterface
Overrides:
detachModel in class ComponentVisualComponent
Parameters:
model - - ModelInterface object to be removed from the SpinButton
See Also:
ViewInterface.detachModel(com.sas.ModelInterface)

fireAlarm

public void fireAlarm(AlarmEvent evt)
Invoked when a AlarmEvent is fired by the alarm. The alarm is started any time the SpinButton is held down.

Specified by:
fireAlarm in interface AlarmListener
Parameters:
evt - the AlarmEvent fired

getAlarm

public Alarm getAlarm()
Deprecated. 

Get the Alarm used to trigger events when the SpinButton is pressed.

Returns:
the alarm that triggers the events when the SpinButton is held.
See Also:
setAlarm(com.sas.util.Alarm)

getArrowDirection

public int getArrowDirection()
Get the direction the arrows are pointing.

Returns:
the UP_DOWN or the LEFT_RIGHT values.
See Also:
setArrowDirection(int)

getBlockIncrement

public final int getBlockIncrement()
Get the integer value of the blockIncrement property. This method calls getBlockIncrementNumber() and returns the intValue().

Specified by:
getBlockIncrement in interface java.awt.Adjustable
Returns:
the value of the blockIncrement property.
See Also:
setBlockIncrement(int)

getButtonGap

public int getButtonGap()
Get the pixel value of the buttonGap property. The gap in pixel specifies the amount of space between the two arrow buttons.

Returns:
the value of the buttonGap property.
See Also:
setButtonGap(int)

getDelay

public long getDelay()
Get the delay before the alarm begins sending AlarmEvents. The delay is in milliseconds.

Returns:
the milliseconds to delay firing the alarm.
See Also:
setDelay(long)

getMaximum

public final int getMaximum()
Get the value of the maximum property. This method calls getMaximumNumber() and returns intValue(). The value is based on the model attached to the spin button

Specified by:
getMaximum in interface java.awt.Adjustable
Returns:
the value of the maximum property.
See Also:
setMaximum(int)

getMinimum

public final int getMinimum()
Get the value of the minimum property. This method calls getMinimumNumber() and returns intValue(). The value is based on the model attached to the spin button

Specified by:
getMinimum in interface java.awt.Adjustable
Returns:
the value of the minimum property.
See Also:
setMinimum(int)

getOrientation

public int getOrientation()
Get the value of the orientation property.

Specified by:
getOrientation in interface java.awt.Adjustable
Returns:
the value of the orientation property.
See Also:
Adjustable, setOrientation(int)

getRequiredInterfaces

public java.util.Vector getRequiredInterfaces()
Returns the required interfaces Vector for this component.

Specified by:
getRequiredInterfaces in interface com.sas.ViewInterface
Overrides:
getRequiredInterfaces in class ComponentVisualComponent
Returns:
the required interfaces Vector for this component.
See Also:
ViewInterface.getRequiredInterfaces()

getMinimumSize

public java.awt.Dimension getMinimumSize()
Get the preferredSize of the RadioButton.

Specified by:
getMinimumSize in interface VisualInterface
Overrides:
getMinimumSize in class Component
Returns:
the minimumSize if no resizing has been done, otherwise the current size.
See Also:
VisualInterface.getMinimumSize()

getStartInterval

public long getStartInterval()
Get the start interval for the alarm. The alarm interval gets shorter the longer the alarm is fired( the longer the button is held down).

Returns:
the start interval for the alarm.
See Also:
setStartInterval(long)

getUnitIncrement

public final int getUnitIncrement()
Get the value of the unitIncrement property. This specifies how much the value in the spin button will be incremented every time the up or down arrows are pressed. This method calls getUnitIncrementNumber() and returns intValue().

Specified by:
getUnitIncrement in interface java.awt.Adjustable
Returns:
the value of the unitIncrement property.
See Also:
setUnitIncrement(int)

getValue

public final int getValue()
Get the integer value of the value property. This method calls getNumberValue() and returns intValue().

Specified by:
getValue in interface java.awt.Adjustable
Returns:
the value of the value property.
See Also:
setValue(int)

getVisibleAmount

public int getVisibleAmount()
NOT USED, only here to satisfy Adjustable interface and alway returns 0

Specified by:
getVisibleAmount in interface java.awt.Adjustable

isCycleOn

public boolean isCycleOn()
Indicates whether the spinButton value is cycled to the opposite bound when the increment exceeds the bounds.

Returns:
true if the spinButton value will cycle from max to min when it reaches the max or min to max when it reaches the min.

isDefaultModelAttached

public boolean isDefaultModelAttached()
Returns whether the model is attached or not

Specified by:
isDefaultModelAttached in interface com.sas.ViewDefaultModelInterface
Returns:
boolean representing whether model is attached

isDecrementEnabled

public boolean isDecrementEnabled()
Get the enabled state of the button that decrements the value.

Returns:
false, if the decrement button is grayed and doesn't respond to user input.

isIncrementEnabled

public boolean isIncrementEnabled()
Get the enabled state of the button that increments the value.

Returns:
false, if the increment button is grayed and doesn't respond to user input.

incrementBy

public java.lang.Number incrementBy(int increment,
                                    int incrementType)
Increment, by unit or block increment amount, the current value by the specified number of increments. The current value will be incremented( or decremented ) within the bounds of the maximum and minimum values.

Specified by:
incrementBy in interface com.sas.models.IncrementInterface
Parameters:
increment - The number of incrementType(unit or block) amounts to increment the current value(can be negative to decrement value).
incrementType - UNIT to increment by the unit amount; BLOCK to increment by the block amount

paint

public void paint(java.awt.Graphics g)
Paint the SpinButton.

Overrides:
paint in class ComponentVisualComponent
Parameters:
g - the graphics context
See Also:
VisualInterfaceSupport.paint(com.sas.ComponentInterface, com.sas.awt.VisualInterface, java.awt.Component, java.awt.Graphics)

processEvent

protected void processEvent(java.awt.AWTEvent e)
Process events.

Overrides:
processEvent in class java.awt.Component
Parameters:
e - the awt event that has changed

processAdjustmentEvent

protected void processAdjustmentEvent(java.awt.event.AdjustmentEvent e)
Process adjustment events.

Parameters:
e - the adjustment event that has changed

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent evt)
Process the any MouseEvents on the SpinButton.

Overrides:
processMouseEvent in class java.awt.Component
Parameters:
evt - the mouse event that has occurred

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
Invoked when a bound property is changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class ComponentVisualComponent
Parameters:
event - the property event that has changed
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

refresh

public void refresh(com.sas.ModelInterface model)
Refresh the spinButton based on its model.

Specified by:
refresh in interface com.sas.ViewInterface
Overrides:
refresh in class ComponentVisualComponent
Parameters:
model - the ModelInterface that has changed and need to be refreshed
See Also:
ViewInterface.refresh(com.sas.ModelInterface)

setArrowDirection

public void setArrowDirection(int d)
Sets the direction the arrows are pointing.

Parameters:
d - the UP_DOWN or the LEFT_RIGHT values.
See Also:
getArrowDirection()

setBlockIncrement

public final void setBlockIncrement(int block)
Sets the integer value of the blockIncrement property. This method calls getBlockIncrementNumber() and returns intValue().

Specified by:
setBlockIncrement in interface java.awt.Adjustable
Parameters:
blockIncrement - the new value of the blockIncrement property.
See Also:
getBlockIncrement()

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Call super.setBounds() and then repaint the entire component.

Specified by:
setBounds in interface VisualInterface
Overrides:
setBounds in class ComponentVisualComponent
See Also:
ComponentVisualComponent.setBounds(int, int, int, int)

setButtonGap

public void setButtonGap(int gap)
Sets the pixel value of the gap between the arrow buttons.

Parameters:
gap - the pixel gap between the arrow buttons
See Also:
getButtonGap()

setCycleOn

public void setCycleOn(boolean cycle)
Sets the SpinButton to cycle the value to the opposite bound when the bounds are reached.

Parameters:
cycle - if the cycle is on

setDecrementEnabled

public void setDecrementEnabled(boolean decrEnabled)
Sets the decrement button enabled.

Parameters:
decrEnabled - if true, the decrement button will be enabled; otherwise it will be grayed and disabled to user input.

setDefaultValues

public void setDefaultValues()
Sets the initial values to the default values.

Specified by:
setDefaultValues in interface VisualInterface
Specified by:
setDefaultValues in interface com.sas.ComponentInterface
Overrides:
setDefaultValues in class Component
See Also:
ComponentInterface.setDefaultValues()

setAlarm

public void setAlarm(Alarm alarm)
Deprecated. 

Sets the alarm used to trigger increments or decrements when the increment or decrement button is held down. The SpinButton is added as an AlarmListener to the Alarm object.

Parameters:
alarm - the alarm to trigger the value change.
See Also:
getAlarm(), AlarmListener

setDelay

public void setDelay(long d)
Sets the delay before the alarm begins sending AlarmEvents. The delay is in milliseconds.

Parameters:
d - the milliseconds to delay firing the alarm.
See Also:
getDelay()

setEnabled

public void setEnabled(boolean enabled)
Sets the SpinButton enabled for user input.

Specified by:
setEnabled in interface VisualInterface
Overrides:
setEnabled in class ComponentVisualComponent
Parameters:
enabled - true to allow user input, false otherwise
See Also:
ComponentVisualComponent.isEnabled()

setIncrementEnabled

public void setIncrementEnabled(boolean incrEnabled)
Sets the increment button enabled.

Parameters:
incrEnabled - if true, the increment button will be enabled; otherwise it will be grayed and disabled to user input.

setMaximum

public final void setMaximum(int max)
Sets the integer value of the maximum bounds. This method calls setMaximumNumber() passing it a java.lang.Long created from max.

Specified by:
setMaximum in interface java.awt.Adjustable
Parameters:
max - the new value of the maximum bounds.
See Also:
getMaximum()

setMinimum

public final void setMinimum(int min)
Sets the integer value of the minimum property. This method calls setMinimumNumber() passing it a java.lang.Long created from min.

Specified by:
setMinimum in interface java.awt.Adjustable
Parameters:
min - the new value of the minimum bounds.
See Also:
getMinimum()

setOrientation

public void setOrientation(int orient)
Sets the value of the orientation property, which determines the orientation of the SpinButton arrow buttons. Calling setOrientation in conjunction with a swapButtonFunction() method call can cancel both calls out. If the setOrientation method is called after the buttons have been swapped the buttons will be back in their default positions for the respective orientation that they were set to. Another call to swapButtonFunction() is required to swap the buttons back to their previous state before the setOrientation() call.

Parameters:
orientation - the new value of the orientation property: either HORIZONTAL or VERTICAL.
See Also:
swapButtonFunction(), getOrientation()

setStartInterval

public void setStartInterval(long interval)
Sets the start interval for the alarm in milliseconds. The alarm interval gets shorter the longer the alarm is fired( the longer the button is held down).

Parameters:
interval - the start interval for the alarm.
See Also:
getStartInterval()

setUnitIncrement

public final void setUnitIncrement(int unit)
Sets the integer value of the unitIncrement for the SpinButton. Sets the value by how much the spin button will increment or decrement when the buttons are pressed. This method calls setUnitIncrementNumber() passing it a java.lang.Long created from unit.

Specified by:
setUnitIncrement in interface java.awt.Adjustable
Parameters:
unit - the amount the value is incremented/decremented when the SpinButton is triggered.
See Also:
getUnitIncrement()

setValue

public final void setValue(int newValue)
Sets the integer value of the value property. This method calls setNumberValue() passing it a java.lang.Long created from newValue.

Specified by:
setValue in interface java.awt.Adjustable
Parameters:
newValue - the new value of the SpinButton.
See Also:
getValue()

getUnitIncrementNumber

public java.lang.Number getUnitIncrementNumber()
Get the unitIncrement number based on the model.

Specified by:
getUnitIncrementNumber in interface com.sas.models.IncrementInterface
Returns:
the model unitIncrement number or null if no model is set.
See Also:
setUnitIncrementNumber(java.lang.Number)

getBlockIncrementNumber

public java.lang.Number getBlockIncrementNumber()
Get the blockIncrement number based on the model.

Specified by:
getBlockIncrementNumber in interface com.sas.models.IncrementInterface
Returns:
the model blockIncrement number or null if no model is set.
See Also:
setBlockIncrementNumber(java.lang.Number)

getMaximumNumber

public java.lang.Number getMaximumNumber()
Get the maximum bounds number based on the model.

Returns:
the model maximum bounds number or null if no model is set.
See Also:
setMaximumNumber(java.lang.Number)

getMinimumNumber

public java.lang.Number getMinimumNumber()
Get the minimum bounds number based on the model.

Returns:
the model minimum bounds number or null if no model is set.
See Also:
setMinimumNumber(java.lang.Number)

getNumberValue

public java.lang.Number getNumberValue()
Get the value number based on the model.

Returns:
the model value number or null if no model is set.
See Also:
setNumberValue(java.lang.Number)

setMaximumNumber

public void setMaximumNumber(java.lang.Number max)
Sets the maximum bounds number.

Parameters:
max - the new maximum bounds for the SpinButton value.
See Also:
getMaximumNumber()

setMinimumNumber

public void setMinimumNumber(java.lang.Number min)
Sets the minimum bounds number.

Parameters:
min - the new minimum bounds for the SpinButton value.
See Also:
getMinimumNumber()

setBlockIncrementNumber

public void setBlockIncrementNumber(java.lang.Number block)
Sets the blockIncrement number.

Specified by:
setBlockIncrementNumber in interface com.sas.models.IncrementInterface
Parameters:
block - the new blockIncrement number.
See Also:
getBlockIncrementNumber()

setUnitIncrementNumber

public void setUnitIncrementNumber(java.lang.Number unit)
Sets the unitIncrement number.

Specified by:
setUnitIncrementNumber in interface com.sas.models.IncrementInterface
Parameters:
unit - the new blockIncrement number.
See Also:
getUnitIncrementNumber()

setNumberValue

public void setNumberValue(java.lang.Number newValue)
Sets the number value.

Parameters:
newValue - the new SpinButton value.
See Also:
getNumberValue()

setVisibleAmount

public void setVisibleAmount(int amount)
NOT USED, only here to satisfy Adjustable interface.

Specified by:
setVisibleAmount in interface java.awt.Adjustable

swapButtonFunction

public int swapButtonFunction()
Swaps the increment and decrement buttons, so if the incrementer was the Top or Left button, it is now the Bottom or Right button. Possible problem occurs when called at the same time as the setOrientation() method. If the setOrientation method is called after the buttons have been swapped the buttons will be back in their default positions for the respective orientation that they were set to. Another call to swapButtonFunction() is required to swap the buttons back to their previous state before the setOrientation call.

Returns:
0 if the incrementer is the Top or Left buttons; 1 if the incrementer is the Bottom or Right buttons.
See Also:
setOrientation(int)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.