Class SButton

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.button.Button
com.vaadin.swingbridge.surrogates.SButton
All Implemented Interfaces:
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, ComponentMixin, Serializable

public class SButton extends com.vaadin.flow.component.button.Button implements ComponentMixin
Surrogate for Button — the AWT 1.0 push button, not JButton. Extends Vaadin Button directly (is-a) and picks up the AWT Component API from ComponentMixin.

Why not AbstractButtonMixin

SJButton reaches its ActionEvent fan-out through AbstractButtonMixin's ButtonModel armed/pressed pulse. java.awt.Button has no model, no Action, no icon, no mnemonic and no selected state — reusing the Swing mixin would graft a ButtonModel state machine and a getModel() / setAction() / isSelected() surface onto a surrogate whose JDK original has none of them. The overlap is the ~40 lines of listener fan-out below, and duplicating it is the cheaper mistake than a shared base with shallow commonality. The click wiring is the same shape R_vaadin_first sanctions for a shared subscription: one Vaadin ClickNotifier subscription drives an EventListenerList fan-out.

State

actionCommand is stored (a single field, no Store class warranted) — R_vaadin_first-legitimate because it is the ActionEvent payload, i.e. UI functionality, not an API round-trip shadow. label is not stored: it routes to the Vaadin Button's own getText/setText, so setLabel(null) reads back as "" (accepted R_vaadin_first loss, same contract as SJButton). The emulator vaadinx.awt.Button keeps a field shadow so its getLabel() returns null verbatim per R_swing_is_truth.
See Also:
  • Constructor Details

    • SButton

      public SButton()
    • SButton

      public SButton(String label)
  • Method Details

    • getLabel

      public String getLabel()
      AWT's name for the caption. Reads the Vaadin Button text, so a label never set reads back as "" rather than AWT's null — the R_vaadin_first loss the class javadoc names.
    • setLabel

      public void setLabel(String label)
    • getActionCommand

      public String getActionCommand()
      Falls back to the label when never set, matching AWT.
    • setActionCommand

      public void setActionCommand(String command)
    • addActionListener

      public void addActionListener(ActionListener l)
    • removeActionListener

      public void removeActionListener(ActionListener l)
    • getActionListeners

      public ActionListener[] getActionListeners()
    • processActionEvent

      protected void processActionEvent(ActionEvent e)
      AWT's dispatch hook. Overriding it (and calling super) is the documented way for java.awt.Button subclasses to intercept every action before its listeners see it, so it stays the single funnel the peer click routes through.
    • setEnabled

      public void setEnabled(boolean enabled)
      Vaadin HasEnabled's concrete default shadows the mixin's setEnabled (which carries SD_auto_pce's auto-PCE). Redirect explicitly, same as SJButton.
      Specified by:
      setEnabled in interface ComponentMixin
      Specified by:
      setEnabled in interface com.vaadin.flow.component.HasEnabled
      Overrides:
      setEnabled in class com.vaadin.flow.component.button.Button
    • paramString

      protected String paramString()
      AWT's Button.paramString appends only the label.
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()