danger.ui
Class Slider

java.lang.Object
  extended by danger.app.Listener
      extended by danger.ui.View
          extended by danger.ui.Container
              extended by danger.ui.Control
                  extended by danger.ui.Slider
All Implemented Interfaces:
ISliderData, ToolTipOwner
Direct Known Subclasses:
MediaVolumeSlider, PhoneVolumeSlider, ProfileSlider


public class Slider
extends Control
implements ISliderData

Slider - General purpose Slider control. Slider has three different states: COMPRESSED Slider is shown as a Button with a Title and an Icon. The current value is shown using an icon displayed to the right of the title. UNCOMPRESSED Slider is shown as a Button with a Title and an inactive slider control. The current value is shown in the slider to the right of the title. WINDOW_ONLY Slider is shown as a Window with a Title and an active Slider control. Sliders are created in one of two states, COMPRESSED or UNCOMPRESSED. They are both the same height, but the COMPRESSED state is not as wide as the UNCOMPRESSED state. The current value is shown, but you cannot change the value until you click on the Slider. When you click on the Slider, a SliderWindow is created that allows you to adjust the value. This Window is NOT a child of the Slider, however it is owned and maintained by the Slider. When the Slider is active, getSliderType will return WINDOW_ONLY.


Field Summary
 
Fields inherited from class danger.ui.Control
mValue
 
Fields inherited from class danger.ui.View
DEFAULT_SCROLL_FOCUS_MARGIN, FOCUS_DEFAULT, FOCUS_DOWNWARD, FOCUS_LEFTWARD, FOCUS_NONE, FOCUS_RIGHTWARD, FOCUS_UPWARD, mOriginX, mOriginY, mStyle, POSITION_ABOVE, POSITION_ALIGN_BASELINE, POSITION_ALIGN_BOTTOM, POSITION_ALIGN_HORIZONTALLY, POSITION_ALIGN_LEFT, POSITION_ALIGN_PARENT_BOTTOM, POSITION_ALIGN_PARENT_RIGHT, POSITION_ALIGN_RIGHT, POSITION_ALIGN_TOP, POSITION_ALIGN_VERTICALLY, POSITION_BELOW, POSITION_CENTER_HORIZONTALLY, POSITION_CENTER_VERTICALLY, POSITION_TO_LEFT, POSITION_TO_RIGHT, PREFER_DIRECTION_NONE, PREFER_HORIZONTAL_DIRECTION, PREFER_VERTICAL_DIRECTION, STATE_AT_AND_SPACE_PAGE, STATE_CAN_FOCUS, STATE_DEBUG_BOUNDS, STATE_ENABLED, STATE_FOCUSED, STATE_MAKE_DING, STATE_PARTIAL_FOCUS_OK, STATE_TRANSPARENT, STATE_VISIBLE, WIDTH_FILL_TO_RIGHT
 
Fields inherited from interface danger.ui.ISliderData
COMPRESSED, DONT_SHOW_FIRST_OR_LAST_TICK, JUSTIFY_BOTTOM, JUSTIFY_CENTER, JUSTIFY_TOP, LEFT_TO_RIGHT, RIGHT_TO_LEFT, SHOW_FIRST_AND_LAST_TICK, SHOW_FIRST_TICK, SHOW_LAST_TICK, TICK_MARKS_AUTO, TICK_MARKS_OFF, TICK_MARKS_ON, UNCOMPRESSED, WINDOW_ONLY
 
Constructor Summary
Slider()
          Create a Slider with default values.
Slider(int inMinValue, int inValue, int inMaxValue)
          Create a Slider specifying the min, max, and current values.
Slider(int type, int inMinValue, int inValue, int inMaxValue)
          Create a Slider specifying type, min, max, and current values.
Slider(String title)
          Create a Slider specifying the title.
Slider(String title, int type)
          Create a Slider specifying the title and type.
Slider(String title, int inMinValue, int inValue, int inMaxValue)
          Create a Slider specifying title, min, max, and current values.
Slider(String inTitle, int inType, int inMinValue, int inValue, int inMaxValue)
           
 
Method Summary
 void decrement(int delta)
          Decrement the slider value and make sure it doesn't go below the min value.
 void enterPopup()
          Open the Slider window.
 boolean eventKeyUp(char inKey, Event event)
          Processes key releases directed at this container.
 boolean eventWidgetDown(int inWhichWidget, Event event)
          Handle the pressing of a device widget
 boolean eventWidgetUp(int inWhichWidget, Event event)
          Handle the release of a device widget
 void exitPopup()
          Close the Slider window.
 Bitmap[] getBitmaps()
          Get the array of bitmaps associated with the Slider value.
 Bitmap getCurrentBitmap()
          Get the bitmap for the current Slider value.
 String getDescription()
          Get the description text for the Slider.
 int getDirection()
          Get the direction for the indicator.
 Event getEvent()
           
 boolean getHasFrame()
          Gets the display of the standard frame for the slider.
 boolean getHasInnerFrame()
          Gets the display of the inner frame for the slider.
 boolean getHasThumb()
          Gets the display of the thumb.
 int getHasTickMarks()
          Gets whether tick marks are displayed on the indicator.
 boolean getIndicateSingleValue()
          Gets how values should be indicated on the Slider.
 int getIndicatorJustification()
          Gets the justification of the indicator.
 int getIndicatorMargin()
          Gets the margin between the frame and the indicator.
 String getLeftLabel()
          Get the left label for the Slider.
 int getMaxValue()
          Get the maximum value for the Slider.
protected  int getMiddleValue()
          Get the middle value, for use with page-scrolling.
 int getMinValue()
          Get the minimum value for the Slider.
 String getRightLabel()
          Get the right label for the Slider.
 int getScrollAmount(Event event)
          Get the amount to scroll by based on the event.
 int getShowEndTicks()
          Gets whether start and end tick marks are shown on the indicator.
 int getSliderPortionWidth()
          Get the width in pixels of the indicator portion of the Slider.
 int getSliderType()
          Get the type of the Slider.
 int getValue()
          Get the value associated with this instance.
 void increment(int delta)
          Increment the slider value and make sure it doesn't exceed the max value.
protected  void onSetTitle(String title)
          This method is called when the title is set via a call to Control.setTitle(java.lang.String), to allow subclasses to perform any necessary actions associated with the event.
protected  void onStyleChanged(int attribute)
          This method is called when the specified attribute of this view's style has been modified.
 void paint(Pen p)
          Draw the contents of this View.
 void resizeToFit()
          Resize to fit the current parameters.
 void scroll(int delta)
          Scroll the slider value and make sure it doesn't exceed the max or min values.
 void setBitmaps(Bitmap[] inBitmaps)
          Specify an array of bitmaps associated with the Slider value.
 void setDescription(String text)
          Specify a description to be displayed beneath the Slider title and indicator.
 void setDirection(int direction)
          Sets the direction for the indicator.
 void setHasFrame(boolean hasFrame)
          Sets the display of the standard frame for the slider.
 void setHasInnerFrame(boolean hasInnerFrame)
          Sets the display of the inner frame for the slider.
 void setHasThumb(boolean hasThumb)
          Sets the display of the thumb at the end of the indicator.
 void setHasTickMarks(int tickMarks)
          Sets the display of tick marks on the slider.
 void setIndicateSingleValue(boolean indicateSingleValue)
          Sets how values should be indicated on the Slider.
 void setIndicatorJustification(int indicatorJustification)
          Sets the justification of the indicator.
 void setIndicatorMargin(int indicatorMargin)
          Sets the margin between the frame and the indicator.
 void setLabels(String leftLabel, String rightLabel)
          Specify text labels to appear to the right and left of the Slider indicator.
 void setMaxValue(int inMaxValue)
          Set the maximum value for the Slider.
 void setMinValue(int inMinValue)
          Set the minimum value for the Slider.
 void setShowEndTicks(int showEndTicks)
          Sets the display of start and ending tick marks on the slider.
 void setSize(int width, int height)
          Simultaneously set the width and height of this View.
 void setSliderPortionWidth(int inWidth)
          Set the width in pixels of the indicator portion of the Slider.
 void setSliderType(int inType)
          Set the type of the Slider.
 void setSliderWindow(SliderWindow inWindow)
          Set the SliderWindow for this Slider.
 void setTitleSpacing(int titleSpacing)
          Set the title spacing.
 void setValue(int inValue)
          Set the value associated with this instance.
 
Methods inherited from class danger.ui.Control
drawFocusBox, drawIdleBox, drawIdleBox, getBaseline, getEventListener, getEventType, getHasBorder, getMaxToolTipLines, getTitle, getTitleSequence, getToolTip, hasToolTip, loseFocus, onSetHasBorder, sendEvent, setEvent, setEvent, setEvent, setEvent, setEvent, setEventArg, setEventListener, setHasBorder, setMaxToolTipLines, setTitle, setTitle, setToolTip, showToolTip, takeFocus
 
Methods inherited from class danger.ui.Container
addChild, addChild, addChildAt, addChildAt, addFromContainerResource, addFromContainerResource, addFromContainerResource, addFromDialogResource, addFromDialogResource, advanceFocus, advanceFocusInWindow, childCount, childIsOnScreen, disable, enable, eventKeyDown, eventKeyHeld, eventKeyRepeat, eventPeriodicPulse, eventRawKeyDown, eventRawKeyHeld, eventRawKeyRepeat, eventRawKeyUp, eventShortcut, eventWidgetHeld, focusedDescendantIsValid, getBottomChild, getBottomChild, getChildAt, getChildIndex, getChildWithID, getControlWithID, getDescendantWithID, getFirstChild, getFirstFocusableChild, getFocusableChildInWindow, getFocusedChild, getFocusedLeaf, getInterestingRect, getLastChild, getLastFocusableChild, getLeftMostChild, getNextFocusableChild, getNextFocusableChild, getPageHeight, getPrevFocusableChild, getPrevFocusableChild, getRightMostChild, getRightMostChild, handleButtonShortcut, hideAllChildren, isDescendant, keepRectInView, moveChildToIndex, onChildPositionChanged, onChildSizeChanged, onChildVisibilityChanged, pageToEnd, pageToHome, paintChildren, receiveEvent, reflowChildren, removeAllChildren, removeChild, reverseFocus, setFocusedChild, setFocusedChild, setFocusedChild, setFocusedDescendant, setFocusedDescendant, setFocusedDescendant, setFocusToFirstDescendant, setFormatDateForControlWithID, setFormatDateForTextControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setFormatTextForTextControlWithID, setListenerForAllControls, setReflowAdjustHeight, setWindow, showAllChildren, snapHeightToChildren, snapHeightToChildren, snapToChildren, snapWidthToChildren, snapWidthToChildren, willFocusWithin, willFocusWithin
 
Methods inherited from class danger.ui.View
boundsIntersect, boundsIntersect, canLoseFocus, clear, clear, copyStyle, getAcceptFocus, getBackgroundColor, getBottom, getBounds, getBounds, getFocusTraversalDirection, getFocusTraversalFrom, getFocusTraversalPolicy, getFrame, getFrame, getGlobalBottom, getGlobalLeft, getGlobalRight, getGlobalTop, getHeight, getID, getInterestingRect, getLabelFont, getLabelFont, getLeft, getOrigin, getOrigin, getOriginX, getOriginY, getParent, getParentContainer, getPartialFocusOK, getRight, getScrollFocusMargin, getSibling, getState, getStyle, getStyleColor, getStyleFont, getTop, getWidth, getWindow, globalToLocal, globalToLocalH, globalToLocalV, hide, invalidate, invalidate, invalidate, invalidateIndependentOfOrigin, invalidateIndependentOfOrigin, isEnabled, isFocusable, isFocused, isOnScreen, isTransparent, isVisible, isVisibleInHierarchy, isVisibleOnScreen, justSetVisible, localToGlobal, localToGlobal, localToGlobalH, localToGlobalV, localToWindow, moveBy, notifyWhenParentSizeChanges, notifyWhenPositionChanges, notifyWhenSizeChanges, offsetOrigin, offsetOrigin, onAddedToParent, onDecoded, onEnabledStateChanged, onHide, onPeriodicPulse, onPositionChanged, onRemovedFromParent, onShortcut, onShortcut, onShortcutConsumed, onShow, onSizeChanged, onViewPositionChanged, onViewSizeChanged, onWindowPaint, playLimitSound, receiveEventInternal, resetOrigin, sendEventToWindow, setAcceptFocus, setAtAndSpacePage, setBackground, setBackgroundColor, setBottom, setDebugBounds, setDynamicPosition, setDynamicWidth, setEnabled, setFocusTraversalDirection, setFocusTraversalFrom, setFocusTraversalPolicy, setFrame, setHeight, setKeyedValue, setLabelFont, setLeft, setMakeLimitNoise, setOrigin, setOrigin, setPartialFocusOK, setPosition, setPreferredDirection, setRight, setScrollFocusMargin, setStyle, setStyleColor, setStyleFont, setStyleFrameColor, setTop, setTransparent, setVisible, setWidth, shouldDropEvent, show, showContextMenu, styleIsDefault, swapStyleColors, windowToLocal
 
Methods inherited from class danger.app.Listener
cancelEvents, childEventPump, childEventPumpDone, eventProblem, isDispatchingThread, sendEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendLowPriorityEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface danger.ui.ISliderData
getTitle, setTitle
 

Constructor Detail

Slider

public Slider()
Create a Slider with default values. Title is null. Type is (@link #UNCOMPRESSED). Min, and current values are 0. Max value is 100.


Slider

public Slider(int inMinValue,
              int inValue,
              int inMaxValue)
Create a Slider specifying the min, max, and current values. Title is null. Type is (@link #UNCOMPRESSED).

Parameters:
inMinValue - An int specifying the minimum value for control.
inValue - An int specifying the current value for control.
inMaxValue - An int specifying the max value for control.

Slider

public Slider(int type,
              int inMinValue,
              int inValue,
              int inMaxValue)
Create a Slider specifying type, min, max, and current values. Title is null.

Parameters:
type - type can be one of (@link #COMPRESSED), (@link #UNCOMPRESSED), or (@link #WINDOW_ONLY).
inMinValue - An int specifying the minimum value for control.
inValue - An int specifying the current value for control.
inMaxValue - An int specifying the max value for control.

Slider

public Slider(String title)
Create a Slider specifying the title. Type is (@link #UNCOMPRESSED). Min and current values are 0. Max value is 100.

Parameters:
title - A String containing the title of the Slider.

Slider

public Slider(String title,
              int type)
Create a Slider specifying the title and type. Min and current values are 0. Max value are 100.

Parameters:
title - A String containing the title of the Slider.
type - type can be one of (@link #COMPRESSED), (@link #UNCOMPRESSED), or (@link #WINDOW_ONLY).

Slider

public Slider(String title,
              int inMinValue,
              int inValue,
              int inMaxValue)
Create a Slider specifying title, min, max, and current values. Type is (@link #UNCOMPRESSED).

Parameters:
title - A String containing the title of the Slider.
inMinValue - An int specifying the minimum value for control.
inValue - An int specifying the current value for control.
inMaxValue - An int specifying the max value for control.

Slider

public Slider(String inTitle,
              int inType,
              int inMinValue,
              int inValue,
              int inMaxValue)
Method Detail

setSliderWindow

public void setSliderWindow(SliderWindow inWindow)
Set the SliderWindow for this Slider. The SliderWindow is displayed when the Slider is clicked on.

Parameters:
inWindow - SliderWindow to be used when the Slider is clicked on.

resizeToFit

public void resizeToFit()
Resize to fit the current parameters.


setSize

public void setSize(int width,
                    int height)
Description copied from class: View
Simultaneously set the width and height of this View.

Overrides:
setSize in class View

paint

public void paint(Pen p)
Description copied from class: View
Draw the contents of this View. This method is called by the graphics system when the View needs to be repainted. A Pen will be provided which is appropriately clipped and translated for drawing on this View.

The implementation of this method in this class will merely call clear() pen, if this View is opaque (not transparent), and will do nothing otherwise. If you don't need this behavior, then there is no point in calling super.paint() in an overriding method.

Overrides:
paint in class Container
Parameters:
p - non-null; the pen to use for drawing operations

enterPopup

public void enterPopup()
Open the Slider window. Creates (if neccessary) and displays the Slider's window so the value can be changed.


exitPopup

public void exitPopup()
Close the Slider window. If the Slider's window is currently visible, hide it.


eventWidgetDown

public boolean eventWidgetDown(int inWhichWidget,
                               Event event)
Description copied from class: Container
Handle the pressing of a device widget

Overrides:
eventWidgetDown in class Container
Parameters:
inWhichWidget - the widget that went up
Returns:
whether or not the event was consumed

eventWidgetUp

public boolean eventWidgetUp(int inWhichWidget,
                             Event event)
Description copied from class: Container
Handle the release of a device widget

Overrides:
eventWidgetUp in class Container
Parameters:
inWhichWidget - the widget that went down
Returns:
whether or not the event was consumed

eventKeyUp

public boolean eventKeyUp(char inKey,
                          Event event)
Description copied from class: Container
Processes key releases directed at this container.

Overrides:
eventKeyUp in class Container
Parameters:
inKey - the character being released.

getEvent

public Event getEvent()
Overrides:
getEvent in class Control

onSetTitle

protected void onSetTitle(String title)
Description copied from class: Control
This method is called when the title is set via a call to Control.setTitle(java.lang.String), to allow subclasses to perform any necessary actions associated with the event. The implementation in this class is empty, so it is not necessary for an overriding method to call super.onSetTitle().

Overrides:
onSetTitle in class Control
Parameters:
title - non-null; what the title was set to

getScrollAmount

public int getScrollAmount(Event event)
Get the amount to scroll by based on the event. If ALT is down, scroll to max or min value. If MENU is down, scroll by page size. If unchorded, scroll by navigation amount.

Parameters:
event - The navigation event.

onStyleChanged

protected void onStyleChanged(int attribute)
Description copied from class: View
This method is called when the specified attribute of this view's style has been modified. Base implementation does nothing.

Overrides:
onStyleChanged in class View

setValue

public void setValue(int inValue)
Description copied from class: Control
Set the value associated with this instance.

Specified by:
setValue in interface ISliderData
Overrides:
setValue in class Control
Parameters:
inValue - the new value

setMinValue

public void setMinValue(int inMinValue)
Description copied from interface: ISliderData
Set the minimum value for the Slider.

Specified by:
setMinValue in interface ISliderData
Parameters:
inMinValue - int specifying the minimum value.

setMaxValue

public void setMaxValue(int inMaxValue)
Description copied from interface: ISliderData
Set the maximum value for the Slider.

Specified by:
setMaxValue in interface ISliderData
Parameters:
inMaxValue - int specifying the max value.

setSliderPortionWidth

public void setSliderPortionWidth(int inWidth)
Description copied from interface: ISliderData
Set the width in pixels of the indicator portion of the Slider. UNCOMPRESSED Sliders display a title on the left and a value indicator on the right side. This value specifies the width of the indicator portion. The default is 100.

Specified by:
setSliderPortionWidth in interface ISliderData
Parameters:
inWidth - int specifiying width in pixels of the indicator portion.

setSliderType

public void setSliderType(int inType)
Description copied from interface: ISliderData
Set the type of the Slider.

Specified by:
setSliderType in interface ISliderData
Parameters:
inType - int speficying the type. Valid values are ISliderData.UNCOMPRESSED, ISliderData.COMPRESSED, ISliderData.WINDOW_ONLY.

setBitmaps

public void setBitmaps(Bitmap[] inBitmaps)
Description copied from interface: ISliderData
Specify an array of bitmaps associated with the Slider value. This allows you to specify an array of bitmaps (one for each value) to be displayed in the UNCOMPRESSED Slider instead of the standard value indicator.

Specified by:
setBitmaps in interface ISliderData
Parameters:
inBitmaps - bitmap[] specifying the bitmap to be used for each value (max - min) of the Slider.

setDescription

public void setDescription(String text)
Description copied from interface: ISliderData
Specify a description to be displayed beneath the Slider title and indicator. This description can be longer than the title, allowing you to be more descriptive. The description is not displayed when the Slider is ISliderData.COMPRESSED.

Specified by:
setDescription in interface ISliderData
Parameters:
text - String specifying the description.

setLabels

public void setLabels(String leftLabel,
                      String rightLabel)
Description copied from interface: ISliderData
Specify text labels to appear to the right and left of the Slider indicator. These text labels are in addition to the title, and you don't have to specify both of them.

Specified by:
setLabels in interface ISliderData
Parameters:
leftLabel - null-ok; String specifying label to appear between Slider title and indicator.
rightLabel - null-ok; String specifying label to appears to the right of Slider indicator.

getValue

public int getValue()
Description copied from class: Control
Get the value associated with this instance.

Specified by:
getValue in interface ISliderData
Overrides:
getValue in class Control
Returns:
the value

getMinValue

public int getMinValue()
Description copied from interface: ISliderData
Get the minimum value for the Slider.

Specified by:
getMinValue in interface ISliderData
Returns:
int specifying the min value.

getMaxValue

public int getMaxValue()
Description copied from interface: ISliderData
Get the maximum value for the Slider.

Specified by:
getMaxValue in interface ISliderData
Returns:
int specifying the max value.

getSliderPortionWidth

public int getSliderPortionWidth()
Description copied from interface: ISliderData
Get the width in pixels of the indicator portion of the Slider. UNCOMPRESSED Sliders display a title on the left and a value indicator on the right side. This value specifies the width of the indicator portion. The default is 100.

Specified by:
getSliderPortionWidth in interface ISliderData
Returns:
int specifiying width in pixels of the indicator portion.

getSliderType

public int getSliderType()
Description copied from interface: ISliderData
Get the type of the Slider.

Specified by:
getSliderType in interface ISliderData
Returns:
int speficying the type. Valid values are ISliderData.UNCOMPRESSED, ISliderData.COMPRESSED, ISliderData.WINDOW_ONLY.

getBitmaps

public Bitmap[] getBitmaps()
Description copied from interface: ISliderData
Get the array of bitmaps associated with the Slider value. This allows you to specify an array of bitmaps (one for each value) to be displayed in the UNCOMPRESSED Slider instead of the standard value indicator.

Specified by:
getBitmaps in interface ISliderData
Returns:
bitmap[] specifying the bitmap to be used for each value of the Slider.

getCurrentBitmap

public Bitmap getCurrentBitmap()
Get the bitmap for the current Slider value.

Returns:
bitmap specifying the bitmap to be used for the current value of the Slider.

getDescription

public String getDescription()
Description copied from interface: ISliderData
Get the description text for the Slider. This description can be longer than the title, allowing you to be more descriptive. The description is not displayed when the Slider is ISliderData.COMPRESSED.

Specified by:
getDescription in interface ISliderData
Returns:
String specifying the description.

getLeftLabel

public String getLeftLabel()
Description copied from interface: ISliderData
Get the left label for the Slider.

Specified by:
getLeftLabel in interface ISliderData
Returns:
null-ok; String specifying label to appear between Slider title and indicator.

getRightLabel

public String getRightLabel()
Description copied from interface: ISliderData
Get the right label for the Slider.

Specified by:
getRightLabel in interface ISliderData
Returns:
null-ok; String specifying label to appears to the right of Slider indicator.

setTitleSpacing

public void setTitleSpacing(int titleSpacing)
Set the title spacing. This is the amount the title is indented from the left side of the Slider.

Parameters:
titleSpacing - int specifying the amount in pixels to indent the title.

setDirection

public void setDirection(int direction)
Description copied from interface: ISliderData
Sets the direction for the indicator. By default, Sliders have the minValue on the left and move left-to-right. When using this control with volume buttons, the minValue is on the right and the indicator moves right-to-left to match the volume buttons.

Specified by:
setDirection in interface ISliderData
Parameters:
direction - int specifying the direction. Valid values are ISliderData.LEFT_TO_RIGHT and ISliderData.RIGHT_TO_LEFT.

getDirection

public int getDirection()
Description copied from interface: ISliderData
Get the direction for the indicator. By default, sliders have the minValue on the left and move left-to-right. When using this control with volume buttons, the minValue is on the right and the indicator move right-to-left to match the volume buttons.

Specified by:
getDirection in interface ISliderData
Returns:
int specifying the direction. Valid values are ISliderData.LEFT_TO_RIGHT and ISliderData.RIGHT_TO_LEFT.

setHasTickMarks

public void setHasTickMarks(int tickMarks)
Description copied from interface: ISliderData
Sets the display of tick marks on the slider. By default, the tick marks are displayed automatically when the range of values exceeds a certain amount (currently 5). You can also explicitly turn them off or on.

Specified by:
setHasTickMarks in interface ISliderData
Parameters:
tickMarks - int specifying how to display tick marks. Valid values are ISliderData.TICK_MARKS_AUTO, ISliderData.TICK_MARKS_ON and ISliderData.TICK_MARKS_OFF.

getHasTickMarks

public int getHasTickMarks()
Description copied from interface: ISliderData
Gets whether tick marks are displayed on the indicator. By default, the tick marks are displayed automatically when the range of values exceeds a certain amount (currently 5). You can also explicitly turn them off or on.

Specified by:
getHasTickMarks in interface ISliderData
Returns:
int specifying how to display tick marks. Valid values are ISliderData.TICK_MARKS_AUTO, ISliderData.TICK_MARKS_ON and ISliderData.TICK_MARKS_OFF.

setShowEndTicks

public void setShowEndTicks(int showEndTicks)
Description copied from interface: ISliderData
Sets the display of start and ending tick marks on the slider. By default, sliders show the last (maxValue) tick mark but not the first (minValue). For sliders with no frame and no thumb, you may want to show both the first and the last tick. For sliders that have a frame, you may not want to show either the first or last tick.

Specified by:
setShowEndTicks in interface ISliderData
Parameters:
showEndTicks - int specifying whether to show start and end tick marks. Valid values are ISliderData.DONT_SHOW_FIRST_OR_LAST_TICK, ISliderData.SHOW_FIRST_TICK, ISliderData.SHOW_LAST_TICK and ISliderData.SHOW_FIRST_AND_LAST_TICK.

getShowEndTicks

public int getShowEndTicks()
Description copied from interface: ISliderData
Gets whether start and end tick marks are shown on the indicator. By default, sliders show the last (maxValue) tick mark but not the first (minValue). For sliders with no frame and no thumb, you may want to show both the first and the last tick. For sliders that have a frame, you may not want to show either the first or last tick.

Specified by:
getShowEndTicks in interface ISliderData
Returns:
int specifying whether to show start and end tick marks. Valid values are ISliderData.DONT_SHOW_FIRST_OR_LAST_TICK, ISliderData.SHOW_FIRST_TICK, ISliderData.SHOW_LAST_TICK and ISliderData.SHOW_FIRST_AND_LAST_TICK.

setHasFrame

public void setHasFrame(boolean hasFrame)
Description copied from interface: ISliderData
Sets the display of the standard frame for the slider.

Specified by:
setHasFrame in interface ISliderData
Parameters:
hasFrame - true if you want the frame.

getHasFrame

public boolean getHasFrame()
Description copied from interface: ISliderData
Gets the display of the standard frame for the slider.

Specified by:
getHasFrame in interface ISliderData
Returns:
true if the Slider has a frame.

setHasInnerFrame

public void setHasInnerFrame(boolean hasInnerFrame)
Description copied from interface: ISliderData
Sets the display of the inner frame for the slider. By default, sliders have a lighter colored frame inside the standard frame.

Specified by:
setHasInnerFrame in interface ISliderData
Parameters:
hasInnerFrame - true if you want the inner frame.

getHasInnerFrame

public boolean getHasInnerFrame()
Description copied from interface: ISliderData
Gets the display of the inner frame for the slider. By default, sliders have a lighter colored frame inside the standard frame.

Specified by:
getHasInnerFrame in interface ISliderData
Returns:
true if the Slider has an inner frame.

setHasThumb

public void setHasThumb(boolean hasThumb)
Description copied from interface: ISliderData
Sets the display of the thumb at the end of the indicator.

Specified by:
setHasThumb in interface ISliderData
Parameters:
hasThumb - true if you want the thumb.

getHasThumb

public boolean getHasThumb()
Description copied from interface: ISliderData
Gets the display of the thumb.

Specified by:
getHasThumb in interface ISliderData
Returns:
true if Slider has a thumb.

setIndicatorMargin

public void setIndicatorMargin(int indicatorMargin)
Description copied from interface: ISliderData
Sets the margin between the frame and the indicator. This specifies the gap between the indicator frame and the indicator. Default is 3 pixels.

Specified by:
setIndicatorMargin in interface ISliderData
Parameters:
indicatorMargin - int specifying the margin in pixels.

getIndicatorMargin

public int getIndicatorMargin()
Description copied from interface: ISliderData
Gets the margin between the frame and the indicator. This specifies the gap between the indicator frame and the indicator. Default is 3 pixels.

Specified by:
getIndicatorMargin in interface ISliderData
Returns:
int specifying the margin in pixels.

setIndicatorJustification

public void setIndicatorJustification(int indicatorJustification)
Description copied from interface: ISliderData
Sets the justification of the indicator. By default, the indicator is centered inside the slider. This method allows you to position the indicator at the top or the bottom of the slider. If not centered, the indicator margin is only applied to the top (JUSTIFY_BOTTOM) or bottom (JUSTIFY_TOP) of the slider.

Specified by:
setIndicatorJustification in interface ISliderData
Parameters:
indicatorJustification - int specifying desired justification. Valid values are ISliderData.JUSTIFY_TOP, ISliderData.JUSTIFY_BOTTOM and ISliderData.JUSTIFY_CENTER

getIndicatorJustification

public int getIndicatorJustification()
Description copied from interface: ISliderData
Gets the justification of the indicator. By default, the indicator is centered inside the slider. This method allows you to position the indicator at the top or the bottom of the slider. If not centered, the indicator margin is only applied to the top (JUSTIFY_BOTTOM) or bottom (JUSTIFY_TOP) of the slider.

Specified by:
getIndicatorJustification in interface ISliderData
Returns:
int specifying desired justification. Valid values are ISliderData.JUSTIFY_TOP, ISliderData.JUSTIFY_BOTTOM and ISliderData.JUSTIFY_CENTER

setIndicateSingleValue

public void setIndicateSingleValue(boolean indicateSingleValue)
Description copied from interface: ISliderData
Sets how values should be indicated on the Slider. Normally the indicator is drawn from the minValue position to the value position. If indicateSingleValue is true, the indicator is drawn from value - 1 to value, showing only one segment.

Specified by:
setIndicateSingleValue in interface ISliderData
Parameters:
indicateSingleValue - true if Slider should only indicate a single value.

getIndicateSingleValue

public boolean getIndicateSingleValue()
Description copied from interface: ISliderData
Gets how values should be indicated on the Slider. Normally the indicator is drawn from the minValue position to the value position. If indicateSingleValue is true, the indicator is drawn from value - 1 to value, showing only one segment.

Specified by:
getIndicateSingleValue in interface ISliderData
Returns:
true if Slider should only indicate a single value.

scroll

public void scroll(int delta)
Scroll the slider value and make sure it doesn't exceed the max or min values. If the new value is out of range, move it to the nearest value that is still in range.

Parameters:
delta - amount to scroll by (positive = increment, negative = decrement)

increment

public void increment(int delta)
Increment the slider value and make sure it doesn't exceed the max value. If the new value is greater than the max, the value is set to the max.

Parameters:
delta - amount to increment by.

decrement

public void decrement(int delta)
Decrement the slider value and make sure it doesn't go below the min value. If the new value is less than the min, the value is set to the min.

Parameters:
delta - amount to decrement by.

getMiddleValue

protected int getMiddleValue()
Get the middle value, for use with page-scrolling. This returns the value that should be selected if the user page-scrolls to the middle value. By default, it returns the midpoint of the minimum and maximum value.

Since:
3.0