Package org.apache.pivot.wtk
Class Spinner
- java.lang.Object
-
- org.apache.pivot.wtk.Component
-
- org.apache.pivot.wtk.Container
-
- org.apache.pivot.wtk.Spinner
-
- All Implemented Interfaces:
java.lang.Iterable<Component>
,Sequence<Component>
,ConstrainedVisual
,Visual
@DefaultProperty("spinnerData") public class Spinner extends Container
Component that presents a means of cycling through a list of items.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Spinner.ItemBindMapping
Translates between spinner and bind context data during data binding.static interface
Spinner.ItemRenderer
Renderer
interface to customize the appearance of the data in a Spinner.static interface
Spinner.Skin
Spinner skin interface.static interface
Spinner.SpinnerDataBindMapping
Translates between spinner and bind context data during data binding.-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Container
Container.EDTChecker
-
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
-
Nested classes/interfaces inherited from interface org.apache.pivot.collections.Sequence
Sequence.Tree<T>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Propagates clear operation to subcomponents.void
clearSelection()
Clears the selection.Bounds
getContentBounds()
Gets the bounding area of the spinner content (the area in which the item renderer will render the content).Spinner.ItemRenderer
getItemRenderer()
int
getSelectedIndex()
java.lang.Object
getSelectedItem()
Spinner.ItemBindMapping
getSelectedItemBindMapping()
BindType
getSelectedItemBindType()
java.lang.String
getSelectedItemKey()
ListenerList<SpinnerBindingListener>
getSpinnerBindingListeners()
List<?>
getSpinnerData()
Spinner.SpinnerDataBindMapping
getSpinnerDataBindMapping()
BindType
getSpinnerDataBindType()
java.lang.String
getSpinnerDataKey()
ListenerList<SpinnerItemListener>
getSpinnerItemListeners()
ListenerList<SpinnerListener>
getSpinnerListeners()
ListenerList<SpinnerSelectionListener>
getSpinnerSelectionListeners()
boolean
isCircular()
void
load(java.lang.Object context)
Propagates binding to subcomponents.void
setCircular(boolean circular)
Set whether the values in this spinner wrap around from the end back to the beginning (and vice-versa).void
setItemRenderer(Spinner.ItemRenderer itemRenderer)
Sets the item renderer to be used for items in this list.void
setSelectedIndex(int selectedIndex)
Sets the selection to the specified index.void
setSelectedItem(java.lang.Object item)
void
setSelectedItemBindMapping(Spinner.ItemBindMapping selectedItemBindMapping)
void
setSelectedItemBindType(BindType selectedItemBindType)
void
setSelectedItemKey(java.lang.String selectedItemKey)
protected void
setSkin(Skin skin)
Sets the skin, replacing any previous skin.void
setSpinnerData(java.lang.String spinnerData)
void
setSpinnerData(List<?> spinnerData)
Sets the spinner data.void
setSpinnerDataBindMapping(Spinner.SpinnerDataBindMapping spinnerDataBindMapping)
void
setSpinnerDataBindType(BindType spinnerDataBindType)
void
setSpinnerDataKey(java.lang.String spinnerDataKey)
void
store(java.lang.Object context)
Propagates binding to subcomponents.-
Methods inherited from class org.apache.pivot.wtk.Container
add, assertEventDispatchThread, assertEventDispatchThread, containsFocus, descendantAdded, descendantGainedFocus, descendantLostFocus, descendantRemoved, get, getComponentAt, getContainerListeners, getContainerMouseListeners, getDescendantAt, getFocusTraversalPolicy, getGraphics, getLength, getNamedComponent, indexOf, insert, invalidate, isAncestor, isDoubleBuffered, iterator, layout, mouseClick, mouseDown, mouseMove, mouseOut, mouseUp, mouseWheel, move, paint, remove, remove, removeAll, repaint, requestFocus, setDoubleBuffered, setEventDispatchThreadChecker, setFocusTraversalPolicy, setParent, setVisible, transferFocus, update
-
Methods inherited from class org.apache.pivot.wtk.Component
checkSkin, clearFocus, contains, copyStyle, copyStyle, getAncestor, getAncestor, getAttribute, getAutomationID, getBaseline, getBaseline, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponentStateListeners, getComponentStyleListeners, getComponentTooltipListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getScreenBounds, getSize, getSkin, getStyle, getStyle, getStyleBoolean, getStyleBoolean, getStyleColor, getStyleColor, getStyleFont, getStyleFont, getStyleInt, getStyleInt, getStyles, getTextInputMethodListener, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseOver, offsetToScreen, putStyle, putStyle, reenterMouse, repaint, repaint, repaint, repaint, repaint, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setAutomationID, setCursor, setDragSource, setDropTarget, setEnabled, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
-
-
-
-
Constructor Detail
-
Spinner
public Spinner()
Creates a spinner populated with an empty array list.The default contents is an
ImmutableList
so that if the default property (which is "spinnerData") is invoked in a BXML file,BXMLSerializer
trying to add to this immutable sequence will catch an exception and will do asetSpinnerData(List)
instead.
-
Spinner
public Spinner(List<?> spinnerData)
Creates a spinner populated with the given spinner data.Note that the default renderer uses (as last option) the
toString
method on list elements, so override it to return whatever you want to display as text, or implement your own custom renderer.- Parameters:
spinnerData
- The data to set.- See Also:
SpinnerItemRenderer
-
-
Method Detail
-
getSpinnerData
public List<?> getSpinnerData()
- Returns:
- The data currently presented by the spinner.
-
setSpinnerData
public void setSpinnerData(List<?> spinnerData)
Sets the spinner data. Clears any existing selection state.- Parameters:
spinnerData
- The data to be presented by the spinner.
-
setSpinnerData
public final void setSpinnerData(java.lang.String spinnerData)
-
setSkin
protected void setSkin(Skin skin)
Description copied from class:Component
Sets the skin, replacing any previous skin.
-
getItemRenderer
public Spinner.ItemRenderer getItemRenderer()
- Returns:
- The item renderer used for items in this list.
-
setItemRenderer
public void setItemRenderer(Spinner.ItemRenderer itemRenderer)
Sets the item renderer to be used for items in this list.- Parameters:
itemRenderer
- The new item renderer for the list.
-
isCircular
public boolean isCircular()
- Returns:
- Whether or not this spinner's values are circular.
-
setCircular
public void setCircular(boolean circular)
Set whether the values in this spinner wrap around from the end back to the beginning (and vice-versa).- Parameters:
circular
- The new setting for this spinner.
-
getSelectedIndex
public int getSelectedIndex()
- Returns:
- The currently selected index.
-
setSelectedIndex
public void setSelectedIndex(int selectedIndex)
Sets the selection to the specified index.- Parameters:
selectedIndex
- The index to select, or-1
to clear the selection.
-
getSelectedItem
public java.lang.Object getSelectedItem()
-
setSelectedItem
public void setSelectedItem(java.lang.Object item)
-
getSpinnerDataKey
public java.lang.String getSpinnerDataKey()
-
setSpinnerDataKey
public void setSpinnerDataKey(java.lang.String spinnerDataKey)
-
getSpinnerDataBindType
public BindType getSpinnerDataBindType()
-
setSpinnerDataBindType
public void setSpinnerDataBindType(BindType spinnerDataBindType)
-
getSpinnerDataBindMapping
public Spinner.SpinnerDataBindMapping getSpinnerDataBindMapping()
-
setSpinnerDataBindMapping
public void setSpinnerDataBindMapping(Spinner.SpinnerDataBindMapping spinnerDataBindMapping)
-
getSelectedItemKey
public java.lang.String getSelectedItemKey()
-
setSelectedItemKey
public void setSelectedItemKey(java.lang.String selectedItemKey)
-
getSelectedItemBindType
public BindType getSelectedItemBindType()
-
setSelectedItemBindType
public void setSelectedItemBindType(BindType selectedItemBindType)
-
getSelectedItemBindMapping
public Spinner.ItemBindMapping getSelectedItemBindMapping()
-
setSelectedItemBindMapping
public void setSelectedItemBindMapping(Spinner.ItemBindMapping selectedItemBindMapping)
-
load
public void load(java.lang.Object context)
Description copied from class:Container
Propagates binding to subcomponents.
-
store
public void store(java.lang.Object context)
Description copied from class:Container
Propagates binding to subcomponents.
-
clear
public void clear()
Description copied from class:Container
Propagates clear operation to subcomponents.
-
clearSelection
public void clearSelection()
Clears the selection.
-
getContentBounds
public Bounds getContentBounds()
Gets the bounding area of the spinner content (the area in which the item renderer will render the content).- Returns:
- The bounding area of the spinner content.
-
getSpinnerListeners
public ListenerList<SpinnerListener> getSpinnerListeners()
- Returns:
- The spinner listener list.
-
getSpinnerItemListeners
public ListenerList<SpinnerItemListener> getSpinnerItemListeners()
- Returns:
- The spinner item listener list.
-
getSpinnerSelectionListeners
public ListenerList<SpinnerSelectionListener> getSpinnerSelectionListeners()
- Returns:
- The spinner selection listener list.
-
getSpinnerBindingListeners
public ListenerList<SpinnerBindingListener> getSpinnerBindingListeners()
- Returns:
- The spinner binding listener list.
-
-