org.apache.pivot.wtk
Class Button

java.lang.Object
  extended by org.apache.pivot.wtk.Component
      extended by org.apache.pivot.wtk.Button
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
CalendarButton, Checkbox, ColorChooserButton, LinkButton, ListButton, Menu.Item, MenuBar.Item, MenuButton, PushButton, RadioButton, TerraAccordionSkin.PanelHeader, TerraCalendarSkin.DateButton, TerraPanoramaSkin.ScrollButton, TerraTabPaneSkin.TabButton

public abstract class Button
extends Component

Abstract base class for button components.


Nested Class Summary
static interface Button.ButtonDataBindMapping
          Translates between button buttonData and context data during data binding.
static interface Button.DataRenderer
          Renderer interface to customize the appearance of data in a Button.
static interface Button.SelectedBindMapping
          Translates between selection state and context data during data binding.
static class Button.State
          Enumeration representing a button's selection state.
static interface Button.StateBindMapping
          Translates between button state and context data during data binding.
 
Nested classes/interfaces inherited from class org.apache.pivot.wtk.Component
Component.DecoratorSequence, Component.StyleDictionary, Component.UserDataDictionary
 
Constructor Summary
Button()
           
Button(Object buttonData)
           
 
Method Summary
 void clear()
          Clears any bound values in the component.
 Action getAction()
          Returns the action associated with this button.
 ListenerList<ButtonBindingListener> getButtonBindingListeners()
           
 Object getButtonData()
           
 Button.ButtonDataBindMapping getButtonDataBindMapping()
           
 BindType getButtonDataBindType()
           
 String getButtonDataKey()
           
 ButtonGroup getButtonGroup()
          Returns the button's button group.
 ListenerList<ButtonListener> getButtonListeners()
           
 ListenerList<ButtonPressListener> getButtonPressListeners()
           
 ListenerList<ButtonStateListener> getButtonStateListeners()
           
 Button.DataRenderer getDataRenderer()
           
 Button.SelectedBindMapping getSelectedBindMapping()
           
 BindType getSelectedBindType()
           
 String getSelectedKey()
           
 Button.State getState()
          Returns the button's selection state.
 Button.StateBindMapping getStateBindMapping()
           
 BindType getStateBindType()
           
 String getStateKey()
           
 boolean isSelected()
          Returns the button's selected state.
 boolean isToggleButton()
          Returns the button's toggle state.
 boolean isTriState()
          Returns the button's tri-state state.
 void load(Object context)
          Copies bound values from the bind context to the component.
 void press()
          "Presses" the button.
 void setAction(Action action)
          Sets this button's action.
 void setAction(String actionID)
          Sets this button's action.
 void setButtonData(Object buttonData)
           
 void setButtonDataBindMapping(Button.ButtonDataBindMapping buttonDataBindMapping)
           
 void setButtonDataBindType(BindType buttonDataBindType)
           
 void setButtonDataKey(String buttonDataKey)
           
 void setButtonGroup(ButtonGroup buttonGroup)
          Sets the button's button group.
 void setDataRenderer(Button.DataRenderer dataRenderer)
           
 void setEnabled(boolean enabled)
          Sets the component's enabled state.
 void setSelected(boolean selected)
          Sets the button's selected state.
 void setSelectedBindMapping(Button.SelectedBindMapping selectedBindMapping)
           
 void setSelectedBindType(BindType selectedBindType)
           
 void setSelectedKey(String selectedKey)
           
 void setState(Button.State state)
          Sets the button's selection state.
 void setStateBindMapping(Button.StateBindMapping stateBindMapping)
           
 void setStateBindType(BindType stateBindType)
           
 void setStateKey(String stateKey)
           
 void setToggleButton(boolean toggleButton)
          Sets the button's toggle state.
 void setTriState(boolean triState)
          Sets the button's tri-state state.
 void store(Object context)
          Copies bound values from the component to the bind context.
 
Methods inherited from class org.apache.pivot.wtk.Component
clearFocus, contains, 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, getGraphics, getHeight, getHeightLimits, getLocation, getMaximumHeight, getMaximumWidth, getMenuHandler, getMinimumHeight, getMinimumWidth, getMouseLocation, getName, getNamedStyles, getParent, getPreferredHeight, getPreferredHeight, getPreferredSize, getPreferredWidth, getPreferredWidth, getSize, getSkin, getStyles, getTooltipDelay, getTooltipText, getTooltipWrapText, getTypedStyles, getUserData, getVisibleArea, getVisibleArea, getVisibleArea, getWidth, getWidthLimits, getWindow, getX, getY, indexBoundsCheck, installSkin, invalidate, isBlocked, isEnabled, isFocusable, isFocused, isMouseOver, isOpaque, isPreferredHeightSet, isPreferredSizeSet, isPreferredWidthSet, isShowing, isValid, isVisible, keyPressed, keyReleased, keyTyped, layout, mapPointFromAncestor, mapPointFromAncestor, mapPointToAncestor, mapPointToAncestor, mouseClick, mouseDown, mouseMove, mouseOut, mouseOver, mouseUp, mouseWheel, paint, reenterMouse, repaint, repaint, repaint, repaint, repaint, repaint, requestFocus, scrollAreaToVisible, scrollAreaToVisible, setAttribute, setAutomationID, setCursor, setDragSource, setDropTarget, setFocused, setHeight, setHeightLimits, setHeightLimits, setLocation, setLocation, setMaximumHeight, setMaximumWidth, setMenuHandler, setMinimumHeight, setMinimumWidth, setName, setParent, setPreferredHeight, setPreferredSize, setPreferredSize, setPreferredWidth, setSize, setSize, setSkin, setStyleName, setStyleNames, setStyleNames, setStyles, setStyles, setTooltipDelay, setTooltipText, setTooltipWrapText, setVisible, setWidth, setWidthLimits, setWidthLimits, setX, setY, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Button

public Button()

Button

public Button(Object buttonData)
Method Detail

getButtonData

public Object getButtonData()

setButtonData

public void setButtonData(Object buttonData)

getDataRenderer

public Button.DataRenderer getDataRenderer()

setDataRenderer

public void setDataRenderer(Button.DataRenderer dataRenderer)

getAction

public Action getAction()
Returns the action associated with this button.

Returns:
The button's action, or null if no action is defined.

setAction

public void setAction(Action action)
Sets this button's action.

Parameters:
action - The action to be triggered when this button is pressed, or null for no action.

setAction

public void setAction(String actionID)
Sets this button's action.

Parameters:
actionID - The ID of the action to be triggered when this button is pressed.
Throws:
IllegalArgumentException - If an action with the given ID does not exist.

setEnabled

public void setEnabled(boolean enabled)
Description copied from class: Component
Sets the component's enabled state. Enabled components respond to user input events; disabled components do not.

Overrides:
setEnabled in class Component
Parameters:
enabled - true if the component is enabled; false, otherwise.

press

public void press()
"Presses" the button. Performs any action associated with the button.


isSelected

public boolean isSelected()
Returns the button's selected state.


setSelected

public void setSelected(boolean selected)
Sets the button's selected state.

Parameters:
selected -

getState

public Button.State getState()
Returns the button's selection state.


setState

public void setState(Button.State state)
Sets the button's selection state.

Parameters:
state -

isToggleButton

public boolean isToggleButton()
Returns the button's toggle state.


setToggleButton

public void setToggleButton(boolean toggleButton)
Sets the button's toggle state.

Parameters:
toggleButton -

isTriState

public boolean isTriState()
Returns the button's tri-state state.


setTriState

public void setTriState(boolean triState)
Sets the button's tri-state state.

Parameters:
triState -

getButtonGroup

public ButtonGroup getButtonGroup()
Returns the button's button group.

Returns:
The group to which the button belongs, or null if the button does not belong to a group.

setButtonGroup

public void setButtonGroup(ButtonGroup buttonGroup)
Sets the button's button group.

Parameters:
buttonGroup - The group to which the button will belong, or null if the button will not belong to a group.

getButtonDataKey

public String getButtonDataKey()

setButtonDataKey

public void setButtonDataKey(String buttonDataKey)

getButtonDataBindType

public BindType getButtonDataBindType()

setButtonDataBindType

public void setButtonDataBindType(BindType buttonDataBindType)

getButtonDataBindMapping

public Button.ButtonDataBindMapping getButtonDataBindMapping()

setButtonDataBindMapping

public void setButtonDataBindMapping(Button.ButtonDataBindMapping buttonDataBindMapping)

getSelectedKey

public String getSelectedKey()

setSelectedKey

public void setSelectedKey(String selectedKey)

getSelectedBindType

public BindType getSelectedBindType()

setSelectedBindType

public void setSelectedBindType(BindType selectedBindType)

getSelectedBindMapping

public Button.SelectedBindMapping getSelectedBindMapping()

setSelectedBindMapping

public void setSelectedBindMapping(Button.SelectedBindMapping selectedBindMapping)

getStateKey

public String getStateKey()

setStateKey

public void setStateKey(String stateKey)

getStateBindType

public BindType getStateBindType()

setStateBindType

public void setStateBindType(BindType stateBindType)

getStateBindMapping

public Button.StateBindMapping getStateBindMapping()

setStateBindMapping

public void setStateBindMapping(Button.StateBindMapping stateBindMapping)

load

public void load(Object 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 Component

store

public void store(Object 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 Component

clear

public void clear()
Description copied from class: Component
Clears any bound values in the component.

Overrides:
clear in class Component

getButtonListeners

public ListenerList<ButtonListener> getButtonListeners()

getButtonStateListeners

public ListenerList<ButtonStateListener> getButtonStateListeners()

getButtonPressListeners

public ListenerList<ButtonPressListener> getButtonPressListeners()

getButtonBindingListeners

public ListenerList<ButtonBindingListener> getButtonBindingListeners()