Class GeneratedVaadinButton<R extends GeneratedVaadinButton<R>>

  • All Implemented Interfaces:
    com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<R>, com.vaadin.flow.component.ClickNotifier<R>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<R>, com.vaadin.flow.component.FocusNotifier<R>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, com.vaadin.flow.component.HasTheme, Serializable
    Direct Known Subclasses:
    Button

    @Tag("vaadin-button")
    @NpmPackage(value="@vaadin/polymer-legacy-adapter",version="23.1.3") @NpmPackage(value="@vaadin/button",version="23.1.3") @NpmPackage(value="@vaadin/vaadin-button",version="23.1.3")
    @JsModule("@vaadin/polymer-legacy-adapter/style-modules.js") @JsModule("@vaadin/button/src/vaadin-button.js")
    public abstract class GeneratedVaadinButton<R extends GeneratedVaadinButton<R>>
    extends com.vaadin.flow.component.Component
    implements com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.ClickNotifier<R>, com.vaadin.flow.component.HasText, com.vaadin.flow.component.Focusable<R>, com.vaadin.flow.component.HasTheme

    Description copied from corresponding location in WebComponent:

    <vaadin-button> is a Web Component providing an accessible and customizable button.

    <vaadin-button> </vaadin-button>

    document.querySelector('vaadin-button').addEventListener('click', () =&gt; alert('Hello World!'));

    Styling

    The following shadow DOM parts are exposed for styling:

    Part name Description
    label The label (text) inside the button
    prefix A slot for e.g. an icon before the label
    suffix A slot for e.g. an icon after the label

    The following attributes are exposed for styling:

    Attribute Description
    active Set when the button is pressed down, either with mouse, touch or the keyboard.
    disabled Set when the button is disabled.
    focus-ring Set when the button is focused using the keyboard.
    focused Set when the button is focused.

    See ThemableMixin – how to apply styles for shadow parts

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier

        com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
      • Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier

        com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
      • Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

        com.vaadin.flow.component.HasText.WhiteSpace
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void addThemeVariants​(ButtonVariant... variants)
      Adds theme variants to the component.
      protected void addToPrefix​(com.vaadin.flow.component.Component... components)
      Adds the given components as children of this component at the slot 'prefix'.
      protected void addToSuffix​(com.vaadin.flow.component.Component... components)
      Adds the given components as children of this component at the slot 'suffix'.
      protected boolean isAutofocusBoolean()
      Description copied from corresponding location in WebComponent:
      protected boolean isDisabledBoolean()
      Description copied from corresponding location in WebComponent:
      protected void remove​(com.vaadin.flow.component.Component... components)
      Removes the given child components from this component.
      protected void removeAll()
      Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API.
      void removeThemeVariants​(ButtonVariant... variants)
      Removes theme variants from the component.
      protected void setAutofocus​(boolean autofocus)
      Description copied from corresponding location in WebComponent:
      protected void setDisabled​(boolean disabled)
      Deprecated.
      Since 3.0, this API is deprecated in favor of HasEnabled.setEnabled(boolean)
      • Methods inherited from class com.vaadin.flow.component.Component

        addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, scrollIntoView, set, setElement, setId, setVisible
      • Methods inherited from interface com.vaadin.flow.component.AttachNotifier

        addAttachListener
      • Methods inherited from interface com.vaadin.flow.component.BlurNotifier

        addBlurListener
      • Methods inherited from interface com.vaadin.flow.component.ClickNotifier

        addClickListener, addClickShortcut
      • Methods inherited from interface com.vaadin.flow.component.DetachNotifier

        addDetachListener
      • Methods inherited from interface com.vaadin.flow.component.Focusable

        addFocusShortcut, blur, focus, getTabIndex, setTabIndex
      • Methods inherited from interface com.vaadin.flow.component.FocusNotifier

        addFocusListener
      • Methods inherited from interface com.vaadin.flow.component.HasElement

        getElement
      • Methods inherited from interface com.vaadin.flow.component.HasEnabled

        isEnabled, setEnabled
      • Methods inherited from interface com.vaadin.flow.component.HasStyle

        addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
      • Methods inherited from interface com.vaadin.flow.component.HasText

        getText, getWhiteSpace, setText, setWhiteSpace
      • Methods inherited from interface com.vaadin.flow.component.HasTheme

        addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
    • Constructor Detail

      • GeneratedVaadinButton

        public GeneratedVaadinButton​(String text)
        Sets the given string as the content of this component.
        Parameters:
        text - the text content to set
        See Also:
        HasText.setText(String)
      • GeneratedVaadinButton

        public GeneratedVaadinButton()
        Default constructor.
    • Method Detail

      • addThemeVariants

        public void addThemeVariants​(ButtonVariant... variants)
        Adds theme variants to the component.
        Parameters:
        variants - theme variants to add
      • removeThemeVariants

        public void removeThemeVariants​(ButtonVariant... variants)
        Removes theme variants from the component.
        Parameters:
        variants - theme variants to remove
      • isAutofocusBoolean

        protected boolean isAutofocusBoolean()

        Description copied from corresponding location in WebComponent:

        Specify that this control should have input focus when the page loads.

        This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

        Returns:
        the autofocus property from the webcomponent
      • setAutofocus

        protected void setAutofocus​(boolean autofocus)

        Description copied from corresponding location in WebComponent:

        Specify that this control should have input focus when the page loads.

        Parameters:
        autofocus - the boolean value to set
      • isDisabledBoolean

        protected boolean isDisabledBoolean()

        Description copied from corresponding location in WebComponent:

        If true, the user cannot interact with this element.

        This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

        Returns:
        the disabled property from the webcomponent
      • setDisabled

        @Deprecated
        protected void setDisabled​(boolean disabled)
        Deprecated.
        Since 3.0, this API is deprecated in favor of HasEnabled.setEnabled(boolean)

        Description copied from corresponding location in WebComponent:

        If true, the user cannot interact with this element.

        Parameters:
        disabled - the boolean value to set
      • addToPrefix

        protected void addToPrefix​(com.vaadin.flow.component.Component... components)
        Adds the given components as children of this component at the slot 'prefix'.
        Parameters:
        components - The components to add.
        See Also:
        MDN page about slots, Spec website about slots
      • addToSuffix

        protected void addToSuffix​(com.vaadin.flow.component.Component... components)
        Adds the given components as children of this component at the slot 'suffix'.
        Parameters:
        components - The components to add.
        See Also:
        MDN page about slots, Spec website about slots
      • remove

        protected void remove​(com.vaadin.flow.component.Component... components)
        Removes the given child components from this component.
        Parameters:
        components - The components to remove.
        Throws:
        IllegalArgumentException - if any of the components is not a child of this component.
      • removeAll

        protected void removeAll()
        Removes all contents from this component, this includes child components, text content as well as child elements that have been added directly to this component using the Element API.