Interface AbstractButtonMixin
- All Superinterfaces:
ComponentMixin, ContainerMixin, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, ItemSelectable, JComponentMixin, Serializable
- All Known Implementing Classes:
SJButton, SJCheckBox, SJRadioButton, SJToggleButton
AbstractButton. Layers the AbstractButton
API surface on top of JComponentMixin. Shared across future
SJButton / SJToggleButton / SJCheckBox /
SJRadioButton surrogates — the push-vs-toggle split lives in
the concrete's peer-click wiring (push buttons pulse setPressed,
toggle buttons flip setSelected).
R_vaadin_first stance: UI functionality yes, API round-trip only where Vaadin has it
Per [R_vaadin_first], surrogates reproduce the UI functionality of their Swing originals — click → ActionEvent, ButtonModel armed/pressed pulse, ChangeListener / ItemListener fan-out, Action dispatch, mnemonic accelerators — but the API is only implemented to the degree Vaadin has a semantic counterpart. AbstractButton's still-uncovered visual state (the six state-conditional icons, border-painted / content-area-filled / focus-painted / rollover-enabled, margin, displayedMnemonicIndex, multiClickThreshhold) has no Vaadin counterpart today, so their setters callSHelper.onUnimplemented(Object, String, Object...) + drop the value, and their getters
return the JDK default. See "Drop-and-WARN section" below.
The four alignment / text-position setters and iconTextGap
do have a Vaadin counterpart (host display: inline-flex
+ flex-direction / justify-content / align-items
/ gap) and bind directly: setters write CSS, getters lossy-parse
CSS back. Same setBorder / getBorder shape per SD_border_css_lossy — LEFT and LEADING
both round-trip as LEADING, RIGHT and TRAILING as TRAILING; vertical
text-position non-CENTER masks horizontal text-position.
Kept (UI-functional or semantically load-bearing):
text— written to the peer's elementtextproperty; read back from the same. Minor loss per R_vaadin_first:setText(null)round-trips as"".actionCommand— drivesActionEvent's payload delivered to user listeners (with the text fallback).hideActionText— gates NAME propagation insideconfigurePropertiesFromAction(Action).mnemonic— drives VaadinShortcutsinstall; stored because Shortcuts is write-only (no readback).Actionstate — install + PCL propagation + click dispatch.ButtonModelstate — source of truth for armed/pressed/selected/enabled; drives three fire-families.- Listener lists — ActionListener / ChangeListener / ItemListener fan-out.
Peer click synthesis
Concrete push-button surrogates callinstallButtonBindings()
from their constructor. It seeds the default model, registers the
three model-listener fan-out wires, and — if the concrete's peer
implements ClickNotifier — wires a click listener that
synthesizes a setArmed(true) → setPressed(true) → setPressed(false) → setArmed(false)
pulse through SHelper.callSwing(Runnable) (R_callswing_envelope). The model's internal
fireActionPerformed fires only on the pressed→unpressed
transition while armed, matching JDK's sequence.
Mnemonic
setMnemonic installs a Vaadin Shortcuts binding for
Alt+<key> on the concrete's peer that invokes doClick().
Replacing / clearing the mnemonic tears down the previous registration
first. The Vaadin-side install is UI-scoped by default; close to
Swing's WHEN_IN_FOCUSED_WINDOW for mnemonics on a single-UI
app.
getIcon() / getUI() dropped — Vaadin Button signature clash
The mixin doesn't declare JDK-shaped getIcon() or getUI()
getters. Vaadin Button.getIcon() returns
com.vaadin.flow.component.Component and Component.getUI()
returns Optional<UI> — neither is covariantly related to JDK's
javax.swing.Icon / javax.swing.plaf.ButtonUI, so a
surrogate extends Button cannot coexist with JDK-shaped
versions (JVM forbids two methods with the same erased signature and
different return types). setIcon(javax.swing.Icon) survives
as an overload against Vaadin's setIcon(Component) (parameter
types differ) and binds Vaadin-first per SD_vaadin_first_binding: ImageIcon
reaches the peer as a PNG-encoded Vaadin Image; other Icon
impls still
WARN-and-drop pending Path 2 / Path 3.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classStatic PCL to avoid an anonymous-inner-class capture chain for every button.Nested classes/interfaces inherited from interface JComponentMixin
JComponentMixin.ActionStandin -
Field Summary
Fields inherited from interface JComponentMixin
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW -
Method Summary
Modifier and TypeMethodDescriptiondefault voidactionPropertyChanged(Action a, String propertyName) Per-key Action-mutation router.default voiddefault voiddefault voiddefault voidJDK-shaped Action-property copy.default PropertyChangeListenerDefault PCL: routesActionmutations toactionPropertyChanged(Action, String).default voiddoClick()Shorthand fordoClick(68)per JDK.default voiddoClick(int pressTime) Programmatic click.default voidfireActionPerformed(ActionEvent event) Re-sources theActionEventtothisand iterates the button-level ActionListener list.default voidfireItemStateChanged(ItemEvent event) Fan-out for item events.default voidFan-out for model change events; lazy ChangeEvent matches JDK.default Actiondefault Stringdefault ActionListener[]default ChangeListener[]default Icondefault Icondefault intJDK default is -1.default booleandefault intdefault intdefault intReads CSSgapback as an int.default ItemListener[]default StringgetLabel()Deprecated AWT 1.0 alias forgetText().default InsetsJDK default is null; no Vaadin counterpart.default intdefault ButtonModelgetModel()default longJDK default is 0.default Icondefault Icondefault Icondefault Icondefault Object[]getText()Abstract — each concrete AbstractButton-lineage surrogate provides its owngetTextvia the parent Vaadin component'sHasTextcontract.default StringDeliberate no-op — L&F key.default intdefault intdefault voidSeeds the defaultButtonModel+ three model→button listener fan-outs.default booleanJDK default is true; no Vaadin counterpart.default booleanJDK default is true; no Vaadin counterpart.default booleanJDK default is true; no Vaadin counterpart.default booleanJDK default is false; no Vaadin counterpart.default booleandefault voiddefault voiddefault voiddefault voidInstall / replace / clear the backingAction.default voidsetActionCommand(String command) Fires no"actionCommand"property change — the JDK'sAbstractButton.setActionCommandis one line,getModel().setActionCommand(actionCommand), and nothing on the path fires (SD_property_fanout_audit).default voidsetBorderPainted(boolean v) default voidsetContentAreaFilled(boolean v) default voidsetDisabledIcon(Icon icon) default voidsetDisabledSelectedIcon(Icon icon) default voidsetDisplayedMnemonicIndex(int index) default voidsetFocusPainted(boolean v) default voidsetHideActionText(boolean hideActionText) default voidsetHorizontalAlignment(int alignment) default voidsetHorizontalTextPosition(int pos) default voidPlain icon — bound Vaadin-first per SD_vaadin_first_binding (icon-rendering Path 1).default voidsetIconTextGap(int gap) default voidDeprecated AWT 1.0 alias forsetText(String).default voiddefault voidsetMnemonic(char mnemonic) JDK's char→int path: uppercase ASCII-lower then delegate to the int variant.default voidsetMnemonic(int mnemonic) default voidsetModel(ButtonModel newModel) Install a newButtonModel.default voidsetMultiClickThreshhold(long threshhold) default voidsetPressedIcon(Icon icon) default voidsetRolloverEnabled(boolean v) default voidsetRolloverIcon(Icon icon) default voidsetRolloverSelectedIcon(Icon icon) default voidsetSelected(boolean selected) Delegates toButtonModel.setSelected(boolean).default voidsetSelectedIcon(Icon icon) voidAbstract — each concrete surrogate implements via super (its Vaadin parent's HasText.setText, e.g.default voidsetVerticalAlignment(int alignment) default voidsetVerticalTextPosition(int pos) default voidSynthesize a JDK-shaped click pulse on the installedButtonModel.default voidupdateUI()Deliberate no-op — L&F dispatch isn't modelled.Methods inherited from interface ComponentMixin
_installSwingClass, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, dispatchEvent, doLayout, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getComponentListeners, getCursor, getFocusListeners, getFont, getForeground, getGraphics, getHierarchyBoundsListeners, getHierarchyListeners, getKeyListeners, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getName, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolTipText, getX, getY, grabFocus, hasFocus, invalidate, isDisplayable, isFocusable, isFocusOwner, isShowing, paint, paintAll, print, printAll, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, revalidate, setBackground, setBounds, setBounds, setCursor, setFocusable, setFont, setForeground, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateMethods inherited from interface ContainerMixin
addContainerListener, getContainerListeners, getLayout, paintComponents, printComponents, removeContainerListener, setLayoutMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
bindEnabled, isEnabledMethods inherited from interface com.vaadin.flow.component.HasSize
bindHeight, bindWidth, getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface JComponentMixin
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getLocation, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, requestDefaultFocus, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction
-
Method Details
-
installButtonBindings
default void installButtonBindings()Seeds the defaultButtonModel+ three model→button listener fan-outs. If the peer is aClickNotifier, wires a click listener that synthesizes Swing armed/pressed pulses on user clicks. Idempotent: a second call is a no-op oncemodelis installed. -
synthesizePeerClick
default void synthesizePeerClick()Synthesize a JDK-shaped click pulse on the installedButtonModel. MirrorsdoClick()'s effect but reaches the model directly so peer-originated clicks (user tap) flow through identical state transitions as a programmaticdoClick. -
getModel
-
setModel
Install a newButtonModel. Detaches the mixin's bridge listeners from the old model via the storedButtonStateStore.modelInstallhandle, attaches fresh lambdas to the new model and packs their teardown into a singleRegistration, fires the"model"PCE. A null model is legal per JDK; the detach still happens so the old model doesn't retain references to our wires. -
isSelected
default boolean isSelected() -
setSelected
default void setSelected(boolean selected) Delegates toButtonModel.setSelected(boolean). The model fires anItemEventon actual transition, which routes through the mixin's model-listener fan-out to button-level ItemListeners. -
getSelectedObjects
- Specified by:
getSelectedObjectsin interfaceItemSelectable
-
doClick
default void doClick()Shorthand fordoClick(68)per JDK. -
doClick
default void doClick(int pressTime) Programmatic click. Pulses the model's armed/pressed transitions (same path as a peer click);pressTimeis nominal — we don't animate. IgnoresisEnabledper JDK contract. -
getText
String getText()Abstract — each concrete AbstractButton-lineage surrogate provides its owngetTextvia the parent Vaadin component'sHasTextcontract. SJButton's inheritedButton.getText()(which readstextNode) satisfies this requirement automatically. Mixin-internal callers (e.g.getActionCommand()'s text fallback,setDisplayedMnemonicIndex(int)'s length validation) reach the concrete impl via virtual dispatch.Pulled out of the mixin's default-implementation surface so the mixin doesn't need a reentry-flag dance to call back into the parent's HasText methods — the rendered text path is owned by the concrete surrogate, end of story.
-
setText
-
getLabel
-
setLabel
Deprecated AWT 1.0 alias forsetText(String). -
getActionCommand
-
setActionCommand
Fires no"actionCommand"property change — the JDK'sAbstractButton.setActionCommandis one line,getModel().setActionCommand(actionCommand), and nothing on the path fires (SD_property_fanout_audit). -
getHideActionText
default boolean getHideActionText() -
setHideActionText
default void setHideActionText(boolean hideActionText) -
setIcon
Plain icon — bound Vaadin-first per SD_vaadin_first_binding (icon-rendering Path 1).Overload-safe against Vaadin
Button.setIcon(Component)(parameter types differ). The translation runs throughIcons.toVaadinIconComponent(Object, Icon):ImageIconencodes as PNG and lands as a<img>child of the peer; any otherIconimpl WARNs and clears the slot (Path 2 / Path 3 deferred).Fires
"icon"PCE with VaadinComponent-typed values per R_vaadin_first (lossy round-trip — the JDKIconref isn't stored, since VaadinButtonowns the slot). Call sites whose peer doesn't exposesetIcon(Component)(anything that isn't a VaadinButton) WARN-and-drop, same shape as the pre-Path-1 fallback. -
getPressedIcon
-
setPressedIcon
-
getSelectedIcon
-
setSelectedIcon
-
getDisabledIcon
-
setDisabledIcon
-
getDisabledSelectedIcon
-
setDisabledSelectedIcon
-
getRolloverIcon
-
setRolloverIcon
-
getRolloverSelectedIcon
-
setRolloverSelectedIcon
-
isBorderPainted
default boolean isBorderPainted()JDK default is true; no Vaadin counterpart. -
setBorderPainted
default void setBorderPainted(boolean v) -
isContentAreaFilled
default boolean isContentAreaFilled()JDK default is true; no Vaadin counterpart. -
setContentAreaFilled
default void setContentAreaFilled(boolean v) -
isFocusPainted
default boolean isFocusPainted()JDK default is true; no Vaadin counterpart. -
setFocusPainted
default void setFocusPainted(boolean v) -
isRolloverEnabled
default boolean isRolloverEnabled()JDK default is false; no Vaadin counterpart. -
setRolloverEnabled
default void setRolloverEnabled(boolean v) -
getIconTextGap
default int getIconTextGap()Reads CSSgapback as an int. Lossy CSS round-trip per R_vaadin_first — agapCSS value with a non-px unit (we only ever write"Npx") would parse to the JDK default 4. -
setIconTextGap
default void setIconTextGap(int gap) -
getMargin
JDK default is null; no Vaadin counterpart. -
setMargin
-
getMultiClickThreshhold
default long getMultiClickThreshhold()JDK default is 0. Validates per R_match_swing_errors; values > 0 drop with WARN. -
setMultiClickThreshhold
default void setMultiClickThreshhold(long threshhold) -
getHorizontalAlignment
default int getHorizontalAlignment() -
setHorizontalAlignment
default void setHorizontalAlignment(int alignment) -
getVerticalAlignment
default int getVerticalAlignment() -
setVerticalAlignment
default void setVerticalAlignment(int alignment) -
getHorizontalTextPosition
default int getHorizontalTextPosition() -
setHorizontalTextPosition
default void setHorizontalTextPosition(int pos) -
getVerticalTextPosition
default int getVerticalTextPosition() -
setVerticalTextPosition
default void setVerticalTextPosition(int pos) -
getDisplayedMnemonicIndex
default int getDisplayedMnemonicIndex()JDK default is -1. Validates per R_match_swing_errors; non-(-1) values drop with WARN. -
setDisplayedMnemonicIndex
default void setDisplayedMnemonicIndex(int index) -
getMnemonic
default int getMnemonic() -
setMnemonic
default void setMnemonic(int mnemonic) InstallAlt+<mnemonic>as a VaadinShortcutslistener on the peer that invokesdoClick(). Replacing / clearing tears down the previous registration first. Zero means "no mnemonic" and leaves the peer without a shortcut. -
setMnemonic
default void setMnemonic(char mnemonic) JDK's char→int path: uppercase ASCII-lower then delegate to the int variant. -
addActionListener
-
removeActionListener
-
getActionListeners
-
addChangeListener
-
removeChangeListener
-
getChangeListeners
-
addItemListener
- Specified by:
addItemListenerin interfaceItemSelectable
-
removeItemListener
- Specified by:
removeItemListenerin interfaceItemSelectable
-
getItemListeners
-
fireActionPerformed
Re-sources theActionEventtothisand iterates the button-level ActionListener list. LIFO order matches JDK. -
fireStateChanged
default void fireStateChanged()Fan-out for model change events; lazy ChangeEvent matches JDK. -
fireItemStateChanged
Fan-out for item events. JDK does not re-source. -
getAction
-
setAction
Install / replace / clear the backingAction. Equals-based dedupe matches JDK. Teardown detaches the old Action's PCL and removes it from the ActionListener list; install copies name / command / icon / mnemonic / tooltip / enabled viaconfigurePropertiesFromAction(Action)and registers a fresh PCL so Action mutations propagate. Fires the"action"PCE. -
createActionPropertyChangeListener
Default PCL: routesActionmutations toactionPropertyChanged(Action, String). -
actionPropertyChanged
-
configurePropertiesFromAction
JDK-shaped Action-property copy. -
getUIClassID
Description copied from interface:JComponentMixinDeliberate no-op — L&F key.- Specified by:
getUIClassIDin interfaceJComponentMixin
-
updateUI
default void updateUI()Description copied from interface:JComponentMixinDeliberate no-op — L&F dispatch isn't modelled.- Specified by:
updateUIin interfaceJComponentMixin
-