Class SJToolBar
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
com.vaadin.swingbridge.surrogates.SJToolBar
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, ComponentMixin, ContainerMixin, JComponentMixin, Serializable
Surrogate for
The toolbar owns its separators inline rather than reaching for the
Maps
JToolBar (SD_sjtoolbar).
Action-button row on top of Vaadin Div — same peer SJPanel /
SJRootPane use. The toolbar is a free-standing flex container, not a
Vaadin HorizontalLayout: the orientation flip
(HORIZONTAL ↔ VERTICAL) is symmetric on a plain Div
(just a CSS flex-direction toggle), and using HorizontalLayout
would force a "horizontal layout that's actually rendering vertically"
misnomer the moment a user calls setOrientation(VERTICAL).
Pinned flex CSS
The ctor writes the toolbar's flex CSS directly on the host element:display:inline-flex; align-items:center; gap:var(--vaadin-gap-xs);
flex-direction:row|column per orientation. We do not go through the
inherited ContainerMixin.setLayout(LayoutManager) CSS
dispatch — that's parameterised on JDK FlowLayout /
BorderLayout / BoxLayout / GridBagLayout instances and
the toolbar wants none of those.
setLayout(LayoutManager) is overridden to drop-and-WARN per
R_vaadin_first (we hard-pin flex flow per orientation). Migrators calling
toolbar.setLayout(new BorderLayout()) would otherwise have the
Border-grid CSS clobber the toolbar's flex CSS — a silent visual
regression. Pinning is the safer default; if a real migration target
needs custom toolbar layouts we lift the restriction then.
Orientation flip (HORIZONTAL ↔ VERTICAL)
Field source-of-truth + CSS write on every change.setOrientation(int)
validates per R_match_swing_errors (IllegalArgumentException matches JDK) and
fires "orientation" PCE on actual change.
addSeparator — inline perpendicular thin Div
The toolbar owns its separators inline rather than reaching for the
SJSeparator surrogate (SD_sjtoolbar): the 1px-stretch trick is a
one-liner and keeps the child a plain toolbar-managed <div>.
addSeparator() builds a <div> sized to 1px on the
toolbar's cross axis with align-self:stretch and adds it —
the same visual shape SJSeparator produces as a standalone flex child.
The one-arg form addSeparator(java.awt.Dimension) accepts the
dimension and drops it per R_layouts_close_enough — JDK uses the size as a spacing hint;
we always paint a thin bar.
setMargin(Insets) → CSS padding
Maps Insets(t,l,b,r) to padding: t r b l on the host
element (the CSS shorthand order). getMargin() reads the
computed padding-top/right/bottom/left back; null margin
removes the property entirely (matches JDK's setMargin(null)
semantics of "use L&F default", which here means "no padding").
What lives on the emulator only (asymmetric R_swing_is_truth shadow)
floatable, rollover, and borderPainted have no
Vaadin counterpart — no detachable toolbars in a browser, no Vaadin
rollover toggle, no painted-border flag distinct from CSS border. R_vaadin_first
says drop them on the surrogate side: the methods are not declared
here at all. Round-trip lives on the emulator
(:emulators.JToolBar's own field shadows, per R_swing_is_truth — same shape
SD_sjbutton takes for state-conditional icons and SD_toggle_checkbox_first_cut takes for
borderPaintedFlat). Pure-surrogate Vaadin-shape users don't
reach for these.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText
com.vaadin.flow.component.HasText.WhiteSpaceNested 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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPush a thin bar oriented perpendicular to the toolbar axis.voidaddSeparator(Dimension size) Dimension-sized separator overload.Returns the last-set margin Insets, ornullif never set.intSwing constant for L&F lookup; ToolBarUI isn't pluggable here.protected StringJDK JToolBar.paramString appends paintBorder + margin + floatable.voidsetLayout(LayoutManager mgr) Hard-pinned flex flow per orientation.voidWritepadding: top right bottom lefton the host element.voidsetOrientation(int orientation) voidL&F surgery isn't modelled; WARN so integration gaps surface.voidupdateUI()L&F swap — no-op for us; Vaadin owns the DOM.Methods inherited from class com.vaadin.flow.component.HtmlComponent
getTitle, setTitleMethods 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 com.vaadin.flow.component.ClickNotifier
addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListenerMethods 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, removeContainerListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, add, addComponentAsFirst, addComponentAtIndex, bindChildren, getChildren, getComponentAt, getComponentCount, indexOf, remove, remove, removeAll, replaceMethods 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 com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasText
bindText, getText, getWhiteSpace, setText, setWhiteSpaceMethods 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
-
Constructor Details
-
SJToolBar
public SJToolBar() -
SJToolBar
public SJToolBar(int orientation)
-
-
Method Details
-
getOrientation
public int getOrientation() -
setOrientation
public void setOrientation(int orientation) -
setLayout
Hard-pinned flex flow per orientation. R_vaadin_first drop-and-WARN — see class javadoc §"Pinned flex CSS" for why we don't honour userLayoutManagerswaps.nullis silently accepted sinceContainer.removeAlland similar JDK code paths pass it as a normal teardown step.- Specified by:
setLayoutin interfaceContainerMixin
-
addSeparator
public void addSeparator()Push a thin bar oriented perpendicular to the toolbar axis. Same visual shape anSJSeparatorhas as a flex child of a toolbar row — Lumo-toned 1px line thatalign-self:stretches across the cross axis. -
addSeparator
Dimension-sized separator overload. We accept the dimension and drop it per R_layouts_close_enough (no pixel-accurate layout); the visual output matchesaddSeparator(). JDK uses the size as a gap hint for the L&F-painted separator; migrated code rarely depends on the gap being exactly that many pixels. -
setMargin
Writepadding: top right bottom lefton the host element.nullremoves the property — matches JDK's "use L&F default" semantics, which here means no padding. Fires"margin"PCE on actual change. -
getMargin
Returns the last-set margin Insets, ornullif never set. -
getUIClassID
Swing constant for L&F lookup; ToolBarUI isn't pluggable here.- Specified by:
getUIClassIDin interfaceJComponentMixin
-
updateUI
public void updateUI()L&F swap — no-op for us; Vaadin owns the DOM.- Specified by:
updateUIin interfaceJComponentMixin
-
setUI
L&F surgery isn't modelled; WARN so integration gaps surface. -
paramString
JDK JToolBar.paramString appends paintBorder + margin + floatable. None of those round-trip on the surrogate (floatable/borderPainted are emulator-only; margin lives here but is rendered via CSS). The pure-surrogate paramString tail is empty. -
getAccessibleContext
-