public class ButtonBase extends Object implements HasRipple, IUpgrade
All behaviors expected from a material button are here. An instance of this type is not a component of its own. Instead, it acts on a target component to attach the required behaviors to it. This ensures an extra flexibility when creating material buttons.
It wouldn't be possible to reuse the material button logic in button-like
components if that logic is tied to the Button
component.
Constructor and Description |
---|
ButtonBase(com.google.gwt.dom.client.Element inputElement)
Setup an instance of a material button and provide the target
Element to be decorated with the material button behavior. |
Modifier and Type | Method and Description |
---|---|
ButtonColor |
getColor()
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 . |
boolean |
isUpgraded() |
void |
setColor(ButtonColor inputColor)
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.
If the button is not flat nor raised, the behavior of this method is unpredictable. The super type implementation of this method simply overrides anything inside the button and replaces it with the text provided as input. |
void |
setType(ButtonType inputType)
The material button type indicates how it renders and what options can be
applied to tweak its appearance.
|
void |
upgrade()
Causes the component to be upgraded.
|
public ButtonBase(com.google.gwt.dom.client.Element inputElement)
Element
to be decorated with the material button behavior.inputElement
- the target element to which apply the material button behaviorpublic final void setIcon(String icon)
icon
- a material icon font codepublic final ButtonType getType()
ButtonType
.ButtonType
public final void setType(ButtonType inputType)
ButtonType
.inputType
- one of the options provided by ButtonType
public final ButtonColor getColor()
ButtonColor
public final void setColor(ButtonColor inputColor)
inputColor
- one of the options provided by ButtonColor
public final Ripple getRipple()
public final void setRipple(Ripple inputRipple)
public final void upgrade()
IUpgrade
public boolean isUpgraded()
isUpgraded
in interface IUpgrade
public final void setText(String text)
text
- the text to be set for the buttonpublic final String getText()
Copyright © 2016 com.github.ilyes4j. All rights reserved.