Class SimpleButtonState

    • 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 - A Component to 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 - A Component to use as an icon.
        classNames - Optional style class names associated with this state.
    • Method Detail

      • setText

        public void setText​(String text)
        Description copied from interface: HasText
        Sets text of this object.
        Specified by:
        setText in interface HasText
        Parameters:
        text - Text to set.
      • setIcon

        public void setIcon​(com.vaadin.flow.component.Component icon)
        Description copied from interface: HasComponentAsIcon
        Sets given Component as an icon of this object.
        Specified by:
        setIcon in interface HasComponentAsIcon
        Parameters:
        icon - A Component to be used as an icon. Can be null to 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: ButtonState
        Returns current (ordered) set of style class names associated with this state.
        Specified by:
        getClassNames in interface ButtonState
        Returns:
        An ordered set of style class names. Changes to the returned object affect this object.
      • 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: ButtonState
        Returns current (ordered) set of theme names associated with this state.
        Specified by:
        getThemeNames in interface ButtonState
        Returns:
        An ordered set of theme names. Changes to the returned object affect this object.
      • 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: ButtonState
        Returns current (ordered) set of theme variants associated with this state.
        Specified by:
        getThemeVariants in interface ButtonState
        Returns:
        An ordered set of theme variants. Changes to the returned object affect this object.
      • 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.