com.sun.lwuit.spinner
Class Spinner

java.lang.Object
  extended by com.sun.lwuit.Component
      extended by com.sun.lwuit.List
          extended by com.sun.lwuit.spinner.Spinner
All Implemented Interfaces:
Animation, StyleListener

public class Spinner
extends List

A spinner allows us to select a numeric, date or time value using the arrow keys in a similar way to a list or a combo box.


Field Summary
static int DATE_FORMAT_DD_MM_YY
          Value for create date renderer represnting Day-Month-2 Digit Year
static int DATE_FORMAT_DD_MM_YYYY
          Value for create date renderer represnting Day-Month-4 Digit Year
static int DATE_FORMAT_MM_DD_YY
          Value for create date renderer represnting Month-Day-2 Digit Year
static int DATE_FORMAT_MM_DD_YYYY
          Value for create date renderer represnting Month-Day-4 Digit Year
 
Fields inherited from class com.sun.lwuit.List
FIXED_CENTER, FIXED_LEAD, FIXED_NONE, FIXED_NONE_CYCLIC, FIXED_NONE_ONE_ELEMENT_MARGIN_FROM_EDGE, FIXED_TRAIL, HORIZONTAL, VERTICAL
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Method Summary
 boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
protected  Dimension calcScrollSize()
          Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport
static Spinner create(double min, double max, double currentValue, double step)
          Creates a new numeric spinner instance
static Spinner create(int min, int max, int currentValue, int step)
          Creates a new numeric spinner instance
static Spinner createDate(long min, long max, long currentValue, char separatorChar, int format)
          Creates a new date spinner instance
static Spinner createTime(int min, int max, int currentValue, int step, boolean twentyFourHours, boolean showSeconds)
          Creates a new time spinner instance, time is an integer represented in seconds since mindnight
static int getInputSkipDelay()
          Indicates the time after which the skip input area for entering spinner values manually will disappear
static Image getSpinnerHandle()
          The image appearing on the side of the spinner widget to indicate its "spinnability"
 java.lang.Object getValue()
          Returns the value of the spinner to a number or a date based on the spinner type
protected  void initComponent()
          Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
 boolean isRTL()
          Is the component a bidi RTL component
 void keyPressed(int code)
          If this Component is focused, the key pressed event will call this method
 void keyReleased(int code)
          If this Component is focused, the key released event will call this method
 void paint(Graphics g)
          This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
 void refreshTheme()
          Makes sure the component is up to date with the current style object
static void setInputSkipDelay(int aInputSkipDelay)
          Indicates the time after which the skip input area for entering spinner values manually will disappear
 void setRTL(boolean rtl)
          Is the component a bidi RTL component
static void setSpinnerHandle(Image aSpinnerHandle)
          The image appearing on the side of the spinner widget to indicate its "spinnability"
 void setUIID(java.lang.String id)
          This method sets the Component the Unique identifier.
 void setValue(java.lang.Object o)
          Set the value of the spinner to a number or a date based on the spinner type
 
Methods inherited from class com.sun.lwuit.List
addActionListener, addItem, addSelectionListener, fireActionEvent, fireClicked, getActionListeners, getFixedSelection, getGridPosX, getGridPosY, getHint, getHintIcon, getItemGap, getListSizeCalculationSampleCount, getMinElementHeight, getModel, getOrientation, getRenderer, getRenderingPrototype, getSelectedIndex, getSelectedItem, getSelectedRect, getSideGap, getVisibleBounds, isCommandList, isDefaultFireOnClick, isDefaultIgnoreFocusComponentWhenUnfocused, isIgnoreFocusComponentWhenUnfocused, isMutableRendererBackgrounds, isNumericKeyActions, isScrollableX, isScrollableY, isSelectableInteraction, isTactileTouch, laidOut, listSelectionChanged, longPointerPress, modelChanged, paramString, pointerDragged, pointerHover, pointerHoverReleased, pointerPressed, pointerReleased, removeActionListener, removeSelectionListener, scrollRectToVisible, setCommandList, setDefaultFireOnClick, setDefaultIgnoreFocusComponentWhenUnfocused, setFireOnClick, setFixedSelection, setHandlesInput, setHint, setHint, setHintIcon, setIgnoreFocusComponentWhenUnfocused, setInputOnFocus, setItemGap, setListCellRenderer, setListSizeCalculationSampleCount, setMinElementHeight, setModel, setMutableRendererBackgrounds, setNumericKeyActions, setOrientation, setPaintFocusBehindList, setRenderer, setRenderingPrototype, setScrollToSelected, setSelectedIndex, setSelectedIndex, setSelectedItem, setShouldCalcPreferredSize, size
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, dragInitiated, drawDraggedImage, drop, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBottomGap, getBounds, getClientProperty, getComponentForm, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollAnimationSpeed, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initCustomStyle, installDefaultPainter, isAlwaysTensile, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isEnabled, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isScrollable, isScrollVisible, isSmoothScrolling, isSnapToGrid, isTactileTouch, isTensileDragEnabled, isVisible, keyRepeated, longKeyPress, paintBackground, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerHoverPressed, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setAlwaysTensile, setCellRenderer, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setEnabled, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setScrollAnimationSpeed, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSmoothScrolling, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUnselectedStyle, setWidth, setVisible, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATE_FORMAT_DD_MM_YYYY

public static final int DATE_FORMAT_DD_MM_YYYY
Value for create date renderer represnting Day-Month-4 Digit Year

See Also:
Constant Field Values

DATE_FORMAT_MM_DD_YYYY

public static final int DATE_FORMAT_MM_DD_YYYY
Value for create date renderer represnting Month-Day-4 Digit Year

See Also:
Constant Field Values

DATE_FORMAT_DD_MM_YY

public static final int DATE_FORMAT_DD_MM_YY
Value for create date renderer represnting Day-Month-2 Digit Year

See Also:
Constant Field Values

DATE_FORMAT_MM_DD_YY

public static final int DATE_FORMAT_MM_DD_YY
Value for create date renderer represnting Month-Day-2 Digit Year

See Also:
Constant Field Values
Method Detail

createTime

public static Spinner createTime(int min,
                                 int max,
                                 int currentValue,
                                 int step,
                                 boolean twentyFourHours,
                                 boolean showSeconds)
Creates a new time spinner instance, time is an integer represented in seconds since mindnight

Parameters:
min - lowest value allowed in seconds since midnight
max - maximum value allowed in seconds since midnight
currentValue - the starting value in seconds since midnight
step - increments in the spinner (in seconds)
twentyFourHours - show the value as 24 hour values or AM/PM
showSeconds - show the value of the seconds as well or hide it
Returns:
new spinner instance

createDate

public static Spinner createDate(long min,
                                 long max,
                                 long currentValue,
                                 char separatorChar,
                                 int format)
Creates a new date spinner instance

Parameters:
min - lowest value allowed
max - maximum value allowed
currentValue - the starting value for the mode
separatorChar - character to separate the entries during rendering
format - formatting type for the field
Returns:
new spinner instance

create

public static Spinner create(int min,
                             int max,
                             int currentValue,
                             int step)
Creates a new numeric spinner instance

Parameters:
min - lowest value allowed
max - maximum value allowed
currentValue - the starting value for the mode
step - the value by which we increment the entries in the model
Returns:
new spinner instance

create

public static Spinner create(double min,
                             double max,
                             double currentValue,
                             double step)
Creates a new numeric spinner instance

Parameters:
min - lowest value allowed
max - maximum value allowed
currentValue - the starting value for the mode
step - the value by which we increment the entries in the model
Returns:
new spinner instance

initComponent

protected void initComponent()
Description copied from class: Component
Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state

Overrides:
initComponent in class Component

calcScrollSize

protected Dimension calcScrollSize()
Description copied from class: Component
Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport

Overrides:
calcScrollSize in class Component
Returns:
scroll size, by default this is the same as the preferred size

calcPreferredSize

protected Dimension calcPreferredSize()
Description copied from class: Component
Calculates the preferred size based on component content. This method is invoked lazily by getPreferred size.

Overrides:
calcPreferredSize in class List
Returns:
the calculated preferred size based on component content

keyPressed

public void keyPressed(int code)
Description copied from class: Component
If this Component is focused, the key pressed event will call this method

Overrides:
keyPressed in class List
Parameters:
code - the key code value to indicate a physical key.

setValue

public void setValue(java.lang.Object o)
Set the value of the spinner to a number or a date based on the spinner type

Parameters:
o - a number or a date

getValue

public java.lang.Object getValue()
Returns the value of the spinner to a number or a date based on the spinner type

Returns:
a number or a date

keyReleased

public void keyReleased(int code)
Description copied from class: Component
If this Component is focused, the key released event will call this method

Overrides:
keyReleased in class List
Parameters:
code - the key code value to indicate a physical key.

isRTL

public boolean isRTL()
Description copied from class: Component
Is the component a bidi RTL component

Overrides:
isRTL in class Component
Returns:
true if the component is working in a right to left mode

setRTL

public void setRTL(boolean rtl)
Description copied from class: Component
Is the component a bidi RTL component

Overrides:
setRTL in class Component
Parameters:
rtl - true if the component should work in a right to left mode

setUIID

public void setUIID(java.lang.String id)
Description copied from class: Component
This method sets the Component the Unique identifier. This method should be used before a component has been initialized

Overrides:
setUIID in class Component
Parameters:
id - UIID unique identifier for component type

refreshTheme

public void refreshTheme()
Description copied from class: Component
Makes sure the component is up to date with the current style object

Overrides:
refreshTheme in class List

paint

public void paint(Graphics g)
Description copied from class: Component
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

Specified by:
paint in interface Animation
Overrides:
paint in class List
Parameters:
g - the component graphics

animate

public boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the Display class.

Specified by:
animate in interface Animation
Overrides:
animate in class List
Returns:
true if a repaint is desired or false if no repaint is necessary

getSpinnerHandle

public static Image getSpinnerHandle()
The image appearing on the side of the spinner widget to indicate its "spinnability"

Returns:
the spinnerHandle

setSpinnerHandle

public static void setSpinnerHandle(Image aSpinnerHandle)
The image appearing on the side of the spinner widget to indicate its "spinnability"

Parameters:
aSpinnerHandle - the spinnerHandle to set

getInputSkipDelay

public static int getInputSkipDelay()
Indicates the time after which the skip input area for entering spinner values manually will disappear

Returns:
the inputSkipDelay

setInputSkipDelay

public static void setInputSkipDelay(int aInputSkipDelay)
Indicates the time after which the skip input area for entering spinner values manually will disappear

Parameters:
aInputSkipDelay - the time for disappearing