public class Button
extends com.google.gwt.user.client.ui.Button
Button, can take many shapes. Its appearance is controlled
by a handful of properties but not all are available at the same time. For
example a Fab button can't have all the colors available for a Raised button.
Thereby, a button should not be setup using its constructor. Instead a
builder was implemented to assist in setting up the appropriate options for
the button.| Constructor and Description |
|---|
Button()
Setup an instance by applying the basic properties shared by all material
buttons.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStyleName(String inputStyleName)
Safely adds a new css selector to the button.
|
static Button |
createFab(ButtonFabColor color,
Ripple ripple,
String icon)
Setup a fab material button.
|
static Button |
createFlat(ButtonColor color,
Ripple ripple,
String text)
A flat button is very similar to a raised button.
|
static Button |
createIcon(ButtonColor color,
Ripple ripple,
String icon)
Setup an icon material button.
|
static Button |
createMiniFab(ButtonFabColor color,
Ripple ripple,
String icon)
Setup a mini fab material button.
|
static Button |
createRaised(ButtonColor color,
Ripple ripple,
String text)
Setup a raised material button.
|
ButtonColor |
getColor()
Returns the coloring option of the button.
|
ButtonFabColor |
getFabColor()
Returns the coloring option of the button.
|
Ripple |
getRipple()
Returns the ripple option of the button.
|
String |
getText()
Returns the text of the button, if the button is not flat nor raised, the
returned value is unpredictable.
|
ButtonType |
getType()
Return the material button type provided by one of the options in
ButtonType. |
void |
setColor(ButtonColor inputColor)
Setup the coloring option of the button.
|
void |
setFabColor(ButtonFabColor inputFabColor)
Setup the coloring option of the button.
|
void |
setIcon(String icon)
Add an icon to the button.
|
void |
setRipple(Ripple inputRipple)
Setup the ripple option of the button.
|
void |
setText(String text)
Set the text to be displayed on the button.
|
void |
setType(ButtonType inputType)
The material button type indicates how it renders and what options can be
applied to tweak its appearance.
|
void |
upgrade()
apply javascript behaviors and effects on the button.
|
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, getTabIndex, isEnabled, onAttach, removeClickListener, removeFocusListener, removeKeyboardListener, removeMouseListener, removeMouseWheelListener, setAccessKey, setEnabled, setFocus, setTabIndexaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, 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, toStringpublic Button()
public static Button createRaised(ButtonColor color, Ripple ripple, String text)
color - the background color, should be one of the options provided by
ButtonColorripple - determines whether the button has a ripple, should be one of the
options provided by Rippletext - a text for the buttonpublic static Button createFlat(ButtonColor color, Ripple ripple, String text)
color - The text color should be one of the options provided by
ButtonColorripple - determines whether the button has a ripple, should be one of the
options provided by Rippletext - a text for the buttonpublic static Button createFab(ButtonFabColor color, Ripple ripple, String icon)
color - the background color, should be one of the options provided by
ButtonFabColorripple - determines whether the button has a ripple, one of the options
provided by Rippleicon - a material icon font codepublic static Button createIcon(ButtonColor color, Ripple ripple, String icon)
color - the icon color. Should be one of the options provided by
ButtonColorripple - determines whether the button has a ripple, one of the options
provided by Rippleicon - a material icon font codepublic static Button createMiniFab(ButtonFabColor color, Ripple ripple, String icon)
color - the background color, should be one of the options provided by
ButtonFabColorripple - determines whether the button has a ripple, one of the options
provided by Rippleicon - a material icon font codepublic final void setIcon(String icon)
icon - a material icon font codepublic final void upgrade()
public final ButtonType getType()
ButtonType.ButtonTypepublic final void setType(ButtonType inputType)
ButtonType.inputType - one of the options provided by ButtonTypepublic final ButtonColor getColor()
ButtonColorpublic final void setColor(ButtonColor inputColor)
inputColor - one of the options provided by ButtonColorpublic final ButtonFabColor getFabColor()
ButtonFabColorpublic final void setFabColor(ButtonFabColor inputFabColor)
inputFabColor - one of the options provided by ButtonFabColorpublic final Ripple getRipple()
Ripplepublic final void setRipple(Ripple inputRipple)
inputRipple - one of the options provided by Ripplepublic final void addStyleName(String inputStyleName)
MdlGwtUtils.addStyle(UIObject, Object) should
be used instead.addStyleName in class com.google.gwt.user.client.ui.UIObjectinputStyleName - the css selector to be applied safelypublic final void setText(String text)
setText in interface com.google.gwt.user.client.ui.HasTextsetText in class com.google.gwt.user.client.ui.ButtonBasetext - the text to be set for the buttonpublic final String getText()
getText in interface com.google.gwt.user.client.ui.HasTextgetText in class com.google.gwt.user.client.ui.ButtonBaseCopyright © 2016 com.github.ilyes4j. All rights reserved.