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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleButtonState()Creates 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClassName(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.ButtonStatecopy()Returns a deep copy of this object.static List<ButtonState>forTexts(String... texts)Turns given texts into correspondingButtonStates, one for each text.Set<String>getClassNames()Returns current (ordered) set of style class names associated with this state.com.vaadin.flow.component.ComponentgetIcon()Returns current icon of the button.StringgetText()Returns current text of the button.Set<String>getThemeNames()Returns current (ordered) set of theme names associated with this state.Set<com.vaadin.flow.component.button.ButtonVariant>getThemeVariants()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.voidsetText(String text)Sets text of this object.SimpleButtonStatewithClassName(String... classNames)ChainsaddClassName(String...)and returns itself.SimpleButtonStatewithoutClassName(String... classNames)ChainsremoveClassName(String...)and returns itself.SimpleButtonStatewithoutThemeName(String... themeNames)ChainsremoveThemeName(String...)and returns itself.SimpleButtonStatewithoutThemeVariant(com.vaadin.flow.component.button.ButtonVariant... variants)ChainsremoveThemeVariant(ButtonVariant...)and returns itself.SimpleButtonStatewithThemeName(String... themeNames)ChainsaddThemeName(String...)and returns itself.SimpleButtonStatewithThemeVariant(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, wait
-
Methods inherited from interface org.vaadin.miki.markers.WithComponentAsIconMixin
withIcon
-
Methods inherited from interface org.vaadin.miki.markers.WithTextMixin
withText
-
-
-
-
Constructor Detail
-
SimpleButtonState
public SimpleButtonState()
Creates a completely blank state.
-
SimpleButtonState
public SimpleButtonState(String text, String... classNames)
Creates button state with corresponding text.- Parameters:
text- Text.classNames- Optional style class names associated with this state.
-
SimpleButtonState
public SimpleButtonState(com.vaadin.flow.component.Component icon, String... classNames)Creates button state with corresponding icon.- Parameters:
icon- AComponentto use as an icon.classNames- Optional style class names associated with this state.
-
-
Method Detail
-
forTexts
public static List<ButtonState> forTexts(String... texts)
Turns given texts into correspondingButtonStates, one for each text.- Parameters:
texts- Texts to produceButtonStates for.- Returns:
- A non-null list of
ButtonStates.
-
getText
public String getText()
Description copied from interface:ButtonStateReturns current text of the button.- Specified by:
getTextin interfaceButtonState- Specified by:
getTextin interfaceHasText- Returns:
- Text.
-
setText
public void setText(String text)
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
public void addClassName(String... classNames)
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
public void removeClassName(String... classNames)
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
public Set<String> 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
public SimpleButtonState withClassName(String... classNames)
ChainsaddClassName(String...)and returns itself.- Parameters:
classNames- Style class names to add.- Returns:
- This.
-
withoutClassName
public SimpleButtonState withoutClassName(String... classNames)
ChainsremoveClassName(String...)and returns itself.- Parameters:
classNames- Style class names to remove.- Returns:
- This.
-
addThemeName
public void addThemeName(String... themeNames)
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
public void removeThemeName(String... themeNames)
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
public Set<String> 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
public SimpleButtonState withThemeName(String... themeNames)
ChainsaddThemeName(String...)and returns itself.- Parameters:
themeNames- Theme names to add.- Returns:
- This.
-
withoutThemeName
public SimpleButtonState withoutThemeName(String... themeNames)
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
public Set<com.vaadin.flow.component.button.ButtonVariant> 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
public ButtonState copy()
Returns a deep copy of this object.- Returns:
- A copy of this object. Changes to the copy do not affect this object.
-
-