Class SJTabbedPane
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, 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.tabs.TabSheetVariant>, ComponentMixin, ContainerMixin, JComponentMixin, Serializable
JTabbedPane (SD_sjtabbedpane).
Tab strip + content swap on top of Vaadin TabSheet. Selection
lives on the peer (R_vaadin_first source-of-truth); per-tab metadata
(title/icon/tooltip/custom-header) lives in TabbedPaneStateStore
and is rendered into each Vaadin Tab's children on every change.
Why children-based, never Tab.setLabel
tab.setLabel("X") wipes the Tab's children — so an icon added with
tab.add(icon) disappears on the next title change. The children-based
render strategy (tab.removeAll(); tab.add(icon); tab.add(new
Span(title));) sidesteps the wipe and keeps a uniform state machine across
(title only / title + icon / custom header) modes.
HasAriaLabel.setAriaLabel(String) preserves accessibility regardless of visual
mode.
API partition (per SD_sjtabbedpane)
Methods Vaadin can reproduce are real impls (add/insert/remove,
selectedIndex, title/icon/tooltip/enabled at, tabComponentAt). The
cluster Vaadin doesn't expose Java-side — setBackgroundAt,
setForegroundAt, setDisabledIconAt,
setMnemonicAt, setDisplayedMnemonicIndexAt,
setModel — drop-and-WARN. Round-trip for those headline
properties that warrant it lives on the emulator's
vaadinx.swing.JTabbedPane; per-tab no-counterpart attributes
stay drop-and-WARN both layers (R_vaadin_first + per-tab arrays would be storage
for storage's sake without a Vaadin pulse behind them).
Tab placement / layout policy
setTabPlacement(TOP)— delivered (Vaadin TabSheet is top-only).setTabPlacement(LEFT|RIGHT|BOTTOM)— WARN, field-shadow round-trip on emulator. R_match_swing_errors sub-bucket (a) blocked-upstream: Vaadin TabSheet exposes no orientation knob.setTabLayoutPolicy(SCROLL_TAB_LAYOUT)— silently accepted (Vaadin auto-scrolls on overflow already; no WARN since user intent is already met).setTabLayoutPolicy(WRAP_TAB_LAYOUT)— WARN, field-shadow round-trip. R_match_swing_errors sub-bucket (a): Vaadin has no wrap mode.
Garbage placement / policy ints throw IllegalArgumentException
matching JDK (R_match_swing_errors).
Selection bridge
Two-way wire: peer SelectedChangeEvent → callSwing (R_callswing_envelope) →
model.setSelectedIndex → internal modelListener fires
ChangeListeners + pushes back to peer iff peer differs.
preventPeerEvents guards the peer-push leg against re-entrancy.
The model is JDK-side DefaultSingleSelectionModel; user code
can getModel().addChangeListener(...) and observe the same
fan-out as tabbedPane.addChangeListener(...).
removeTabAt selection-shift
Vaadin TabSheet's remove(int) reshuffles selection identically
to JDK across every corner (remove middle: stays at index; remove last:
shifts to i-1; remove below: decrements; remove above: unchanged; remove
only-tab: -1). No bridge translation needed — just forward.
Loading-spinner suppression
vaadin-tabsheet shows an indeterminate spinner whenever the selected tab
has no attached content; an empty tab strip (all tabs closed) is exactly
that, so it would spin forever. Swing renders a blank content area instead,
so emul/sjtabbedpane.css (StyleSheet below) hides the loader
part. The loading state is web-component-owned (no server-side lever). The
CSS ships as a plain servlet-served static resource (META-INF/
resources/emul/sjtabbedpane.css), not a frontend import, so it never forces
a Vite dev-bundle rebuild.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.tabs.TabSheet
com.vaadin.flow.component.tabs.TabSheet.SelectedChangeEventNested classes/interfaces inherited from interface JComponentMixin
JComponentMixin.ActionStandin -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from interface JComponentMixin
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW -
Constructor Summary
ConstructorsConstructorDescriptionSJTabbedPane(int tabPlacement) SJTabbedPane(int tabPlacement, int tabLayoutPolicy) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidvoidgetBackgroundAt(int index) getBoundsAt(int index) com.vaadin.flow.component.ComponentgetComponentAt(int index) getDisabledIconAt(int index) intgetDisplayedMnemonicIndexAt(int index) getForegroundAt(int index) getIconAt(int index) intgetMnemonicAt(int index) getModel()com.vaadin.flow.component.Componentcom.vaadin.flow.component.ComponentgetTabComponentAt(int index) intintintJDK always returns ≥1; we always have a single row of tabs (no WRAP).getTitleAt(int index) getToolTipTextAt(int index) Deliberate no-op — L&F key.intindexAtLocation(int x, int y) intindexOfComponent(com.vaadin.flow.component.Component component) intindexOfTab(String title) intindexOfTabComponent(com.vaadin.flow.component.Component tabComponent) voidinsertTab(String title, Icon icon, com.vaadin.flow.component.Component component, String tip, int index) booleanisEnabledAt(int index) voidvoidvoidremoveTabAt(int index) voidsetBackgroundAt(int index, Color background) Per-tab background colour.voidsetComponentAt(int index, com.vaadin.flow.component.Component component) voidsetDisabledIconAt(int index, Icon disabledIcon) voidsetDisplayedMnemonicIndexAt(int index, int mnemonicIndex) voidsetEnabledAt(int index, boolean enabled) voidsetForegroundAt(int index, Color foreground) voidvoidsetMnemonicAt(int index, int mnemonic) No Vaadin counterpart for per-tab keyboard accelerator on the tab header.voidsetModel(SingleSelectionModel model) Swap the selection model, as the JDK allows: unhooks the internal modelListener from the old model, hooks it to the new one, and syncs the peer to the new model's selection.voidsetSelectedComponent(com.vaadin.flow.component.Component c) voidsetSelectedIndex(int index) voidsetTabComponentAt(int index, com.vaadin.flow.component.Component tabComponent) voidsetTabLayoutPolicy(int tabLayoutPolicy) voidsetTabPlacement(int tabPlacement) voidsetTitleAt(int index, String title) voidsetToolTipTextAt(int index, String tip) voidsetUI(TabbedPaneUI ui) voidupdateUI()Deliberate no-op — L&F dispatch isn't modelled.Methods inherited from class com.vaadin.flow.component.tabs.TabSheet
add, add, add, add, addSelectedChangeListener, getComponent, getIndexOf, getSelectedIndex, getSelectedTab, getTab, getTabAt, getTabCount, remove, remove, remove, setSelectedTabMethods inherited from class com.vaadin.flow.component.Component
addListener, bindVisible, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible, whenAttachedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods 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.DetachNotifier
addDetachListenerMethods 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.shared.HasPrefix
getPrefixComponent, setPrefixComponentMethods 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 com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.shared.HasSuffix
getSuffixComponent, setSuffixComponentMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, bindThemeName, bindThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.vaadin.flow.component.shared.HasThemeVariant
addThemeVariants, bindThemeVariant, bindThemeVariants, removeThemeVariants, setThemeVariant, setThemeVariants, setThemeVariantsMethods 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
-
Field Details
-
WRAP_TAB_LAYOUT
public static final int WRAP_TAB_LAYOUT- See Also:
-
SCROLL_TAB_LAYOUT
public static final int SCROLL_TAB_LAYOUT- See Also:
-
-
Constructor Details
-
SJTabbedPane
public SJTabbedPane() -
SJTabbedPane
public SJTabbedPane(int tabPlacement) -
SJTabbedPane
public SJTabbedPane(int tabPlacement, int tabLayoutPolicy)
-
-
Method Details
-
addChangeListener
-
removeChangeListener
-
getChangeListeners
-
getModel
-
setModel
Swap the selection model, as the JDK allows: unhooks the internal modelListener from the old model, hooks it to the new one, and syncs the peer to the new model's selection. The model is JDK-side machinery (aSingleSelectionModel), so this is pure rewiring — no Vaadin counterpart is involved, which is why it is implemented rather than drop-and-WARN (the R_vaadin_first model carve-out). -
setSelectedIndex
public void setSelectedIndex(int index) - Overrides:
setSelectedIndexin classcom.vaadin.flow.component.tabs.TabSheet
-
getSelectedComponent
public com.vaadin.flow.component.Component getSelectedComponent() -
setSelectedComponent
public void setSelectedComponent(com.vaadin.flow.component.Component c) -
getTabPlacement
public int getTabPlacement() -
setTabPlacement
public void setTabPlacement(int tabPlacement) -
getTabLayoutPolicy
public int getTabLayoutPolicy() -
setTabLayoutPolicy
public void setTabLayoutPolicy(int tabLayoutPolicy) -
addTab
-
addTab
-
addTab
-
insertTab
-
removeTabAt
public void removeTabAt(int index) -
removeAll
public void removeAll() -
getTitleAt
-
setTitleAt
-
getIconAt
-
setIconAt
-
getToolTipTextAt
-
setToolTipTextAt
-
isEnabledAt
public boolean isEnabledAt(int index) -
setEnabledAt
public void setEnabledAt(int index, boolean enabled) -
getTabComponentAt
public com.vaadin.flow.component.Component getTabComponentAt(int index) -
setTabComponentAt
public void setTabComponentAt(int index, com.vaadin.flow.component.Component tabComponent) -
indexOfTab
-
indexOfComponent
public int indexOfComponent(com.vaadin.flow.component.Component component) -
indexOfTabComponent
public int indexOfTabComponent(com.vaadin.flow.component.Component tabComponent) -
getComponentAt
public com.vaadin.flow.component.Component getComponentAt(int index) -
setComponentAt
public void setComponentAt(int index, com.vaadin.flow.component.Component component) -
setMnemonicAt
public void setMnemonicAt(int index, int mnemonic) No Vaadin counterpart for per-tab keyboard accelerator on the tab header. R_vaadin_first drop-and-WARN; round-trip can lift to emulator field- shadow if a real migration target needs it. -
getMnemonicAt
public int getMnemonicAt(int index) -
setDisplayedMnemonicIndexAt
public void setDisplayedMnemonicIndexAt(int index, int mnemonicIndex) -
getDisplayedMnemonicIndexAt
public int getDisplayedMnemonicIndexAt(int index) -
setBackgroundAt
Per-tab background colour. No Vaadin per-tab background knob (theme-controlled); R_vaadin_first drop-and-WARN. -
getBackgroundAt
-
setForegroundAt
-
getForegroundAt
-
setDisabledIconAt
-
getDisabledIconAt
-
getBoundsAt
-
indexAtLocation
public int indexAtLocation(int x, int y) -
getTabRunCount
public int getTabRunCount()JDK always returns ≥1; we always have a single row of tabs (no WRAP). -
getUIClassID
Description copied from interface:JComponentMixinDeliberate no-op — L&F key.- Specified by:
getUIClassIDin interfaceJComponentMixin
-
updateUI
public void updateUI()Description copied from interface:JComponentMixinDeliberate no-op — L&F dispatch isn't modelled.- Specified by:
updateUIin interfaceJComponentMixin
-
setUI
-
getAccessibleContext
-