|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdanger.app.Listener
danger.ui.View
danger.ui.Container
danger.ui.Control
danger.ui.Slider
public class Slider
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 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.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 |
|---|
public Slider()
public Slider(int inMinValue,
int inValue,
int inMaxValue)
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.
public Slider(int type,
int inMinValue,
int inValue,
int inMaxValue)
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.public Slider(String title)
title - A String containing the title of the Slider.
public Slider(String title,
int type)
title - A String containing the title of the Slider.type - type can be one of (@link #COMPRESSED), (@link #UNCOMPRESSED), or (@link #WINDOW_ONLY).
public Slider(String title,
int inMinValue,
int inValue,
int inMaxValue)
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.
public Slider(String inTitle,
int inType,
int inMinValue,
int inValue,
int inMaxValue)
| Method Detail |
|---|
public void setSliderWindow(SliderWindow inWindow)
inWindow - SliderWindow to be used when the Slider is clicked on.public void resizeToFit()
public void setSize(int width,
int height)
View
setSize in class Viewpublic void paint(Pen p)
ViewThe 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.
paint in class Containerp - non-null; the pen to use for drawing operationspublic void enterPopup()
public void exitPopup()
public boolean eventWidgetDown(int inWhichWidget,
Event event)
Container
eventWidgetDown in class ContainerinWhichWidget - the widget that went up
public boolean eventWidgetUp(int inWhichWidget,
Event event)
Container
eventWidgetUp in class ContainerinWhichWidget - the widget that went down
public boolean eventKeyUp(char inKey,
Event event)
Container
eventKeyUp in class ContainerinKey - the character being released.public Event getEvent()
getEvent in class Controlprotected void onSetTitle(String title)
ControlControl.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().
onSetTitle in class Controltitle - non-null; what the title was set topublic int getScrollAmount(Event event)
event - The navigation event.protected void onStyleChanged(int attribute)
View
onStyleChanged in class Viewpublic void setValue(int inValue)
Control
setValue in interface ISliderDatasetValue in class ControlinValue - the new valuepublic void setMinValue(int inMinValue)
ISliderData
setMinValue in interface ISliderDatainMinValue - int specifying the minimum value.public void setMaxValue(int inMaxValue)
ISliderData
setMaxValue in interface ISliderDatainMaxValue - int specifying the max value.public void setSliderPortionWidth(int inWidth)
ISliderData
setSliderPortionWidth in interface ISliderDatainWidth - int specifiying width in pixels of the indicator portion.public void setSliderType(int inType)
ISliderData
setSliderType in interface ISliderDatainType - int speficying the type. Valid values are
ISliderData.UNCOMPRESSED, ISliderData.COMPRESSED, ISliderData.WINDOW_ONLY.public void setBitmaps(Bitmap[] inBitmaps)
ISliderData
setBitmaps in interface ISliderDatainBitmaps - bitmap[] specifying the bitmap to be used for each value (max - min) of the Slider.public void setDescription(String text)
ISliderDataISliderData.COMPRESSED.
setDescription in interface ISliderDatatext - String specifying the description.
public void setLabels(String leftLabel,
String rightLabel)
ISliderData
setLabels in interface ISliderDataleftLabel - 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.public int getValue()
Control
getValue in interface ISliderDatagetValue in class Controlpublic int getMinValue()
ISliderData
getMinValue in interface ISliderDatapublic int getMaxValue()
ISliderData
getMaxValue in interface ISliderDatapublic int getSliderPortionWidth()
ISliderData
getSliderPortionWidth in interface ISliderDatapublic int getSliderType()
ISliderData
getSliderType in interface ISliderDataISliderData.UNCOMPRESSED, ISliderData.COMPRESSED, ISliderData.WINDOW_ONLY.public Bitmap[] getBitmaps()
ISliderData
getBitmaps in interface ISliderDatapublic Bitmap getCurrentBitmap()
public String getDescription()
ISliderDataISliderData.COMPRESSED.
getDescription in interface ISliderDatapublic String getLeftLabel()
ISliderData
getLeftLabel in interface ISliderDatapublic String getRightLabel()
ISliderData
getRightLabel in interface ISliderDatapublic void setTitleSpacing(int titleSpacing)
titleSpacing - int specifying the amount in pixels to indent the title.public void setDirection(int direction)
ISliderData
setDirection in interface ISliderDatadirection - int specifying the direction. Valid values are
ISliderData.LEFT_TO_RIGHT and ISliderData.RIGHT_TO_LEFT.public int getDirection()
ISliderData
getDirection in interface ISliderDataISliderData.LEFT_TO_RIGHT and ISliderData.RIGHT_TO_LEFT.public void setHasTickMarks(int tickMarks)
ISliderData
setHasTickMarks in interface ISliderDatatickMarks - int specifying how to display tick marks. Valid values are
ISliderData.TICK_MARKS_AUTO, ISliderData.TICK_MARKS_ON and ISliderData.TICK_MARKS_OFF.public int getHasTickMarks()
ISliderData
getHasTickMarks in interface ISliderDataISliderData.TICK_MARKS_AUTO, ISliderData.TICK_MARKS_ON and ISliderData.TICK_MARKS_OFF.public void setShowEndTicks(int showEndTicks)
ISliderData
setShowEndTicks in interface ISliderDatashowEndTicks - 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.public int getShowEndTicks()
ISliderData
getShowEndTicks in interface ISliderDataISliderData.DONT_SHOW_FIRST_OR_LAST_TICK, ISliderData.SHOW_FIRST_TICK,
ISliderData.SHOW_LAST_TICK and ISliderData.SHOW_FIRST_AND_LAST_TICK.public void setHasFrame(boolean hasFrame)
ISliderData
setHasFrame in interface ISliderDatahasFrame - true if you want the frame.public boolean getHasFrame()
ISliderData
getHasFrame in interface ISliderDatapublic void setHasInnerFrame(boolean hasInnerFrame)
ISliderData
setHasInnerFrame in interface ISliderDatahasInnerFrame - true if you want the inner frame.public boolean getHasInnerFrame()
ISliderData
getHasInnerFrame in interface ISliderDatapublic void setHasThumb(boolean hasThumb)
ISliderData
setHasThumb in interface ISliderDatahasThumb - true if you want the thumb.public boolean getHasThumb()
ISliderData
getHasThumb in interface ISliderDatapublic void setIndicatorMargin(int indicatorMargin)
ISliderData
setIndicatorMargin in interface ISliderDataindicatorMargin - int specifying the margin in pixels.public int getIndicatorMargin()
ISliderData
getIndicatorMargin in interface ISliderDatapublic void setIndicatorJustification(int indicatorJustification)
ISliderData
setIndicatorJustification in interface ISliderDataindicatorJustification - int specifying desired justification. Valid values are
ISliderData.JUSTIFY_TOP, ISliderData.JUSTIFY_BOTTOM and ISliderData.JUSTIFY_CENTERpublic int getIndicatorJustification()
ISliderData
getIndicatorJustification in interface ISliderDataISliderData.JUSTIFY_TOP, ISliderData.JUSTIFY_BOTTOM and ISliderData.JUSTIFY_CENTERpublic void setIndicateSingleValue(boolean indicateSingleValue)
ISliderData
setIndicateSingleValue in interface ISliderDataindicateSingleValue - true if Slider should only indicate a single value.public boolean getIndicateSingleValue()
ISliderData
getIndicateSingleValue in interface ISliderDatapublic void scroll(int delta)
delta - amount to scroll by (positive = increment, negative = decrement)public void increment(int delta)
delta - amount to increment by.public void decrement(int delta)
delta - amount to decrement by.protected int getMiddleValue()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||