Class SJScrollPane

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.orderedlayout.Scroller
com.vaadin.swingbridge.surrogates.SJScrollPane
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.orderedlayout.Scroller>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.Focusable<com.vaadin.flow.component.orderedlayout.Scroller>, com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.orderedlayout.Scroller>, 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.orderedlayout.ScrollerVariant>, ComponentMixin, ContainerMixin, JComponentMixin, Serializable

public class SJScrollPane extends com.vaadin.flow.component.orderedlayout.Scroller implements JComponentMixin
Surrogate for JScrollPane (SD_sjscrollpane). Extends Vaadin Scroller directly (is-a) so it reaches the migrator either through :emulators.JScrollPane as peer, or as a richer-than- stock Vaadin scroll container in its own right.

Why Scroller as peer

Vaadin 25's native scroll container — a single-content-slot container with a built-in Scroller.ScrollDirection enum (Scroller.ScrollDirection.VERTICAL / Scroller.ScrollDirection.HORIZONTAL / Scroller.ScrollDirection.BOTH / Scroller.ScrollDirection.NONE). The single-child invariant is what JScrollPane already enforces (one viewport view at a time); Scroller.setContent(Component) IS the setViewportView mapping.

Auto-scroll guard

setContent(Component) forces Scroller.ScrollDirection.NONE for content that owns its own overflow layer (Grid / TextArea / Scroller) — see that method for the pathology it prevents. The guard fires only on content swap, so an explicit setScrollDirection(VERTICAL) after setContent(grid) sticks: opt-out is one line.

Inherited mixin surface

Almost the entire JComponent surface comes from JComponentMixin: border CSS round-trip (SD_border_css_lossy), client properties, ancestor listeners, tooltip pass-through, etc. SJScrollPane itself adds only the three ctors + the auto-scroll guard + L&F surface tail.

R_vaadin_first lossy: getScrollDirection() after auto-scroll setContent

After setContent(grid), Scroller.getScrollDirection() returns Scroller.ScrollDirection.NONE regardless of any prior setScrollDirection call — the auto-scroll guard overwrote it. R_vaadin_first-accepted lossy direction; the JDK-shaped scrollbar policy ints live on the emulator side via field shadow per R_swing_is_truth. Migration convention: read scrollbar policy through the emulator (JScrollPane.getVerticalScrollBarPolicy()), not by inspecting the surrogate's Scroller direction.
See Also:
  • Constructor Details

    • SJScrollPane

      public SJScrollPane()
    • SJScrollPane

      public SJScrollPane(com.vaadin.flow.component.Component view)
    • SJScrollPane

      public SJScrollPane(com.vaadin.flow.component.Component view, com.vaadin.flow.component.orderedlayout.Scroller.ScrollDirection direction)
  • Method Details

    • setContent

      public void setContent(com.vaadin.flow.component.Component content)
      Set the viewport content, applying the auto-scroll guard.

      Delegates to Scroller.setContent(Component), then if the content is an instance of any known auto-scrolling Vaadin component type, forces this Scroller's direction to Scroller.ScrollDirection.NONE. Prevents double-scrollbars when a Grid / TextArea / Scroller is wrapped by SJScrollPane.

      null content clears the slot without applying the guard (no content to inspect; whatever direction was set last sticks).

      Overrides:
      setContent in class com.vaadin.flow.component.orderedlayout.Scroller
    • getUIClassID

      public String getUIClassID()
      Swing constant for L&F lookup; ScrollPaneUI isn't pluggable here.
      Specified by:
      getUIClassID in interface JComponentMixin
    • updateUI

      public void updateUI()
      L&F swap — no-op for us; Vaadin owns the DOM.
      Specified by:
      updateUI in interface JComponentMixin
    • setUI

      public void setUI(ScrollPaneUI ui)
      L&F surgery isn't modelled; WARN so integration gaps surface.
    • getAccessibleContext

      public AccessibleContext getAccessibleContext()