Class CustomButton

java.lang.Object
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
Direct Known Subclasses:
PushButton, ToggleButton

public abstract class CustomButton extends ButtonBase
CustomButton is a base button class with built in support for a set number of button faces. Each face has its own style modifier. For example, the state for down and hovering is assigned the CSS modifier down-hovering. So, if the button's overall style name is gwt-PushButton then when showing the down-hovering face, the button's style is gwt-PushButton-down-hovering. The overall style name can be used to change the style of the button irrespective of the current face.

Each button face can be assigned is own image, text, or html contents. If no content is defined for a face, then the face will use the contents of another face. For example, if down-hovering does not have defined contents, it will use the contents defined by the down face.

The supported faces are defined below:

CSS style name Getter method description of face defaults to contents of face
up getUpFace() face shown when button is up none
down getDownFace() face shown when button is down up
up-hovering getUpHoveringFace() face shown when button is up and hovering up
up-disabled getUpDisabledFace() face shown when button is up and disabled up
down-hovering getDownHoveringFace() face shown when button is down and hovering down
down-disabled getDownDisabledFace() face shown when button is down and disabled down

Use in UiBinder Templates

When working with CustomButton subclasses in UiBinder templates, you can set text and assign ImageResources for their various faces via child elements:

<g:upFace>
<g:downFace>
<g:upHoveringFace>
<g:downHoveringFace>
<g:upDisabledFace>
<g:downDisabledFace>
Each face element can take an optional image attribute and an html body. For example:
 <ui:image field='downButton'/> <!-- define an ImageResource -->

 <g:PushButton ui:field='pushButton' enabled='true'>
   <g:upFace>
     <b>click me</b>
   </gwt:upFace>
   <g:upHoveringFace>
     <b>Click ME!</b>
   </gwt:upHoveringFace>

   <g:downFace image='{downButton}'/>
   <g:downHoveringFace image='{downButton}'/>
 </g:PushButton>