Class ButtonImpl

All Implemented Interfaces:
ActionOwner, AttachNotifier, Button, Component, Component.BelongToFrame, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper, HasContextHelp, HasDebugId, HasHtmlCaption, HasHtmlDescription, HasHtmlSanitizer
Direct Known Subclasses:
LinkButtonImpl, PaletteButton

public class ButtonImpl extends AbstractComponent<JmixButton> implements Button
  • Field Details

  • Constructor Details

    • ButtonImpl

      public ButtonImpl()
  • Method Details

    • createComponent

      protected JmixButton createComponent()
    • initComponent

      protected void initComponent(JmixButton component)
    • beforeActionPerformed

      protected void beforeActionPerformed()
    • buttonClicked

      protected void buttonClicked(com.vaadin.shared.MouseEventDetails mouseEventDetails)
    • getActionEventTarget

      protected Component getActionEventTarget()
    • afterActionPerformed

      protected void afterActionPerformed()
    • getAction

      @Nullable public Action getAction()
      Specified by:
      getAction in interface ActionOwner
      Returns:
      an action or null
    • setIcon

      public void setIcon(@Nullable String icon)
      Description copied from interface: Component.HasIcon
      Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.
      Specified by:
      setIcon in interface Component.HasIcon
      Overrides:
      setIcon in class AbstractComponent<JmixButton>
    • setAction

      public void setAction(@Nullable Action action, boolean overrideOwnerProperties)
      Description copied from interface: ActionOwner
      Sets the action to the owner. If overrideOwnerProperties is true then the action properties will override owner properties, otherwise the owner properties will be overridden if they are null.

      List of properties that the action and the owner have and which can be overridden:

      • caption
      • description
      • shortcut
      • enabled
      • visible
      • primary
      • icon
      Specified by:
      setAction in interface ActionOwner
      Parameters:
      action - an action
      overrideOwnerProperties - whether action properties override owner properties
    • focus

      public void focus()
      Description copied from interface: Component.Focusable
      Sets focus to this component
      Specified by:
      focus in interface Component.Focusable
    • getTabIndex

      public int getTabIndex()
      Description copied from interface: Component.Focusable
      Gets the tabulator index of the HasTabIndex component.
      Specified by:
      getTabIndex in interface Component.Focusable
      Returns:
      tab index set for the HasTabIndex component
    • setTabIndex

      public void setTabIndex(int tabIndex)
      Description copied from interface: Component.Focusable
      Sets the tabulator index of the Focusable component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.
      Specified by:
      setTabIndex in interface Component.Focusable
      Parameters:
      tabIndex - tab index
    • setDisableOnClick

      public void setDisableOnClick(boolean value)
      Description copied from interface: Button
      Determines if a button is automatically disabled when clicked. If this is set to true the button will be automatically disabled when clicked, typically to prevent (accidental) extra clicks on a button.
      Specified by:
      setDisableOnClick in interface Button
      Parameters:
      value - disable on click option.
    • isDisableOnClick

      public boolean isDisableOnClick()
      Specified by:
      isDisableOnClick in interface Button
      Returns:
      true if the button is disabled when clicked.
    • setCaptionAsHtml

      public void setCaptionAsHtml(boolean captionAsHtml)
      Description copied from interface: HasHtmlCaption
      Sets whether the caption is rendered as HTML.
      Specified by:
      setCaptionAsHtml in interface HasHtmlCaption
      Overrides:
      setCaptionAsHtml in class AbstractComponent<JmixButton>
      Parameters:
      captionAsHtml - true if the caption is rendered as HTML, false if rendered as plain text
      See Also:
    • isCaptionAsHtml

      public boolean isCaptionAsHtml()
      Specified by:
      isCaptionAsHtml in interface HasHtmlCaption
      Overrides:
      isCaptionAsHtml in class AbstractComponent<JmixButton>
      Returns:
      true if the caption is rendered as HTML, false if rendered as plain text
    • getShortcutCombination

      @Nullable public KeyCombination getShortcutCombination()
      Specified by:
      getShortcutCombination in interface Button
      Returns:
      action's shortcut
    • setShortcutCombination

      public void setShortcutCombination(@Nullable KeyCombination shortcut)
      Description copied from interface: Button
      Sets shortcut combination.
      Specified by:
      setShortcutCombination in interface Button
      Parameters:
      shortcut - key combination
    • setShortcut

      public void setShortcut(@Nullable String shortcut)
      Description copied from interface: Button
      Sets shortcut from string representation.
      Specified by:
      setShortcut in interface Button
      Parameters:
      shortcut - string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive.
    • click

      public void click()
      Description copied from interface: Button
      Simulates a button click, notifying all server-side listeners.

      No action is taken if the button is disabled.

      Specified by:
      click in interface Button
    • addClickListener

      public Subscription addClickListener(Consumer<Button.ClickEvent> listener)
      Specified by:
      addClickListener in interface Button
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: Component
      Sets the component enabled state.
      The user can not interact with disabled components, which are shown with a style that indicates the status. Components are enabled by default.
      Specified by:
      setEnabled in interface Component
      Overrides:
      setEnabled in class AbstractComponent<JmixButton>
      Parameters:
      enabled - enabled flag
    • setVisible

      public void setVisible(boolean visible)
      Description copied from interface: Component
      Sets visibility value for the component.
      Visible components are drawn in the user interface, while invisible ones are not. The effect is not a cosmetic CSS change - no information about an invisible component will be sent to the client. The effect is thus the same as removing the component from its parent.
      Specified by:
      setVisible in interface Component
      Overrides:
      setVisible in class AbstractComponent<JmixButton>
      Parameters:
      visible - visible flag
    • addStyleName

      public void addStyleName(String styleName)
      Description copied from interface: Component
      Adds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names.
      Specified by:
      addStyleName in interface Component
      Overrides:
      addStyleName in class AbstractComponent<JmixButton>
      Parameters:
      styleName - one or more style names separated by space.
    • removeStyleName

      public void removeStyleName(String styleName)
      Description copied from interface: Component
      Removes one or more style names from component. Multiple styles can be specified as a space-separated list of style names.
      Specified by:
      removeStyleName in interface Component
      Overrides:
      removeStyleName in class AbstractComponent<JmixButton>
      Parameters:
      styleName - one or more style names separated by space.