Class SJDialog
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasAriaRole, 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.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasTheme, com.vaadin.flow.component.shared.HasThemeVariant<com.vaadin.flow.component.dialog.DialogVariant>, ComponentMixin, ContainerMixin, JComponentMixin, Serializable
JDialog, the edit-form host.
Why extend SFrame, not a sibling SDialog
JDK shape is JDialog IS-A Dialog IS-A Window —
Dialog and Frame are siblings under Window, not parent / child. The
surrogate-side Window analog (SFrame) currently subsumes both
the java.awt.Frame state (title, owner, defaultCloseOperation
machinery via SJFrame) and the java.awt.Window state
(visible shadow, listener families, owner tree). SJDialog extends
SFrame to inherit that state directly rather than introducing an
SDialog tier — the modal/modalityType API surface lives on
:emulators.awt.Dialog (the emulator), and the Vaadin-first
modality knob is reachable on every surrogate via the inherited
Dialog.setModality(ModalityMode) from SWindow's parent.
R_vaadin_first stance: this surrogate doesn't reproduce the AWT
setModal(boolean) / setModalityType(ModalityType) API
on the surrogate side — direct surrogate users reach Vaadin's
setModality natively. The emulator-layer Dialog
carries the AWT-shape modal API and mirrors into Vaadin's
setModality on the peer.
RootPane / contentPane / JMenuBar scaffolding
JDK shape has bothJFrame and JDialog independently
implementing RootPaneContainer / lazy JRootPane — inheriting
from SJFrame would imply JDialog IS-A JFrame and leak that misshape
into migrated code that reads dialog instanceof SJFrame. The
public surface stays sibling-shaped here; the stateful machinery
(lazy panes, recursion guard, menubar slot) lives single-copy on the
package-private RootPaneScaffold shared with SJFrame /
SJWindow — SD_sjdialog's third-consumer dedup, resolved by
composition when SJWindow landed.
Default close operation
JDialog rejectsEXIT_ON_CLOSE at set-time per JDK contract —
unlike JFrame, JDialog can't terminate the JVM. Only
DO_NOTHING_ON_CLOSE / HIDE_ON_CLOSE (default) /
DISPOSE_ON_CLOSE are valid. The processWindowEvent(SWindowEvent)
override layers the close-op switch on top of SWindow's
standard listener dispatch — same shape as SJFrame minus the
EXIT_ON_CLOSE close-time throw (since set-time already rejects it).
Content-pane mirror invariant
Same as SJFrame:dialog.getContentPane() == dialog.getRootPane().getContentPane()
holds across setContentPane(Div) swaps. rootPaneCheckingEnabled
routing prevents add/remove recursion during the bootstrap.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.dialog.Dialog
com.vaadin.flow.component.dialog.Dialog.ClosedEvent, com.vaadin.flow.component.dialog.Dialog.DialogCloseActionEvent, com.vaadin.flow.component.dialog.Dialog.DialogDraggedEvent, com.vaadin.flow.component.dialog.Dialog.DialogFooter, com.vaadin.flow.component.dialog.Dialog.DialogHeader, com.vaadin.flow.component.dialog.Dialog.DialogResizeEvent, com.vaadin.flow.component.dialog.Dialog.OpenedChangeEventNested 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 TypeMethodDescriptionvoidadd(Collection<com.vaadin.flow.component.Component> components) voidaddComponentAtIndex(int index, com.vaadin.flow.component.Component component) protected SJRootPaneSubclass hook matching JDK JDialog'screateRootPane.com.vaadin.flow.component.html.DivLazy-creates if never accessed.com.vaadin.flow.component.button.ButtonintCurrent close operation; one ofDO_NOTHING_ON_CLOSE / HIDE_ON_CLOSE / DISPOSE_ON_CLOSE.com.vaadin.flow.component.ComponentnulluntilsetJMenuBar(SJMenuBar)attaches one.com.vaadin.flow.component.ComponentWalks the Vaadin parent chain and returns the firstSJRootPaneancestor, ornullif none.Matchesjavax.swing.JDialog.getUIClassID().ExtendsSFrame.paramString()with the defaultCloseOperation report.voidJDialog-shape: let user listeners run first, then apply the default close operation.voidremove(com.vaadin.flow.component.Component... components) voidremove(Collection<com.vaadin.flow.component.Component> components) voidvoidsetContentPane(com.vaadin.flow.component.html.Div newPane) Swap the content pane.voidsetDefaultCloseOperation(int operation) Validate + apply.voidsetGlassPane(com.vaadin.flow.component.Component glass) voidsetJMenuBar(SJMenuBar bar) Attach a menubar.voidsetLayeredPane(com.vaadin.flow.component.Component layered) Methods inherited from class SFrame
getExtendedState, getFrames, getOwnerlessFrames, getState, getTitle, isDefaultLookAndFeelDecorated, isResizable, isUndecorated, setDefaultLookAndFeelDecorated, setExtendedState, setResizable, setState, setTitle, setUndecoratedMethods inherited from class SWindow
addComponentListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, centerOnScreen, createBufferStrategy, createBufferStrategy, dispose, fireClosedEvent, fireClosingEvent, fireOpenedEvent, fireWindowEvent, fireWindowFocusEvent, fireWindowStateEvent, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isUndecoratedChrome, isValidateRoot, pack, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setAutoRequestFocus, setBounds, setEnabled, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocationByPlatform, setLocationRelativeTo, setOpacity, setShape, setSize, setUndecoratedChrome, setVisible, toBack, toFrontMethods inherited from class com.vaadin.flow.component.dialog.Dialog
addAttachListener, addClosedListener, addDetachListener, addDialogCloseActionListener, addDraggedListener, addOpenedChangeListener, addResizeListener, bindChildren, bindHeight, bindVisible, bindWidth, close, getAriaLabel, getChildren, getFooter, getHeader, getHeaderTitle, getHeight, getLeft, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getModality, getOverlayRole, getRole, getStyle, getTop, getWidth, isAutofocus, isCloseOnEsc, isCloseOnOutsideClick, isDraggable, isFocusTrap, isKeepInViewport, isModal, isOpened, onAttach, open, setAriaLabel, setAutofocus, setCloseOnEsc, setCloseOnOutsideClick, setDraggable, setFocusTrap, setHeaderTitle, setHeight, setKeepInViewport, setLeft, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setModal, setModality, setOpened, setOverlayRole, setRole, setTop, setWidthMethods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, whenAttachedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ComponentMixin
_installSwingClass, 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, setCursor, setFocusable, setFont, setForeground, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validateMethods inherited from interface ContainerMixin
addContainerListener, getContainerListeners, getLayout, paintComponents, printComponents, removeContainerListener, setLayoutMethods inherited from interface com.vaadin.flow.component.HasAriaRole
getAriaRole, setAriaRoleMethods inherited from interface com.vaadin.flow.component.HasComponents
addMethods inherited from interface com.vaadin.flow.component.HasComponentsOfType
add, addComponentAsFirst, getComponentAt, getComponentCount, indexOf, 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, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods 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, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, paintImmediately, paintImmediately, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, requestDefaultFocus, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDoubleBuffered, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, updateUI
-
Constructor Details
-
SJDialog
public SJDialog()Untitled, no owner. -
SJDialog
Titled, no owner. Null title coerces to empty per SFrame. -
SJDialog
Untitled, with owner. Null owner makes this top-level. -
SJDialog
Full ctor — forwards toSFrame(String, SFrame).
-
-
Method Details
-
getDefaultCloseOperation
public int getDefaultCloseOperation()Current close operation; one ofDO_NOTHING_ON_CLOSE / HIDE_ON_CLOSE / DISPOSE_ON_CLOSE. -
setDefaultCloseOperation
public void setDefaultCloseOperation(int operation) Validate + apply. JDialog rejectsWindowConstants.EXIT_ON_CLOSEat set-time (JDK contract — only JFrame may terminate the JVM); the other three values are accepted silently.DO_NOTHING_ON_CLOSEdisables the peer's ESC / outside-click dismissal so the close gesture never fires.Throws
IllegalArgumentExceptionon unknown values per Swing's contract (D_never_fail_on_gaps — incomplete-emulation rule doesn't scope over inputs Swing itself rejects). -
processWindowEvent
JDialog-shape: let user listeners run first, then apply the default close operation. HIDE callssetVisible(false)—setVisibleis idempotent, so on the native ESC / outside-click path (whereSWindow.onPeerOpenedChanged(boolean)already flippedvisibleto false before routing here) it early-returns, while on the header close-X path (which firesWINDOW_CLOSINGdirectly viaSFrame.installHeaderCloseButton()without touching the peer's opened state) it performs the real hide. DISPOSE calls through toSWindow.dispose()for the detach +WINDOW_CLOSED; DO_NOTHING is a genuine no-op (the window must stay open even when the close-X — which is never disarmed — delivers the event). UnlikeSJFrame, no EXIT_ON_CLOSE branch — set-time rejection covers that case.- Overrides:
processWindowEventin classSWindow
-
getContentPane
public com.vaadin.flow.component.html.Div getContentPane()Lazy-creates if never accessed. Never returns null. -
setContentPane
public void setContentPane(com.vaadin.flow.component.html.Div newPane) Swap the content pane. JDK contract: null throwsIllegalComponentStateException; the mirror-into- rootPane invariant holds across swaps. Carried byRootPaneScaffold. -
add
-
addComponentAtIndex
public void addComponentAtIndex(int index, com.vaadin.flow.component.Component component) - Specified by:
addComponentAtIndexin interfacecom.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>- Overrides:
addComponentAtIndexin classcom.vaadin.flow.component.dialog.Dialog
-
remove
public void remove(com.vaadin.flow.component.Component... components) -
remove
-
removeAll
public void removeAll()- Specified by:
removeAllin interfacecom.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>- Overrides:
removeAllin classcom.vaadin.flow.component.dialog.Dialog
-
setJMenuBar
Attach a menubar. Passnullto detach. Same idiom asSJFrame.setJMenuBar(SJMenuBar); slot semantics live onRootPaneScaffold. -
getJMenuBar
nulluntilsetJMenuBar(SJMenuBar)attaches one. -
getRootPane
Description copied from interface:JComponentMixinWalks the Vaadin parent chain and returns the firstSJRootPaneancestor, ornullif none. Mirrors the JDKJComponent.getRootPane()contract (climb-until-root-pane) over the surrogate-layer types.Surrogate-layer divergence from JDK signature: returns
SJRootPane(Vaadin-rooted) rather thanjavax.swing.JRootPane. The same R_vaadin_first + SD_sjframe stance that droveJComponentMixin.getTopLevelAncestor()to return VaadinComponentapplies here — SJRootPane is deliberately not a JDK JRootPane subclass (it extendscom.vaadin.flow.component.html.Div), so a JDK-typed accessor would have to either fabricate a wrapper or stay permanently null. The Vaadin-typed accessor letsSJFrameprovide a covariant override that returns its lazy-constructed pane, and lets standalone surrogates report a real ancestor when one exists. Migrators porting Swing code that read the JDK type adjust the variable type at the surrogate stage; the:emulators.JComponent.getRootPane()path keeps the JDK-typed signature for stage-2 import-swap compatibility. -
createRootPane
Subclass hook matching JDK JDialog'screateRootPane. Called once on firstgetRootPane()read. -
getLayeredPane
public com.vaadin.flow.component.Component getLayeredPane() -
setLayeredPane
public void setLayeredPane(com.vaadin.flow.component.Component layered) -
getGlassPane
public com.vaadin.flow.component.Component getGlassPane() -
setGlassPane
public void setGlassPane(com.vaadin.flow.component.Component glass) -
getDefaultButton
public com.vaadin.flow.component.button.Button getDefaultButton() -
getUIClassID
Matchesjavax.swing.JDialog.getUIClassID(). -
paramString
ExtendsSFrame.paramString()with the defaultCloseOperation report. Diagnostic only — not a contract users should rely on.- Overrides:
paramStringin classSFrame
-