public class Button extends IconAnchor implements HasClickHandlers, HasDoubleClickHandlers, HasEnabled, HasType<ButtonType>, HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers
<b:Button icon="TRASH" type="ERROR" toggle="true" loadingText="I'm loading..." completeText="Oh hoh, I completed the action!">Delete</b:Button>
All arguments are optional.
ButtonGroup
,
ButtonToolbar
,
DropdownButton
,
SplitDropdownButton
,
NavbarButton
Modifier and Type | Class and Description |
---|---|
class |
Button.LoadingStateBehavior
A simple class to encapsulate the button state managing from the user.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
IndexedPanel.ForIsWidget
icon
DEBUG_ID_PREFIX
Constructor and Description |
---|
Button()
Creates an empty Button.
|
Button(ClickHandler handler)
Creates an Button with ClickHandler
|
Button(String caption)
Creates a Button with the given caption.
|
Button(String caption,
ClickHandler handler)
Create Button with click handler.
|
Button(String caption,
IconType icon)
Creates a Button with the given caption and icon.
|
Button(String caption,
IconType icon,
ClickHandler handler)
Creates a Button with the given caption and icon and ClickHandler.
|
getAnchorElement, getHref, getName, getTabIndex, getTarget, getTargetHistoryToken, getText, isActive, onAttach, onBrowserEvent, setAccessKey, setActive, setBaseIcon, setCaret, setCustomIconStyle, setEmptyHref, setFocus, setHref, setIcon, setIconPosition, setIconSize, setName, setTabIndex, setTarget, setTargetHistoryToken, setText
add, addStyle, insert, removeStyle, setHideOn, setShowOn, setStyle
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
clear, iterator, remove
public Button()
public Button(ClickHandler handler)
handler
- Butotn ClickHandlerpublic Button(String caption)
caption
- the caption of the Buttonpublic Button(String caption, ClickHandler handler)
caption
- the caption of the Buttonhandler
- Button Click Handlerpublic Button(String caption, IconType icon)
caption
- the caption of the Buttonicon
- the Icon on the caption's leftpublic Button(String caption, IconType icon, ClickHandler handler)
caption
- the caption of the Buttonicon
- the Icon on the caption's lefthandler
- the ClickHandler of the Button.public void setType(ButtonType type)
Different types give the button a different look.
setType
in interface HasType<ButtonType>
type
- the type of the Button.public void setSize(ButtonSize size)
size
- the size of the Button.public boolean isEnabled()
A disabled widget cannot be used.
isEnabled
in interface HasEnabled
isEnabled
in class IconAnchor
false
if the Button is disabled.public void setEnabled(boolean enabled)
A disabled widget cannot be used.
setEnabled
in interface HasEnabled
setEnabled
in class IconAnchor
enabled
- false
if the Button should be disabled. Default:
true
public void setToggle(boolean toggle)
toggle
- true
will enable this behavior.
false
will disable it or do nothing if it never
was enabled.public boolean isToggle()
public boolean isToggled()
public void setLoadingText(String text)
text
- Button.LoadingStateBehavior
public void setCompleteText(String text)
text
- Button.LoadingStateBehavior
public Button.LoadingStateBehavior state()
public HandlerRegistration addClickHandler(ClickHandler handler)
addClickHandler
in interface HasClickHandlers
addClickHandler
in class IconAnchor
public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
addDoubleClickHandler
in interface HasDoubleClickHandlers
public HandlerRegistration addDragEndHandler(DragEndHandler handler)
addDragEndHandler
in interface HasDragEndHandlers
public HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
addDragEnterHandler
in interface HasDragEnterHandlers
public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
addDragLeaveHandler
in interface HasDragLeaveHandlers
public HandlerRegistration addDragHandler(DragHandler handler)
addDragHandler
in interface HasDragHandlers
public HandlerRegistration addDragOverHandler(DragOverHandler handler)
addDragOverHandler
in interface HasDragOverHandlers
public HandlerRegistration addDragStartHandler(DragStartHandler handler)
addDragStartHandler
in interface HasDragStartHandlers
public HandlerRegistration addDropHandler(DropHandler handler)
addDropHandler
in interface HasDropHandlers
public HandlerRegistration addFocusHandler(FocusHandler handler)
addFocusHandler
in interface HasFocusHandlers
public HandlerRegistration addBlurHandler(BlurHandler handler)
addBlurHandler
in interface HasBlurHandlers
public HandlerRegistration addGestureStartHandler(GestureStartHandler handler)
addGestureStartHandler
in interface HasGestureStartHandlers
public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)
addGestureChangeHandler
in interface HasGestureChangeHandlers
public HandlerRegistration addGestureEndHandler(GestureEndHandler handler)
addGestureEndHandler
in interface HasGestureEndHandlers
public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
addKeyUpHandler
in interface HasKeyUpHandlers
public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
addKeyDownHandler
in interface HasKeyDownHandlers
public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
addKeyPressHandler
in interface HasKeyPressHandlers
public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
addMouseDownHandler
in interface HasMouseDownHandlers
addMouseDownHandler
in class IconAnchor
public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
addMouseUpHandler
in interface HasMouseUpHandlers
public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
addMouseOutHandler
in interface HasMouseOutHandlers
public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
addMouseOverHandler
in interface HasMouseOverHandlers
public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
addMouseMoveHandler
in interface HasMouseMoveHandlers
public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
addMouseWheelHandler
in interface HasMouseWheelHandlers
public HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
addTouchStartHandler
in interface HasTouchStartHandlers
public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
addTouchMoveHandler
in interface HasTouchMoveHandlers
public HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
addTouchEndHandler
in interface HasTouchEndHandlers
public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
addTouchCancelHandler
in interface HasTouchCancelHandlers
public ButtonType getType()
public ButtonSize getSize()
public void setBlock(boolean block)
block
- true:Block Level false:Defaultpublic void click()
public void setDismiss(DismissType type)
Modal
or Alert
.
UiBinder example:
<b:Modal>
<b:ModalFooter>
<b:Button text="Close" dismiss="MODAL"/>
</b:ModalFooter>
</b:Modal>
See Bootstrap documentation.
type
- Type of dismiss ("modal" or "alert")Copyright © 2012-2014 gwtbootstrap. All Rights Reserved.