com.github.gwtbootstrap.client.ui
Class Button

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.github.gwtbootstrap.client.ui.base.ComplexWidget
                      extended by com.github.gwtbootstrap.client.ui.base.IconAnchor
                          extended by com.github.gwtbootstrap.client.ui.Button
All Implemented Interfaces:
HasHref, HasIcon, HasStyle, HasType<ButtonType>, IsResponsive, HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers, HasBlurHandlers, HasClickHandlers, HasDoubleClickHandlers, HasDragEndHandlers, HasDragEnterHandlers, HasDragHandlers, HasDragLeaveHandlers, HasDragOverHandlers, HasDragStartHandlers, HasDropHandlers, HasFocusHandlers, HasGestureChangeHandlers, HasGestureEndHandlers, HasGestureStartHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasMouseDownHandlers, HasMouseMoveHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseUpHandlers, HasMouseWheelHandlers, HasTouchCancelHandlers, HasTouchEndHandlers, HasTouchMoveHandlers, HasTouchStartHandlers, HasAttachHandlers, HasHandlers, EventListener, Focusable, HasEnabled, HasText, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>
Direct Known Subclasses:
NavbarButton

public class Button
extends IconAnchor
implements HasClickHandlers, HasDoubleClickHandlers, HasEnabled, HasType<ButtonType>, HasAllDragAndDropHandlers, HasAllFocusHandlers, HasAllGestureHandlers, HasAllKeyHandlers, HasAllMouseHandlers, HasAllTouchHandlers

Button with optional icon.

UiBinder Usage:

 <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.

Since:
2.0.4.0
Author:
Carlos Alexandro Becker, Dominik Mayer
See Also:
Bootstrap documentation, ButtonGroup, ButtonToolbar, DropdownButton, SplitDropdownButton, NavbarButton

Nested Class Summary
 class Button.LoadingStateBehavior
          A simple class to encapsulate the button state managing from the user.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
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.
 
Method Summary
 HandlerRegistration addBlurHandler(BlurHandler handler)
          
 HandlerRegistration addClickHandler(ClickHandler handler)
          
 HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)
          
 HandlerRegistration addDragEndHandler(DragEndHandler handler)
          
 HandlerRegistration addDragEnterHandler(DragEnterHandler handler)
          
 HandlerRegistration addDragHandler(DragHandler handler)
          
 HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)
          
 HandlerRegistration addDragOverHandler(DragOverHandler handler)
          
 HandlerRegistration addDragStartHandler(DragStartHandler handler)
          
 HandlerRegistration addDropHandler(DropHandler handler)
          
 HandlerRegistration addFocusHandler(FocusHandler handler)
          
 HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)
          
 HandlerRegistration addGestureEndHandler(GestureEndHandler handler)
          
 HandlerRegistration addGestureStartHandler(GestureStartHandler handler)
          
 HandlerRegistration addKeyDownHandler(KeyDownHandler handler)
          
 HandlerRegistration addKeyPressHandler(KeyPressHandler handler)
          
 HandlerRegistration addKeyUpHandler(KeyUpHandler handler)
          
 HandlerRegistration addMouseDownHandler(MouseDownHandler handler)
          
 HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)
          
 HandlerRegistration addMouseOutHandler(MouseOutHandler handler)
          
 HandlerRegistration addMouseOverHandler(MouseOverHandler handler)
          
 HandlerRegistration addMouseUpHandler(MouseUpHandler handler)
          
 HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)
          
 HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)
          
 HandlerRegistration addTouchEndHandler(TouchEndHandler handler)
          
 HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)
          
 HandlerRegistration addTouchStartHandler(TouchStartHandler handler)
          
 ButtonSize getSize()
           
 ButtonType getType()
           
 boolean isEnabled()
          Whether the Button is enabled or disabled.
 boolean isToggle()
          Verify if the property "toggle" is set.
 boolean isToggled()
          Verify if the button is toggled.
 void setCompleteText(String text)
          Set a Loading Text to show when some action are completed with this button.
 void setEnabled(boolean enabled)
          Sets whether the Button is enabled or disabled.
 void setLoadingText(String text)
          Set a Loading Text to show when some action are in work with this button.
 void setSize(ButtonSize size)
          Sets the size of the Button.
 void setToggle(boolean toggle)
          Enable ou disable the data-toggle behavior.
 void setType(ButtonType type)
          Sets the type of the Button.
 Button.LoadingStateBehavior state()
          A simple DSL to change the button state to loading, complete, or reset it.
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.IconAnchor
getHref, getTabIndex, getTargetHistoryToken, getText, onAttach, onBrowserEvent, setAccessKey, setCaret, setEmptyHref, setFocus, setHref, setIcon, setIconSize, setTabIndex, setTargetHistoryToken, setText
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.ComplexWidget
add, addStyle, insert, removeStyle, setHideOn, setShowOn, setStyle
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 
Methods inherited from interface com.google.gwt.user.client.ui.HasWidgets
clear, iterator, remove
 

Constructor Detail

Button

public Button()
Creates an empty Button.


Button

public Button(ClickHandler handler)
Creates an Button with ClickHandler

Parameters:
handler - Butotn ClickHandler

Button

public Button(String caption)
Creates a Button with the given caption.

Parameters:
caption - the caption of the Button

Button

public Button(String caption,
              ClickHandler handler)
Create Button with click handler.

Parameters:
caption - the caption of the Button
handler - Button Click Handler

Button

public Button(String caption,
              IconType icon)
Creates a Button with the given caption and icon.

Parameters:
caption - the caption of the Button
icon - the Icon on the caption's left

Button

public Button(String caption,
              IconType icon,
              ClickHandler handler)
Creates a Button with the given caption and icon and ClickHandler.

Parameters:
caption - the caption of the Button
icon - the Icon on the caption's left
handler - the ClickHandler of the Button.
Method Detail

setType

public void setType(ButtonType type)
Sets the type of the Button.

Different types give the button a different look.

Specified by:
setType in interface HasType<ButtonType>
Parameters:
type - the type of the Button.

setSize

public void setSize(ButtonSize size)
Sets the size of the Button.

Parameters:
size - the size of the Button.

isEnabled

public boolean isEnabled()
Whether the Button is enabled or disabled.

A disabled widget cannot be used.

Specified by:
isEnabled in interface HasEnabled
Overrides:
isEnabled in class IconAnchor
Returns:
false if the Button is disabled.

setEnabled

public void setEnabled(boolean enabled)
Sets whether the Button is enabled or disabled.

A disabled widget cannot be used.

Specified by:
setEnabled in interface HasEnabled
Overrides:
setEnabled in class IconAnchor
Parameters:
enabled - false if the Button should be disabled. Default: true

setToggle

public void setToggle(boolean toggle)
Enable ou disable the data-toggle behavior.

Parameters:
toggle - true will enable this behavior. false will disable it or do nothing if it never was enabled.

isToggle

public boolean isToggle()
Verify if the property "toggle" is set.

Returns:
true: if the data-toggle is equal 'button' false: otherwise

isToggled

public boolean isToggled()
Verify if the button is toggled.

Returns:
true: if yes (it will contain the "active" styleclass false: otherwise.

setLoadingText

public void setLoadingText(String text)
Set a Loading Text to show when some action are in work with this button.

Parameters:
text -
See Also:
Button.LoadingStateBehavior

setCompleteText

public void setCompleteText(String text)
Set a Loading Text to show when some action are completed with this button.

Parameters:
text -
See Also:
Button.LoadingStateBehavior

state

public Button.LoadingStateBehavior state()
A simple DSL to change the button state to loading, complete, or reset it.

Returns:

addClickHandler

public HandlerRegistration addClickHandler(ClickHandler handler)

Specified by:
addClickHandler in interface HasClickHandlers
Overrides:
addClickHandler in class IconAnchor

addDoubleClickHandler

public HandlerRegistration addDoubleClickHandler(DoubleClickHandler handler)

Specified by:
addDoubleClickHandler in interface HasDoubleClickHandlers

addDragEndHandler

public HandlerRegistration addDragEndHandler(DragEndHandler handler)

Specified by:
addDragEndHandler in interface HasDragEndHandlers

addDragEnterHandler

public HandlerRegistration addDragEnterHandler(DragEnterHandler handler)

Specified by:
addDragEnterHandler in interface HasDragEnterHandlers

addDragLeaveHandler

public HandlerRegistration addDragLeaveHandler(DragLeaveHandler handler)

Specified by:
addDragLeaveHandler in interface HasDragLeaveHandlers

addDragHandler

public HandlerRegistration addDragHandler(DragHandler handler)

Specified by:
addDragHandler in interface HasDragHandlers

addDragOverHandler

public HandlerRegistration addDragOverHandler(DragOverHandler handler)

Specified by:
addDragOverHandler in interface HasDragOverHandlers

addDragStartHandler

public HandlerRegistration addDragStartHandler(DragStartHandler handler)

Specified by:
addDragStartHandler in interface HasDragStartHandlers

addDropHandler

public HandlerRegistration addDropHandler(DropHandler handler)

Specified by:
addDropHandler in interface HasDropHandlers

addFocusHandler

public HandlerRegistration addFocusHandler(FocusHandler handler)

Specified by:
addFocusHandler in interface HasFocusHandlers

addBlurHandler

public HandlerRegistration addBlurHandler(BlurHandler handler)

Specified by:
addBlurHandler in interface HasBlurHandlers

addGestureStartHandler

public HandlerRegistration addGestureStartHandler(GestureStartHandler handler)

Specified by:
addGestureStartHandler in interface HasGestureStartHandlers

addGestureChangeHandler

public HandlerRegistration addGestureChangeHandler(GestureChangeHandler handler)

Specified by:
addGestureChangeHandler in interface HasGestureChangeHandlers

addGestureEndHandler

public HandlerRegistration addGestureEndHandler(GestureEndHandler handler)

Specified by:
addGestureEndHandler in interface HasGestureEndHandlers

addKeyUpHandler

public HandlerRegistration addKeyUpHandler(KeyUpHandler handler)

Specified by:
addKeyUpHandler in interface HasKeyUpHandlers

addKeyDownHandler

public HandlerRegistration addKeyDownHandler(KeyDownHandler handler)

Specified by:
addKeyDownHandler in interface HasKeyDownHandlers

addKeyPressHandler

public HandlerRegistration addKeyPressHandler(KeyPressHandler handler)

Specified by:
addKeyPressHandler in interface HasKeyPressHandlers

addMouseDownHandler

public HandlerRegistration addMouseDownHandler(MouseDownHandler handler)

Specified by:
addMouseDownHandler in interface HasMouseDownHandlers

addMouseUpHandler

public HandlerRegistration addMouseUpHandler(MouseUpHandler handler)

Specified by:
addMouseUpHandler in interface HasMouseUpHandlers

addMouseOutHandler

public HandlerRegistration addMouseOutHandler(MouseOutHandler handler)

Specified by:
addMouseOutHandler in interface HasMouseOutHandlers

addMouseOverHandler

public HandlerRegistration addMouseOverHandler(MouseOverHandler handler)

Specified by:
addMouseOverHandler in interface HasMouseOverHandlers

addMouseMoveHandler

public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler)

Specified by:
addMouseMoveHandler in interface HasMouseMoveHandlers

addMouseWheelHandler

public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler)

Specified by:
addMouseWheelHandler in interface HasMouseWheelHandlers

addTouchStartHandler

public HandlerRegistration addTouchStartHandler(TouchStartHandler handler)

Specified by:
addTouchStartHandler in interface HasTouchStartHandlers

addTouchMoveHandler

public HandlerRegistration addTouchMoveHandler(TouchMoveHandler handler)

Specified by:
addTouchMoveHandler in interface HasTouchMoveHandlers

addTouchEndHandler

public HandlerRegistration addTouchEndHandler(TouchEndHandler handler)

Specified by:
addTouchEndHandler in interface HasTouchEndHandlers

addTouchCancelHandler

public HandlerRegistration addTouchCancelHandler(TouchCancelHandler handler)

Specified by:
addTouchCancelHandler in interface HasTouchCancelHandlers

getType

public ButtonType getType()

getSize

public ButtonSize getSize()


Copyright © 2012 gwtbootstrap. All Rights Reserved.