public class ButtonWrapper extends Wrapper
EMPTY_ELEMENT_ARRAY
Constructor and Description |
---|
ButtonWrapper()
Creates a button without listener.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnClickListener(OnClickListener listener)
Adds a listener on the click events of the button.
|
boolean |
handleEvent(int event)
Called by the system if a child of this composite is the owner of the focus of the active panel (recursively) and
have not consumed the specified event.
|
boolean |
isInState(State state)
Gets whether or not the element is in the given state.
|
protected void |
onClick()
Invoked when the button has been clicked.
|
void |
performClick()
Performs the actions associated to a click.
|
void |
removeOnClickListener(OnClickListener listener)
Removes a listener on the click events of the button.
|
void |
requestFocus()
Requests that the first child of this composite be set as the focus owner of its panel.
|
boolean |
requestFocus(int direction)
Sets a widget in this composite as the focus owner of its panel, if it is enabled, following the direction.
|
contains, isAdjustedToChild, setAdjustedToChild, setBoundsContent, setWidget, validateContent
add, addClassSelector, gainFocus, getAttribute, getChild, getChildrenCount, getChildrenElements, getParentElement, getStyle, hasClassSelector, isTransparent, lostFocus, mergeStyle, removeAllClassSelectors, removeClassSelector, removeInstanceStyle, render, renderContent, setBounds, setClassSelectors, setEnabled, updateStyle, updateStyleOnly, validate
getFocus, getFocusIndex, getNext, getWidget, getWidgetAt, getWidgets, getWidgetsCount, hideNotify, iterator, remove, removeAllWidgets, requestFocusFrom, showNotify
getAbsoluteX, getAbsoluteX, getAbsoluteY, getAbsoluteY, getEventHandler, getHeight, getPanel, getParent, getPreferredHeight, getPreferredWidth, getRelativeX, getRelativeY, getWidth, getX, getY, hasFocus, invalidate, isEnabled, isShown, isValid, isVisible, repaint, repaint, revalidate, revalidateSubTree, setEventHandler, setLocation, setPreferredSize, setSize, setVisible
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEventHandler, getHeight, getWidth, getX, getY, hideNotify, isShown, repaint, repaint, setEventHandler, showNotify
protected void onClick()
public void performClick()
public void addOnClickListener(OnClickListener listener)
listener
- the listener to add.java.lang.NullPointerException
- if the given listener is null
.public void removeOnClickListener(OnClickListener listener)
listener
- the listener to remove.public boolean isInState(State state)
Element
isInState
in interface Element
isInState
in class StyledComposite
state
- the state to check.true
if the element is in the given state, false
otherwise.public boolean handleEvent(int event)
Composite
Command#UP
, Command#DOWN
,
Command#LEFT
, and Command#RIGHT
commands to manage navigation in its children.handleEvent
in interface Renderable
handleEvent
in class Composite
event
- the event to handletrue
if the composite consume the event, false
otherwiseWidget.setEventHandler(EventHandler)
public void requestFocus()
Composite
If the composite does not contain any widgets, nothing is done.
If the composite is not in a panel hierarchy, nothing is done.
Identical to calling Composite.requestFocusFrom(int, int)
with MWT.RIGHT
as direction and 0
as from.
requestFocus
in class Composite
public boolean requestFocus(int direction) throws java.lang.IllegalArgumentException
Composite
The given direction must be one of MWT.UP
, MWT.DOWN
, MWT.LEFT
, MWT.RIGHT
.
If the widget is not in a panel hierarchy, nothing is done.
Identical to calling Composite.requestFocusFrom(int, int)
with one of MWT.DOWN
or MWT.RIGHT
as
direction and 0
as from, or one of MWT.LEFT
or MWT.UP
and
(getWidgetsCount() - 1)
as from.
requestFocus
in class Composite
direction
- the direction followed by the focustrue
if the composite take the focus, false
otherwisejava.lang.IllegalArgumentException
- if direction
is not a valid direction