com.sas.visuals
Class Scrollbar

com.sas.visuals.Scrollbar
All Implemented Interfaces:
CompositeInterface, ContainerInterface, com.sas.awt.print.PrintableInterface, VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.DesignTimeDropTargetInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, com.sas.models.IncrementInterface, ValidatorInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.awt.Adjustable, java.awt.event.ActionListener, java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener

public class Scrollbar
implements java.awt.event.ActionListener, java.awt.Adjustable, java.awt.event.AdjustmentListener, com.sas.models.IncrementInterface

Scrollbar is a class that creates a lightweight scrollbar. This scrollbar has default behavior similar to the java.awt.Scrollbar. It supports a com.sas.models.BoundedNumberInterface model, and uses a com.sas.models.BoundedLong model by default.

Notes:


See Also:
ScrollSlider, ArrowButton, Serialized Form

Field Summary
protected  java.awt.event.AdjustmentListener adjustmentListener
           
protected  ArrowButton downArrow
           
protected  ScrollSlider trackArea
           
protected  ArrowButton upArrow
           
 
Fields inherited from class com.sas.visuals.CompositeContainer
RB_KEY
 
Constructor Summary
Scrollbar()
          Default constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          java.awt.event.ActionListener method to handle ActionEvents that the Scrollbar listens for.
 void addAdjustmentListener(java.awt.event.AdjustmentListener l)
          Add a listener to receive adjustment events when the value of the ScrollBar changes.
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
          java.awt.event.AdjustmentListener method to handle AdjustmentEvents that the Scrollbar listens for.
 void attachModel(com.sas.ModelInterface model)
          Attaches the specified model to the Scrollbar.
 void detachModel(com.sas.ModelInterface model)
          Detaches the specified model from the Scrollbar.
 int getBlockIncrement()
          Get the integer value of the blockIncrement property.
 java.lang.Number getBlockIncrementNumber()
          Get the blockIncrement number based on the model.
static int getDefaultHeight()
          Return the default height
static int getDefaultWidth()
          Return the default width
 long getDelay()
          Return the amount of delay before the scrollbar begins to powerscroll.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 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.
 int getMinimumThumbHeight()
          Get the minimum pixel height of the thumb area.
 com.sas.ModelInterface getModelInterface()
          Get the connected model.
 java.lang.Number getNumberValue()
          Get the value number based on the model.
 int getOrientation()
          Get the orientation of the scrollbar.
 java.util.Vector getRequiredInterfaces()
          Returns the required interfaces Vector for this component.
 com.sas.util.transforms.TransformInterface getRoundNumberTransform()
          Get the transform used to round the numberValue set when the thumb area of the slider is dragged.
 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()
          Get the integer value of the visible amount of the thumb.
 java.lang.Number getVisibleAmountNumber()
          Get the Number value of the visible amount of the thumb.
 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 isMaximumReachable()
          Returns if the thumb area can drag the value to the maximum.
protected  void processAdjustmentEvent(java.awt.event.AdjustmentEvent e)
          Process adjustment events.
protected  void processEvent(java.awt.AWTEvent e)
          Process events.
 void propertyChange(java.beans.PropertyChangeEvent event)
          java.beans.PropertyChangeListener method to handle PropertyChangeEvents that the Scrollbar listens for.
 void refresh(com.sas.ModelInterface model)
          Refresh the Scrollbar based on its model.
 void removeAdjustmentListener(java.awt.event.AdjustmentListener l)
          Remove the adjustment listener.
 void setBlockIncrement(int block)
          Set the integer value of the blockIncrement property.
 void setBlockIncrementNumber(java.lang.Number block)
          Set the blockIncrement number.
static void setDefaultHeight(int newDefaultHeight)
          Set the default height
 void setDefaultValues()
          Set the default values for the properties of the Scrollbar.
static void setDefaultWidth(int newDefaultWidth)
          Set the default width
 void setDelay(long delay)
          Set the amount of delay before the scrollbar begins to powerscroll.
 void setEnabled(boolean enabled)
          Set the enabled state of the Scrollbar.
 void setMaximum(int max)
          Set the integer value of the maximum bounds.
 void setMaximumNumber(java.lang.Number max)
          Set the maximum bounds number.
 void setMaximumReachable(boolean reachable)
          Set whether the thumb area can drag the value to the maximum.
 void setMinimum(int min)
          Set the integer value of the minimum property.
 void setMinimumNumber(java.lang.Number min)
          Set the minimum bounds number.
 void setMinimumThumbHeight(int minThumb)
          Set the minimum pixel height of the thumb area.
 void setModelInterface(com.sas.ModelInterface model)
          Set the connected model.
 void setNumberValue(java.lang.Number newValue)
          Set the number value.
 void setOrientation(int orient)
          Set the orientation of the scrollbar.
 void setRoundNumberTransform(com.sas.util.transforms.TransformInterface transform)
          Set the transform used to round the numberValue set when the thumb area of the slider is dragged.
 void setUnitIncrement(int unit)
          Set the integer value of the unitIncrement for the Scrollbar.
 void setUnitIncrementNumber(java.lang.Number unit)
          Set the unitIncrement number.
 void setValue(int newValue)
          Set the integer value of the value property.
 void setVisibleAmount(int amt)
          Set the integer value of the visible amount of the thumb.
 void setVisibleAmountNumber(java.lang.Number amt)
          Set the Number value of the visible amount of the thumb.
 
Methods inherited from class com.sas.awt.ContainerContainerComponent
addNotify, clone, dragEnter, dragLeave, dragOver, drop, getContainerInterfaceSupportInfo, getErrorHandler, getInsets, getValidator, isIDEDnDDropBarrier, isIDEDnDDropTarget, isValid, removeNotify, setContainerInterfaceSupportInfo, setErrorHandler, setIDEDnDDropBarrier, setIDEDnDDropTarget, setInsets, setInsets, setValidator, superAddNotify, superGetInsets, superRemoveNotify, superSetDefaultValues
 
Methods inherited from class com.sas.awt.ContainerVisualComponent
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachView, computePreferredSize, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getMinimumSize, getPageBounds, getPreferredSize, getPrePainter, getPrintOptionsPanel, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, pageExists, paint, print, printFinalize, printInitialize, queryLinks, queryLinks, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setBounds, setComponentDescription, setComponentSupportInfo, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, 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
 
Methods inherited from interface com.sas.awt.ContainerInterface
getComponents, getLayout, invalidate, setLayout, validate
 
Methods inherited from interface com.sas.awt.VisualInterface
computePreferredSize, getBackgroundColor, getBorder, getFont, getForegroundColor, getHeight, getHorizontalPosition, getMinimumSize, getPreferredSize, getPrePainter, getVerticalPosition, getVisualInterfaceSupportInfo, getWidth, isEnabled, isFocus, isTransparent, isVisible, setBackgroundColor, setBorder, setBounds, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setPreferredSize, setPrePainter, setTransparent, setVerticalPosition, setVisible, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate
 

Field Detail

upArrow

protected ArrowButton upArrow

downArrow

protected ArrowButton downArrow

trackArea

protected ScrollSlider trackArea

adjustmentListener

protected transient java.awt.event.AdjustmentListener adjustmentListener
Constructor Detail

Scrollbar

public Scrollbar()
Default constructor.

Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

getDefaultWidth

public static int getDefaultWidth()
Return the default width

Returns:
default width

setDefaultWidth

public static void setDefaultWidth(int newDefaultWidth)
Set the default width

Parameters:
newDefaultWidth - the new default width

getDefaultHeight

public static int getDefaultHeight()
Return the default height

Returns:
default height

setDefaultHeight

public static void setDefaultHeight(int newDefaultHeight)
Set the default height

Parameters:
newDefaultHeight - the new default height

getDelay

public long getDelay()
Return the amount of delay before the scrollbar begins to powerscroll. This value is based off of the UpArrow button delay amount. A -1 will be returned if the UpArrow button does not use an AlarmButtonModel as its buttonModel.

Returns:
the delay before holding down the mouse button will cause the value to scroll automatically.

setDelay

public void setDelay(long delay)
Set the amount of delay before the scrollbar begins to powerscroll. This delay is set on the track area for the block increment and the up/down buttons for the unitIncrement.

Parameters:
delay - the delay before holding down the mouse button will cause the value to scroll automatically.

getRequiredInterfaces

public java.util.Vector getRequiredInterfaces()
Returns the required interfaces Vector for this component. The required interface for the Scrollbar is com.sas.models.BoundedNumberInterface.

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

getOrientation

public int getOrientation()
Get the orientation of the scrollbar. Possible orientation values are java.awt.Adjustable.HORIZONTAL and VERTICAL.

Specified by:
getOrientation in interface java.awt.Adjustable
Returns:
the orientation of the scrollbar

setOrientation

public void setOrientation(int orient)
Set the orientation of the scrollbar. Possible orientation values are java.awt.Adjustable.HORIZONTAL and VERTICAL.

Parameters:
orient - the orientation of the scrollbar

getVisibleAmountNumber

public java.lang.Number getVisibleAmountNumber()
Get the Number value of the visible amount of the thumb.

Returns:
the value of the visible amount of the Scrollbar thumb.

setVisibleAmountNumber

public void setVisibleAmountNumber(java.lang.Number amt)
Set the Number value of the visible amount of the thumb.

Parameters:
amt - the value of the visible amount of the Scrollbar thumb.

getVisibleAmount

public int getVisibleAmount()
Get the integer value of the visible amount of the thumb.

Specified by:
getVisibleAmount in interface java.awt.Adjustable
Returns:
the value of the visible amount of the Scrollbar thumb.

setVisibleAmount

public void setVisibleAmount(int amt)
Set the integer value of the visible amount of the thumb.

Specified by:
setVisibleAmount in interface java.awt.Adjustable
Parameters:
amt - the value of the visible amount of the Scrollbar thumb.

setDefaultValues

public void setDefaultValues()
Set the default values for the properties of the Scrollbar.

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

setEnabled

public void setEnabled(boolean enabled)
Set the enabled state of the Scrollbar.

Specified by:
setEnabled in interface VisualInterface
Overrides:
setEnabled in class ContainerVisualComponent
Parameters:
enabled - if false the thumb is hidden and the arrow buttons are grayed out, otherwise the scrollbar behaves normally.
See Also:
VisualInterface.setEnabled(boolean)

addAdjustmentListener

public void addAdjustmentListener(java.awt.event.AdjustmentListener l)
Add a listener to receive adjustment events when the value of the ScrollBar 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

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
java.awt.event.AdjustmentListener method to handle AdjustmentEvents that the Scrollbar listens for.

Specified by:
adjustmentValueChanged in interface java.awt.event.AdjustmentListener
Parameters:
e - the AdjustmentEvent to handle

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
java.awt.event.ActionListener method to handle ActionEvents that the Scrollbar listens for.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the ActionEvent to handle

attachModel

public void attachModel(com.sas.ModelInterface model)
Attaches the specified model to the Scrollbar.

Specified by:
attachModel in interface com.sas.ViewInterface
Overrides:
attachModel in class ContainerVisualComponent
Parameters:
model - the model to attach to
See Also:
ViewInterface.attachModel(com.sas.ModelInterface)

detachModel

public void detachModel(com.sas.ModelInterface model)
Detaches the specified model from the Scrollbar.

Specified by:
detachModel in interface com.sas.ViewInterface
Overrides:
detachModel in class ContainerVisualComponent
Parameters:
model - the model to detach from
See Also:
ViewInterface.detachModel(com.sas.ModelInterface)

getModelInterface

public com.sas.ModelInterface getModelInterface()
Get the connected model.

Specified by:
getModelInterface in interface com.sas.ViewInterface
Overrides:
getModelInterface in class ContainerVisualComponent
Returns:
the connected model or null if none is attached.
See Also:
ViewInterface.getModelInterface()

setModelInterface

public void setModelInterface(com.sas.ModelInterface model)
Set the connected model. This will detach the old model and attach the new model.

Specified by:
setModelInterface in interface com.sas.ViewInterface
Overrides:
setModelInterface in class ContainerVisualComponent
Parameters:
model - the new model for the Scrollbar
See Also:
ViewInterface.setModelInterface(com.sas.ModelInterface)

refresh

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

Specified by:
refresh in interface com.sas.ViewInterface
Overrides:
refresh in class ContainerVisualComponent
Parameters:
model - Model that has just been updated
See Also:
ViewInterface.refresh(com.sas.ModelInterface)

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

processEvent

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

Overrides:
processEvent in class java.awt.Container

processAdjustmentEvent

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


propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
java.beans.PropertyChangeListener method to handle PropertyChangeEvents that the Scrollbar listens for.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class ContainerVisualComponent
Parameters:
event - the PropertyChangeEvent to handle
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

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)

getMaximum

public final int getMaximum()
Get the value of the maximum property. This method calls getMaximumNumber() and returns intValue().

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().

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

getUnitIncrement

public final int getUnitIncrement()
Get the value of the unitIncrement property. 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)

setBlockIncrement

public final void setBlockIncrement(int block)
Set 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()

isMaximumReachable

public boolean isMaximumReachable()
Returns if the thumb area can drag the value to the maximum. The default is false. Causing the reachable maximum to be adjusted based on the visibleAmountNumber.

Returns:
true if the thumb can be dragged to cause the value to be set to the maximum.

setMaximumReachable

public void setMaximumReachable(boolean reachable)
Set whether the thumb area can drag the value to the maximum. The default is false. Causing the reachable maximum to be adjusted based on the visibleAmountNumber.

Parameters:
reachable - set whether the thumb value can reach the maximum.

setMaximum

public final void setMaximum(int max)
Set 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)
Set 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()

getMinimumThumbHeight

public int getMinimumThumbHeight()
Get the minimum pixel height of the thumb area.

Returns:
the minimum pixel height of the thumb area.

setMinimumThumbHeight

public void setMinimumThumbHeight(int minThumb)
Set the minimum pixel height of the thumb area.

Parameters:
minThumb - the minimum pixel height of the thumb area.

getRoundNumberTransform

public com.sas.util.transforms.TransformInterface getRoundNumberTransform()
Get the transform used to round the numberValue set when the thumb area of the slider is dragged. The number passed to the transform will be a Double.

Returns:
the transform used to round the numberValue set when the slider is dragged

setRoundNumberTransform

public void setRoundNumberTransform(com.sas.util.transforms.TransformInterface transform)
Set the transform used to round the numberValue set when the thumb area of the slider is dragged. The number passed to the transform will be a Double.

Parameters:
transform - the transform used to round the numberValue set when the slider is dragged

setUnitIncrement

public final void setUnitIncrement(int unit)
Set the integer value of the unitIncrement for the Scrollbar. 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 Scrollbar is triggered.
See Also:
getUnitIncrement()

setValue

public final void setValue(int newValue)
Set 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 Scrollbar.
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)
Set the maximum bounds number.

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

setMinimumNumber

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

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

setBlockIncrementNumber

public void setBlockIncrementNumber(java.lang.Number block)
Set 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)
Set 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)
Set the number value.

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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.