Class SJWindow

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.dialog.Dialog
com.vaadin.swingbridge.surrogates.SWindow
com.vaadin.swingbridge.surrogates.SJWindow
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

public class SJWindow extends SWindow
Surrogate for JWindow: an undecorated top-level window — splash screens, toast/notification popups, heavyweight-popup vehicles. JDK shape is JWindow extends java.awt.Window implements RootPaneContainer: no title, no chrome, no close gestures, no defaultCloseOperation (JWindow doesn't implement WindowConstants), no menubar slot. Accordingly this class extends SWindow directly — NOT SFrame, whose title / close-X / close-op state a JWindow must not carry.

Ctor defaults (the entire JWindow delta over SWindow)

  • Undecorated always — SWindow.setUndecoratedChrome(boolean) is on unconditionally: no header, no content padding, no border radius. Box-shadow kept per the documented R_layouts_close_enough divergence.
  • Modeless — a splash/toast must never block the page. Vaadin Dialog defaults to modal; the ctor flips to ModalityMode.MODELESS.
  • No user close gestures — ESC / outside-click dismissal is disarmed. A real JWindow has no chrome to close it from; programmatic setVisible(false) / dispose() are the only close paths, which also means no peer-originated WINDOW_CLOSING ever fires here.
  • Not user-movable / resizable — no title bar to drag, no resize grips. Vaadin Dialog's defaults (draggable=false, resizable=false) already match; unlike SFrame's ctor, nothing is seeded.

Placement

The typical JWindow is explicitly placed: setLocationRelativeTo(null) for a centered splash (the Dialog default — a no-op that also clears prior placement), SWindow.setBounds(int, int, int, int) for a corner toast. Both live on SWindow's geometry surface mapping 1:1 to the overlay's top/left/width/height.

RootPane / contentPane scaffolding

Third consumer of the shared RootPaneScaffold (with SJFrame / SJDialog) — the composition dedup SD_sjdialog's third-consumer trigger anticipated. Public surface mirrors JDK JWindow's RootPaneContainer subset: content pane routing, lazy root pane, layered / glass pass-throughs. The scaffold's menubar slot stays dormant here — JWindow has no setJMenuBar.
See Also:
  • Constructor Details

    • SJWindow

      public SJWindow()
      Ownerless window.
    • SJWindow

      public SJWindow(SWindow owner)
      With owner (any SWindow — frame, dialog, or window — per JDK's owner-chain shape). Null owner is a top-level window.
  • Method Details

    • 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 throws IllegalComponentStateException; the mirror-into- rootPane invariant holds across swaps. Carried by RootPaneScaffold.
    • add

      public void add(Collection<com.vaadin.flow.component.Component> components)
    • addComponentAtIndex

      public void addComponentAtIndex(int index, com.vaadin.flow.component.Component component)
      Specified by:
      addComponentAtIndex in interface com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>
      Overrides:
      addComponentAtIndex in class com.vaadin.flow.component.dialog.Dialog
    • remove

      public void remove(com.vaadin.flow.component.Component... components)
    • remove

      public void remove(Collection<com.vaadin.flow.component.Component> components)
    • removeAll

      public void removeAll()
      Specified by:
      removeAll in interface com.vaadin.flow.component.HasComponentsOfType<com.vaadin.flow.component.Component>
      Overrides:
      removeAll in class com.vaadin.flow.component.dialog.Dialog
    • getRootPane

      public SJRootPane getRootPane()
      Description copied from interface: JComponentMixin
      Walks the Vaadin parent chain and returns the first SJRootPane ancestor, or null if none. Mirrors the JDK JComponent.getRootPane() contract (climb-until-root-pane) over the surrogate-layer types.

      Surrogate-layer divergence from JDK signature: returns SJRootPane (Vaadin-rooted) rather than javax.swing.JRootPane. The same R_vaadin_first + SD_sjframe stance that drove JComponentMixin.getTopLevelAncestor() to return Vaadin Component applies here — SJRootPane is deliberately not a JDK JRootPane subclass (it extends com.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 lets SJFrame provide 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.

    • setRootPane

      public void setRootPane(SJRootPane root)
      Replaces the root pane, as the JDK's protected setRootPane does: the outgoing one leaves this window and root becomes its one child, holding the content pane from then on. Public so the emulator layer can hand down the peer of the root pane it built itself, which is how one root pane serves both layers.
      Parameters:
      root - null leaves the window without a root pane, as the JDK allows
    • createRootPane

      protected SJRootPane createRootPane()
      Subclass hook matching JDK JWindow's createRootPane. Called once on first getRootPane() 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()
      Convenience accessor: getRootPane().getDefaultButton().