java.lang.Object | |||||
↳ | com.google.gwt.user.client.ui.UIObject | ||||
↳ | com.google.gwt.user.client.ui.Widget | ||||
↳ | com.google.gwt.user.client.ui.FocusWidget | ||||
↳ | com.google.gwt.user.client.ui.ButtonBase | ||||
↳ | com.google.gwt.user.client.ui.CustomButton |
Known Direct Subclasses |
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 |
UiBinder
templates, you
can set text and assign ImageResources for their various faces via
child elements:
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>
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CustomButton.Face | Represents a button's face. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.google.gwt.user.client.ui.UIObject
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor for
CustomButton . | |||||||||||
Constructor for
CustomButton . | |||||||||||
This constructor is deprecated.
Use
CustomButton(Image, ClickHandler) instead
| |||||||||||
Constructor for
CustomButton . | |||||||||||
Constructor for
CustomButton . | |||||||||||
This constructor is deprecated.
Use
CustomButton(Image, Image, ClickHandler) instead
| |||||||||||
Constructor for
CustomButton . | |||||||||||
Constructor for
CustomButton . | |||||||||||
This constructor is deprecated.
Use
CustomButton(String, ClickListener) instead
| |||||||||||
Constructor for
CustomButton . | |||||||||||
Constructor for
CustomButton . | |||||||||||
This constructor is deprecated.
Use
CustomButton(String, String, ClickHandler) instead
|
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructor for
CustomButton . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Gets the downDisabled face of the button.
| |||||||||||
Gets the down face of the button.
| |||||||||||
Gets the downHovering face of the button.
| |||||||||||
Gets the current face's html.
| |||||||||||
Gets the tab index.
| |||||||||||
Gets the current face's text.
| |||||||||||
Gets the upDisabled face of the button.
| |||||||||||
Gets the up face of the button.
| |||||||||||
Gets the upHovering face of the button.
| |||||||||||
Fired whenever a browser event is received.
| |||||||||||
Sets the widget's 'access key'.
| |||||||||||
Sets whether this button is enabled.
| |||||||||||
Explicitly focus/unfocus this widget.
| |||||||||||
Sets this object's contents via known-safe HTML.
| |||||||||||
Sets the current face's html.
| |||||||||||
Sets the widget's position in the tab index.
| |||||||||||
Sets the current face's text.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Is this button down?
| |||||||||||
Overridden on attach to ensure that a button face has been chosen before
the button is displayed.
| |||||||||||
Called when the user finishes clicking on this button.
| |||||||||||
Called when the user aborts a click in progress; for example, by dragging
the mouse outside of the button before releasing the mouse button.
| |||||||||||
Called when the user begins to click on this button.
| |||||||||||
This method is called when a widget is detached from the browser's document. | |||||||||||
Sets whether this button is down.
|
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|---|
handler | the click handler |
This constructor is deprecated.
Use CustomButton(Image, ClickHandler)
instead
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|---|
listener | the click listener |
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|---|
downImage | image for the down face of the button |
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|---|
downImage | image for the down face of the button |
handler | clickListener |
This constructor is deprecated.
Use CustomButton(Image, Image, ClickHandler)
instead
Constructor for CustomButton
.
upImage | image for the default (up) face of the button |
---|---|
downImage | image for the down face of the button |
listener | clickListener |
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|---|
handler | the click handler |
This constructor is deprecated.
Use CustomButton(String, ClickListener)
instead
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|---|
listener | the click listener |
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|---|
downText | the text for the down face of the button |
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|---|
downText | the text for the down face of the button |
handler | the click handler |
This constructor is deprecated.
Use CustomButton(String, String, ClickHandler)
instead
Constructor for CustomButton
.
upText | the text for the default (up) face of the button |
---|---|
downText | the text for the down face of the button |
listener | the click listener |
Constructor for CustomButton
.
Gets the downDisabled face of the button.
Gets the down face of the button.
Gets the downHovering face of the button.
Gets the tab index.
Gets the upDisabled face of the button.
Gets the upHovering face of the button.
Fired whenever a browser event is received.
event | the event received |
---|
Sets the widget's 'access key'. This key is used (in conjunction with a browser-specific modifier key) to automatically focus the widget.
key | the widget's access key |
---|
Sets whether this button is enabled.
enabled | true to enable the button, false
to disable it
|
---|
Explicitly focus/unfocus this widget. Only one widget can have focus at a time, and the widget that does will receive all keyboard events.
focused | whether this widget should take focus or release it |
---|
Sets this object's contents via known-safe HTML.
The object will behave exactly the same as when a widget's
setHTML(String)
method is
invoked; however the SafeHtml
passed to this method observes the
contract that it can be used in an HTML context without causing unsafe
script execution. Thus, unlike
setHTML(String)
, using this
method cannot result in Cross-Site Scripting security vulnerabilities.
html | the object's new HTML, represented as a SafeHtml object
|
---|
Sets the widget's position in the tab index. If more than one widget has
the same tab index, each such widget will receive focus in an arbitrary
order. Setting the tab index to -1
will cause this widget to
be removed from the tab order.
index | the widget's tab index |
---|
Is this button down?
true
if the button is down
Overridden on attach to ensure that a button face has been chosen before the button is displayed.
Called when the user finishes clicking on this button. The default behavior
is to fire the click event to listeners. Subclasses that override
onClickStart()
should override this method to restore the normal
widget display.
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 onClickStart()
should override this
method to restore the normal widget display.
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 onClick()
and
onClickCancel()
to restore normal visual state. Each
onClickStart
will eventually be followed by either
onClick
or onClickCancel
, depending on whether
the click is completed.
This method is called when a widget is detached from the browser's
document. To receive notification before a Widget is removed from the
document, override the onUnload()
method or use addAttachHandler(AttachEvent.Handler)
.
It is strongly recommended that you override onUnload()
or
doDetachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been detached
from the underlying Element. Failure to do so will result in application
memory leaks due to circular references between DOM Elements and JavaScript
objects.
Sets whether this button is down.
down | true to press the button, false
otherwise
|
---|