Class SimpleButtonState
java.lang.Object
org.vaadin.miki.superfields.buttons.SimpleButtonState
- All Implemented Interfaces:
Serializable,HasComponentAsIcon,HasText,WithComponentAsIconMixin<SimpleButtonState>,WithTextMixin<SimpleButtonState>,ButtonState
public class SimpleButtonState
extends Object
implements ButtonState, WithComponentAsIconMixin<SimpleButtonState>, WithTextMixin<SimpleButtonState>
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a completely blank state.SimpleButtonState(com.vaadin.flow.component.Component icon, String... classNames) Creates button state with corresponding icon.SimpleButtonState(String text, com.vaadin.flow.component.Component icon, String... classNames) Creates button state.SimpleButtonState(String text, String... classNames) Creates button state with corresponding text. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddClassName(String... classNames) Adds given style class names to this state.voidaddThemeName(String... themeNames) Adds given theme names to this state.voidaddThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) Adds given theme variants to this state.copy()Returns a deep copy of this object.static List<ButtonState>Turns given texts into correspondingButtonStates, one for each text.Returns current (ordered) set of style class names associated with this state.com.vaadin.flow.component.ComponentgetIcon()Returns current icon of the button.getText()Returns current text of the button.Returns current (ordered) set of theme names associated with this state.Set<com.vaadin.flow.component.button.ButtonVariant>Returns current (ordered) set of theme variants associated with this state.voidremoveClassName(String... classNames) Removes given style class names from this state.voidremoveThemeName(String... themeNames) Removes given theme names from this state.voidremoveThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) Removes given theme variants from this state.voidsetIcon(com.vaadin.flow.component.Component icon) Sets givenComponentas an icon of this object.voidSets text of this object.withClassName(String... classNames) ChainsaddClassName(String...)and returns itself.withoutClassName(String... classNames) ChainsremoveClassName(String...)and returns itself.withoutThemeName(String... themeNames) ChainsremoveThemeName(String...)and returns itself.withoutThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) ChainsremoveThemeVariant(ButtonVariant...)and returns itself.withThemeName(String... themeNames) ChainsaddThemeName(String...)and returns itself.withThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) ChainsaddThemeVariant(ButtonVariant...)and returns itself.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.vaadin.miki.markers.WithComponentAsIconMixin
withIconMethods inherited from interface org.vaadin.miki.markers.WithTextMixin
withText
-
Constructor Details
-
SimpleButtonState
public SimpleButtonState()Creates a completely blank state. -
SimpleButtonState
Creates button state with corresponding text.- Parameters:
text- Text.classNames- Optional style class names associated with this state.
-
SimpleButtonState
Creates button state with corresponding icon.- Parameters:
icon- AComponentto use as an icon.classNames- Optional style class names associated with this state.
-
SimpleButtonState
public SimpleButtonState(String text, com.vaadin.flow.component.Component icon, String... classNames) Creates button state.- Parameters:
text- Text.icon- AComponentto use as an icon.classNames- Optional style class names associated with this state.
-
-
Method Details
-
forTexts
Turns given texts into correspondingButtonStates, one for each text.- Parameters:
texts- Texts to produceButtonStates for.- Returns:
- A non-null list of
ButtonStates.
-
getText
Description copied from interface:ButtonStateReturns current text of the button.- Specified by:
getTextin interfaceButtonState- Specified by:
getTextin interfaceHasText- Returns:
- Text.
-
setText
Description copied from interface:HasTextSets text of this object. -
getIcon
public com.vaadin.flow.component.Component getIcon()Description copied from interface:ButtonStateReturns current icon of the button.- Specified by:
getIconin interfaceButtonState- Specified by:
getIconin interfaceHasComponentAsIcon- Returns:
- Icon.
-
setIcon
public void setIcon(com.vaadin.flow.component.Component icon) Description copied from interface:HasComponentAsIconSets givenComponentas an icon of this object.- Specified by:
setIconin interfaceHasComponentAsIcon- Parameters:
icon- AComponentto be used as an icon. Can benullto clear current icon.
-
addClassName
Adds given style class names to this state.- Parameters:
classNames- Style class names to be associated with this state. If a style class name already exists, it is ignored.
-
removeClassName
Removes given style class names from this state.- Parameters:
classNames- Style class names to be removed from this state. If a style class name is not present, nothing happens.
-
getClassNames
Description copied from interface:ButtonStateReturns current (ordered) set of style class names associated with this state.- Specified by:
getClassNamesin interfaceButtonState- Returns:
- An ordered set of style class names. Changes to the returned object affect this object.
-
withClassName
ChainsaddClassName(String...)and returns itself.- Parameters:
classNames- Style class names to add.- Returns:
- This.
-
withoutClassName
ChainsremoveClassName(String...)and returns itself.- Parameters:
classNames- Style class names to remove.- Returns:
- This.
-
addThemeName
Adds given theme names to this state.- Parameters:
themeNames- Theme names to be associated with this state. If a theme name already exists, it is ignored.
-
removeThemeName
Removes given theme names from this state.- Parameters:
themeNames- Theme names to be removed from this state. If a theme name is not present, nothing happens.
-
getThemeNames
Description copied from interface:ButtonStateReturns current (ordered) set of theme names associated with this state.- Specified by:
getThemeNamesin interfaceButtonState- Returns:
- An ordered set of theme names. Changes to the returned object affect this object.
-
withThemeName
ChainsaddThemeName(String...)and returns itself.- Parameters:
themeNames- Theme names to add.- Returns:
- This.
-
withoutThemeName
ChainsremoveThemeName(String...)and returns itself.- Parameters:
themeNames- Names to remove.- Returns:
- This.
-
addThemeVariant
public void addThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) Adds given theme variants to this state.- Parameters:
variants- Theme variants to be associated with this state. If a theme variant already exists, it is ignored.
-
removeThemeVariant
public void removeThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) Removes given theme variants from this state.- Parameters:
variants- Theme variants to be removed from this state. If a variant is not present, nothing happens.
-
getThemeVariants
Description copied from interface:ButtonStateReturns current (ordered) set of theme variants associated with this state.- Specified by:
getThemeVariantsin interfaceButtonState- Returns:
- An ordered set of theme variants. Changes to the returned object affect this object.
-
withThemeVariant
public SimpleButtonState withThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) ChainsaddThemeVariant(ButtonVariant...)and returns itself.- Parameters:
variants- Variants to add.- Returns:
- This.
-
withoutThemeVariant
public SimpleButtonState withoutThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants) ChainsremoveThemeVariant(ButtonVariant...)and returns itself.- Parameters:
variants- Variants to remove.- Returns:
- This.
-
copy
Returns a deep copy of this object.- Returns:
- A copy of this object. Changes to the copy do not affect this object.
-