Class FButton

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.button.Button
com.vaadin.featurepack.ui.FButton
All Implemented Interfaces:
ClientConnector, FAbstractClientConnector, FSizeable, HasSizeable, FAbstractComponent, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.button.Button>, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.button.Button>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.button.Button>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.button.Button>, com.vaadin.flow.component.HasAriaLabel, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasPrefix, com.vaadin.flow.component.shared.HasSuffix, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.button.ButtonVariant>, com.vaadin.flow.component.shared.HasTooltip, Serializable

public class FButton extends com.vaadin.flow.component.button.Button implements FAbstractComponent, HasSizeable
A generic button component with Vaadin Framework 7 and 8 compatible API.
See Also:
  • Field Details

  • Constructor Details

    • FButton

      public FButton()
      Creates a new push button.
    • FButton

      public FButton(String caption)
      Creates a new push button with the given caption.
      Parameters:
      caption - the Button caption.
    • FButton

      public FButton(Resource icon)
      Creates a new push button with the given icon.
      Parameters:
      icon - the icon
    • FButton

      public FButton(com.vaadin.flow.component.icon.IconFactory iconFactory)
      Creates a new push button with the given icon.
      Parameters:
      iconFactory - the icon factory to use
    • FButton

      public FButton(String caption, Resource icon)
      Creates a new push button with the given caption and icon.
      Parameters:
      caption - the caption
      icon - the icon
    • FButton

      public FButton(String caption, com.vaadin.flow.component.icon.IconFactory iconFactory)
      Creates a new push button with the given caption and icon factory.
      Parameters:
      caption - the caption
      iconFactory - the icon factory to use
    • FButton

      public FButton(String caption, FButton.ClickListener listener)
      Creates a new push button with a click listener.
      Parameters:
      caption - the Button caption.
      listener - the Button click listener.
    • FButton

      public FButton(Resource icon, FButton.ClickListener listener)
      Creates a new push button with a click listener.
      Parameters:
      icon - the Button icon.
      listener - the Button click listener.
      Since:
      8.2
  • Method Details

    • addClickListener

      public com.vaadin.flow.shared.Registration addClickListener(FButton.ClickListener listener)
      Adds the button click listener.
      Parameters:
      listener - the Listener to be added.
    • removeClickListener

      public void removeClickListener(FButton.ClickListener listener)
      Removes the button click listener.
      Parameters:
      listener - the Listener to be removed.
    • click

      public void click()
      Simulates a button click, notifying all server-side listeners. No action is taken is the button is disabled.
      Overrides:
      click in class com.vaadin.flow.component.button.Button
    • fireClick

      protected void fireClick()
      Fires a click event to all listeners without any event details. In subclasses, override fireClick(MouseEventDetails) instead of this method.
    • fireClick

      protected void fireClick(MouseEventDetails details)
      Fires a click event to all listeners.
      Parameters:
      details - MouseEventDetails from which keyboard modifiers and other information about the mouse click can be obtained. If the button was clicked by a keyboard event, some of the fields may be empty/undefined.
    • setClickShortcut

      public void setClickShortcut(int keyCode, int... modifiers)
      Makes it possible to invoke a click on this button by pressing the given ShortcutAction.KeyCode and (optional) ShortcutAction.ModifierKeys.
      The shortcut is global (bound to the containing Window).
      Parameters:
      keyCode - the keycode for invoking the shortcut
      modifiers - the (optional) modifiers for invoking the shortcut, null for none
    • removeClickShortcut

      public void removeClickShortcut()
      Removes the keyboard shortcut previously set with setClickShortcut(int, int...).
    • setCaption

      public void setCaption(String caption)
      Description copied from interface: FAbstractComponent
      Sets the caption of the component.

      A caption is an explanatory textual label accompanying a user interface component, usually shown above, left of, or inside the component. Icon (see setIcon() is closely related to caption and is usually displayed horizontally before or after it, depending on the component and the containing layout.

      Specified by:
      setCaption in interface FAbstractComponent
      Parameters:
      caption - the new caption for the component.
    • setIcon

      public void setIcon(com.vaadin.flow.component.icon.IconFactory iconFactory, String iconAltText)
      Sets the component's icon and alt text. An alt text is shown when an image could not be loaded, and read by assistive devices.
      Parameters:
      iconFactory - the icon factory to use
      iconAltText - String to use as alt text
    • setIcon

      public void setIcon(Resource icon, String iconAltText)
      Sets the component's icon and alt text. An alt text is shown when an image could not be loaded, and read by assistive devices.
      Parameters:
      icon - the icon to be shown with the component's caption.
      iconAltText - String to use as alt text
    • getIconAlternateText

      public String getIconAlternateText()
      Returns the icon's alt text.
      Returns:
      String with the alt text
    • setIconAlternateText

      public void setIconAlternateText(String iconAltText)
    • setHtmlContentAllowed

      public void setHtmlContentAllowed(boolean htmlContentAllowed)
      Set whether the caption text is rendered as HTML or not. You might need to re-theme button to allow higher content than the original text style. If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.
      Parameters:
      htmlContentAllowed - true if caption is rendered as HTML, false otherwise
    • isHtmlContentAllowed

      public boolean isHtmlContentAllowed()
      Return HTML rendering setting
      Returns:
      true if the caption text is to be rendered as HTML, false otherwise
    • onAttach

      protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
      Overrides:
      onAttach in class com.vaadin.flow.component.Component
    • onDetach

      protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
      Overrides:
      onDetach in class com.vaadin.flow.component.Component
    • setLabelComponent

      public void setLabelComponent(com.vaadin.flow.component.Component labelComponent)
      Description copied from interface: FAbstractComponent
      Sets the component's label component. Flow components that support caption component usually overrides this.
      Specified by:
      setLabelComponent in interface FAbstractComponent
      Parameters:
      labelComponent - the new label component for the component.
    • getIcon

      public com.vaadin.flow.component.Component getIcon()
      Description copied from interface: FAbstractComponent
      Gets the icon component of the component. Returns Component type to be compatible with Flow Button component.

      See FAbstractComponent.setIcon(Icon) for a detailed description of the icon.

      Specified by:
      getIcon in interface FAbstractComponent
      Overrides:
      getIcon in class com.vaadin.flow.component.button.Button
      Returns:
      the icon component of the component or null if the component has no icon
      See Also:
    • fireEvent

      protected void fireEvent(com.vaadin.flow.component.ComponentEvent<?> componentEvent)
      Overrides:
      fireEvent in class com.vaadin.flow.component.Component