GWT 2.7.0

com.google.gwt.user.client.ui
Class PushButton

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.FocusWidget
              extended by com.google.gwt.user.client.ui.ButtonBase
                  extended by com.google.gwt.user.client.ui.CustomButton
                      extended by com.google.gwt.user.client.ui.PushButton
All Implemented Interfaces:
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, HasSafeHtml, EventListener, Focusable, HasEnabled, HasFocus, HasHTML, HasText, HasVisibility, IsWidget, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, SourcesMouseEvents

public class PushButton
extends CustomButton

A normal push button with custom styling.

CSS Style Rules

Example

public class PushButtonExample implements EntryPoint {

  public void onModuleLoad() {
    // Make a new button that does something when you click it.
    PushButton b = new PushButton("Jump", "Jump?", new ClickHandler() {
      public void onClick(ClickEvent event) {
        Window.alert("Crash...");
        Window.alert("Uh Oh...");
      }
    });

    // In a real application, you would have to have css styles defined for
    // gwt-PushButton-up,gwt-PushButton-up-hovering,gwt-PushButton-up-disabled,
    // gwt-PushButton-down,.gwt-PushButton-down-hovering,.gwt-PushButton-down-disabled

    // Add the push button to the root panel.
    RootPanel.get().add(b);
  }
}


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.CustomButton
CustomButton.Face
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.Widget
eventsToSink
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
 
Constructor Summary
PushButton()
          Constructor for PushButton.
PushButton(Image upImage)
          Constructor for PushButton.
PushButton(Image upImage, ClickHandler handler)
          Constructor for PushButton.
PushButton(Image upImage, ClickListener listener)
          Deprecated. Use PushButton(Image, ClickHandler) instead
PushButton(Image upImage, Image downImage)
          Constructor for PushButton.
PushButton(Image upImage, Image downImage, ClickHandler handler)
          Constructor for PushButton.
PushButton(Image upImage, Image downImage, ClickListener listener)
          Deprecated. Use PushButton(Image, Image, ClickHandler) instead
PushButton(java.lang.String upText)
          Constructor for PushButton.
PushButton(java.lang.String upText, ClickHandler handler)
          Constructor for PushButton.
PushButton(java.lang.String upText, ClickListener listener)
          Deprecated. Use PushButton(String, ClickHandler) instead
PushButton(java.lang.String upText, java.lang.String downText)
          Constructor for PushButton.
PushButton(java.lang.String upText, java.lang.String downText, ClickHandler handler)
          Constructor for PushButton.
PushButton(java.lang.String upText, java.lang.String downText, ClickListener listener)
          Deprecated. Use PushButton(String, String, ClickHandler) instead
 
Method Summary
protected  void onClick()
          Called when the user finishes clicking on this button.
protected  void onClickCancel()
          Called when the user aborts a click in progress; for example, by dragging the mouse outside of the button before releasing the mouse button.
protected  void onClickStart()
          Called when the user begins to click on this button.
 
Methods inherited from class com.google.gwt.user.client.ui.CustomButton
finishSetup, fireClickListeners, getCurrentFace, getDownDisabledFace, getDownFace, getDownHoveringFace, getHTML, getTabIndex, getText, getUpDisabledFace, getUpFace, getUpHoveringFace, isDown, isHovering, onAttach, onBrowserEvent, onDetach, setAccessKey, setCurrentFace, setDown, setEnabled, setFocus, setHovering, setHTML, setHTML, setTabIndex, setText, toggleDown
 
Methods inherited from class com.google.gwt.user.client.ui.FocusWidget
addBlurHandler, addClickHandler, addClickListener, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragHandler, addDragLeaveHandler, addDragOverHandler, addDragStartHandler, addDropHandler, addFocusHandler, addFocusListener, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseListener, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addMouseWheelListener, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, getFocusImpl, isEnabled, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
 
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
 
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
 

Constructor Detail

PushButton

public PushButton()
Constructor for PushButton.


PushButton

public PushButton(Image upImage)
Constructor for PushButton.

Parameters:
upImage - image for the default(up) face of the button

PushButton

public PushButton(Image upImage,
                  ClickHandler handler)
Constructor for PushButton. The supplied image is used to construct the default face of the button.

Parameters:
upImage - image for the default (up) face of the button
handler - teh click handler

PushButton

@Deprecated
public PushButton(Image upImage,
                             ClickListener listener)
Deprecated. Use PushButton(Image, ClickHandler) instead

Constructor for PushButton. The supplied image is used to construct the default face of the button.

Parameters:
upImage - image for the default (up) face of the button
listener - the click listener

PushButton

public PushButton(Image upImage,
                  Image downImage)
Constructor for PushButton.

Parameters:
upImage - image for the default(up) face of the button
downImage - image for the down face of the button

PushButton

public PushButton(Image upImage,
                  Image downImage,
                  ClickHandler handler)
Constructor for PushButton.

Parameters:
upImage - image for the default(up) face of the button
downImage - image for the down face of the button
handler - the click handler

PushButton

@Deprecated
public PushButton(Image upImage,
                             Image downImage,
                             ClickListener listener)
Deprecated. Use PushButton(Image, Image, ClickHandler) instead

Constructor for PushButton.

Parameters:
upImage - image for the default(up) face of the button
downImage - image for the down face of the button
listener - clickListener

PushButton

public PushButton(java.lang.String upText)
Constructor for PushButton. The supplied text is used to construct the default face of the button.

Parameters:
upText - the text for the default (up) face of the button.

PushButton

public PushButton(java.lang.String upText,
                  ClickHandler handler)
Constructor for PushButton. The supplied text is used to construct the default face of the button.

Parameters:
upText - the text for the default (up) face of the button
handler - the click handler

PushButton

@Deprecated
public PushButton(java.lang.String upText,
                             ClickListener listener)
Deprecated. Use PushButton(String, ClickHandler) instead

Constructor for PushButton. The supplied text is used to construct the default face of the button.

Parameters:
upText - the text for the default (up) face of the button
listener - the click listener

PushButton

public PushButton(java.lang.String upText,
                  java.lang.String downText)
Constructor for PushButton.

Parameters:
upText - the text for the default (up) face of the button
downText - the text for down face of the button

PushButton

public PushButton(java.lang.String upText,
                  java.lang.String downText,
                  ClickHandler handler)
Constructor for PushButton.

Parameters:
upText - the text for the default (up) face of the button
downText - the text for down face of the button
handler - the click handler

PushButton

@Deprecated
public PushButton(java.lang.String upText,
                             java.lang.String downText,
                             ClickListener listener)
Deprecated. Use PushButton(String, String, ClickHandler) instead

Constructor for PushButton.

Parameters:
upText - the text for the default (up) face of the button
downText - the text for down face of the button
listener - the click listener
Method Detail

onClick

protected void onClick()
Description copied from class: CustomButton
Called when the user finishes clicking on this button. The default behavior is to fire the click event to listeners. Subclasses that override CustomButton.onClickStart() should override this method to restore the normal widget display.

Overrides:
onClick in class CustomButton

onClickCancel

protected void onClickCancel()
Description copied from class: CustomButton
Called when the user aborts a click in progress; for example, by dragging the mouse outside of the button before releasing the mouse button. Subclasses that override CustomButton.onClickStart() should override this method to restore the normal widget display.

Overrides:
onClickCancel in class CustomButton

onClickStart

protected void onClickStart()
Description copied from class: CustomButton
Called when the user begins to click on this button. Subclasses may override this method to display the start of the click visually; such subclasses should also override CustomButton.onClick() and CustomButton.onClickCancel() to restore normal visual state. Each onClickStart will eventually be followed by either onClick or onClickCancel, depending on whether the click is completed.

Overrides:
onClickStart in class CustomButton

GWT 2.7.0