org.apache.pivot.wtk
Class ListButton

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Button
          extended by org.apache.pivot.wtk.ListButton
All Implemented Interfaces:
ConstrainedVisual, Visual

public class ListButton
extends Button

Component that allows a user to select one of several list options. The options are hidden until the user pushes the button.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Button
Button.DataRenderer, Button.Group, Button.GroupListener, Button.NamedGroupDictionary, Button.NamedGroupDictionaryListener, Button.State
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.ComponentDictionary, Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
ListButton()
          Creates an empty list button.
ListButton(List<?> listData)
          Creates a list button with no button data and the given list data.
ListButton(Object buttonData)
          Creates a list button with the given button data and an empty list.
ListButton(Object buttonData, List<?> listData)
          Creates a list button with the given button and list data.
 
Method Summary
 Filter<?> getDisabledItemFilter()
          Returns the disabled item filter.
 ListView.ItemRenderer getItemRenderer()
          Returns the renderer used to display items in the list.
 ListenerList<ListButtonListener> getListButtonListeners()
          Returns the list button listener list.
 ListenerList<ListButtonSelectionListener> getListButtonSelectionListeners()
          Returns the list button selection listener list.
 List<?> getListData()
          Returns the list data associated with this list button.
 int getSelectedIndex()
          Returns the current selection.
 Object getSelectedItem()
           
 String getSelectedItemKey()
           
 boolean isItemDisabled(int index)
          Returns an item's disabled state.
 void load(Dictionary<String,?> context)
          Copies bound values from the bind context to the component.
 void setDisabledItemFilter(Filter<?> disabledItemFilter)
          Sets the disabled item filter.
 void setItemRenderer(ListView.ItemRenderer itemRenderer)
          Sets the renderer used to display items in the list.
 void setListData(List<?> listData)
          Sets the list button's list data.
 void setListData(String listData)
          Sets the list button's list data.
 void setSelectedIndex(int selectedIndex)
          Sets the selection.
 void setSelectedItem(Object item)
           
 void setSelectedItemKey(String selectedItemKey)
           
 void setToggleButton(boolean toggleButton)
          Sets the button's toggle state.
 void store(Dictionary<String,?> context)
          Copies bound values from the component to the bind context.
 
Methods inherited from class org.apache.pivot.wtk.Button
getAction, getButtonData, getButtonListeners, getButtonPressListeners, getButtonStateListeners, getDataRenderer, getGroup, getNamedGroupDictionaryListeners, getNamedGroups, getSelectedKey, getState, getStateKey, isSelected, isToggleButton, isTriState, press, setAction, setAction, setButtonData, setDataRenderer, setEnabled, setGroup, setGroup, setSelected, setSelectedKey, setState, setState, setStateKey, setTriState
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, getAttributes, getBounds, getComponentClassListeners, getComponentDataListeners, getComponentDecoratorListeners, getComponentKeyListeners, getComponentListeners, getComponentMouseButtonListeners, getComponentMouseListeners, getComponentMouseWheelListeners, getComponents, getComponentStateListeners, getCursor, getDecoratedBounds, getDecorators, getDisplay, getDragSource, getDropTarget, getFocusedComponent, getGraphics, getHandle, getHeight, getLocation, getMaximumPreferredHeight, getMaximumPreferredWidth, getMenuHandler, getMinimumPreferredHeight, getMinimumPreferredWidth, getParent, getPreferredHeight, getPreferredHeight, getPreferredHeightLimits, getPreferredSize, getPreferredWidth, getPreferredWidth, getPreferredWidthLimits, getSize, getSkin, getStyles, getTooltipText, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWindow, getX, getY, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, load, mapPointFromAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttributes, setCursor, setCursor, setDragSource, setDropTarget, setHeight, setLocation, setLocation, setMaximumPreferredHeight, setMaximumPreferredWidth, setMenuHandler, setMinimumPreferredHeight, setMinimumPreferredWidth, setParent, setPreferredHeight, setPreferredHeightLimits, setPreferredHeightLimits, setPreferredSize, setPreferredSize, setPreferredWidth, setPreferredWidthLimits, setPreferredWidthLimits, setSize, setSize, setSkin, setStyles, setStyles, setStyles, setTooltipText, setVisible, setWidth, setX, setY, store, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListButton

public ListButton()
Creates an empty list button.


ListButton

public ListButton(Object buttonData)
Creates a list button with the given button data and an empty list.

Parameters:
buttonData -

ListButton

public ListButton(List<?> listData)
Creates a list button with no button data and the given list data.

Parameters:
listData -

ListButton

public ListButton(Object buttonData,
                  List<?> listData)
Creates a list button with the given button and list data.

Parameters:
buttonData -
listData -
Method Detail

setToggleButton

public void setToggleButton(boolean toggleButton)
Description copied from class: Button
Sets the button's toggle state.

Overrides:
setToggleButton in class Button
Throws:
UnsupportedOperationException - This method is not supported by ListButton.

getListData

public List<?> getListData()
Returns the list data associated with this list button.

Returns:
The list data.

setListData

public void setListData(List<?> listData)
Sets the list button's list data.

Parameters:
listData - The list data to be presented by the list button.

setListData

public void setListData(String listData)
Sets the list button's list data.

Parameters:
listData - The list data to be presented by the list button as a JSON array.

getItemRenderer

public ListView.ItemRenderer getItemRenderer()
Returns the renderer used to display items in the list.

Returns:
The item renderer instance.

setItemRenderer

public void setItemRenderer(ListView.ItemRenderer itemRenderer)
Sets the renderer used to display items in the list.

Use Button.setDataRenderer(org.apache.pivot.wtk.Button.DataRenderer) to define the renderer used to draw the button data.

Parameters:
itemRenderer - The item renderer instance.

getSelectedIndex

public int getSelectedIndex()
Returns the current selection.

Returns:
The index of the currently selected list item, or -1 if nothing is selected.

setSelectedIndex

public void setSelectedIndex(int selectedIndex)
Sets the selection.

Parameters:
selectedIndex - The index of the list item to select, or -1 to clear the selection.

getSelectedItem

public Object getSelectedItem()

setSelectedItem

public void setSelectedItem(Object item)

isItemDisabled

public boolean isItemDisabled(int index)
Returns an item's disabled state.

Parameters:
index - The index of the item whose disabled state is to be tested.
Returns:
true if the item is disabled; false, otherwise.

getDisabledItemFilter

public Filter<?> getDisabledItemFilter()
Returns the disabled item filter.

Returns:
The disabled item filter, or null if no disabled item filter is set.

setDisabledItemFilter

public void setDisabledItemFilter(Filter<?> disabledItemFilter)
Sets the disabled item filter.

Parameters:
disabledItemFilter - The disabled item filter, or null for no disabled item filter.

getSelectedItemKey

public String getSelectedItemKey()

setSelectedItemKey

public void setSelectedItemKey(String selectedItemKey)

load

public void load(Dictionary<String,?> context)
Description copied from class: Component
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
load in class Button

store

public void store(Dictionary<String,?> context)
Description copied from class: Component
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Overrides:
store in class Button

getListButtonListeners

public ListenerList<ListButtonListener> getListButtonListeners()
Returns the list button listener list.


getListButtonSelectionListeners

public ListenerList<ListButtonSelectionListener> getListButtonSelectionListeners()
Returns the list button selection listener list.