Class JViewport
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
JViewport. Per
D_viewport_scrollbar_shadows,
a shadow JDK component: emulator-only, no surrogate
counterpart. Vaadin's Scroller
has no separate viewport object — Scroller.getContent() IS the
viewport view, and the DOM rendering of "viewport bounds" is owned by
the Scroller's web component. JViewport here exists to give migrated
code that calls scrollPane.getViewport().getView() or
scrollPane.getViewport().addChangeListener(...) a non-null
object that round-trips its own state without NPE.
R_leaf_peer_lockdown-locked-down: no protected (Component peer) ctor exposed.
Constructed only via the package-private JViewport(JScrollPane)
ctor used by JScrollPane.getViewport().
Round-trip-only fields
Most viewport state (extentSize / viewPosition /
viewSize) field-shadows but never drives the peer — Vaadin
Scroller doesn't expose these as server-side concepts. Field round-trip
is honest about JDK fidelity (user code reading back what it set sees
its values); visible behaviour is "no scroll-position events fire."
Listeners stored but never fire
addChangeListener(ChangeListener) stores the listener in
EventListenerList for round-trip; no Vaadin
source fires ChangeEvents for scroll position
without a custom DOM listener stack (R_match_swing_errors sub-bucket (a) — graduate when
a migration target asks).- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, FILL_CHROME, FILL_DEFAULT, LEFT_ALIGNMENT, listenerList, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptionPublic no-arg ctor for migrated code that constructs a JViewport directly (rare but possible; some L&F-aware code doesscrollPane.setViewport(new JViewport())). -
Method Summary
Modifier and TypeMethodDescriptionvoidintgetUI()getView()The wrapped emulator component, resolved through the owningJScrollPane'sgetViewportView.The origin while no view is set, as in the JDK — there is nothing to ask.AsgetViewPosition(), the origin while no view is set.voidvoidscrollRectToVisible(Rectangle contentRect) voidsetExtentSize(Dimension newExtent) voidsetScrollMode(int mode) Stores the mode with no peer effect — Vaadin owns scroll rendering.voidsetUI(ViewportUI ui) voidReplace the wrapped component — through the owningJScrollPane'sJScrollPane.setViewportView(Component)when one is bound, and otherwise into this viewport's own child list, which is where the JDK keeps it either way (getView()is itsgetComponent(0)).voidStore the scroll offset, or ignore it while the viewport holds no view.voidsetViewSize(Dimension newSize) Same no-view gate and same reason assetViewPosition(Point).voidupdateUI()Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, addSlotChild, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, fireHierarchyEvent, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, peerContentElement, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeSlotChild, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, applyBackgroundToPeer, applyVisibleToPeer, awtListeners, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, defaultFillCssClass, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, fireComponentEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isThemeDefault, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, suppressMouseBridge, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, withPeer, withPeerOnLiveUI
-
Field Details
-
BLIT_SCROLL_MODE
public static final int BLIT_SCROLL_MODE- See Also:
-
BACKINGSTORE_SCROLL_MODE
public static final int BACKINGSTORE_SCROLL_MODE- See Also:
-
SIMPLE_SCROLL_MODE
public static final int SIMPLE_SCROLL_MODE- See Also:
-
-
Constructor Details
-
JViewport
public JViewport()Public no-arg ctor for migrated code that constructs a JViewport directly (rare but possible; some L&F-aware code doesscrollPane.setViewport(new JViewport())). Owner is unbound until the JViewport is attached to a JScrollPane viasetViewport, at which pointbindOwner(JScrollPane)is called.
-
-
Method Details
-
getView
The wrapped emulator component, resolved through the owningJScrollPane'sgetViewportView. Returnsnullif no owner is bound or no view is set. -
setView
Replace the wrapped component — through the owningJScrollPane'sJScrollPane.setViewportView(Component)when one is bound, and otherwise into this viewport's own child list, which is where the JDK keeps it either way (getView()is itsgetComponent(0)).An unbound viewport therefore still holds what it was given, scrolling being the effect R_decline_effect_only lets go and the view being state it does not.
-
getExtentSize
-
setExtentSize
-
getViewPosition
The origin while no view is set, as in the JDK — there is nothing to ask. -
setViewPosition
Store the scroll offset, or ignore it while the viewport holds no view.The no-view gate is the JDK's, and it is not a nicety.
javax.swing.JViewportkeeps no position field: it writes the offset onto the view's own location, negated, andgetViewPosition()reads it back off the view — so with no view the write is dropped and the getter answers(0,0). SB-Emulators answered back whatever was set, on a viewport that held nothing (D_return_value_audit). The field stays becausevaadinx.awt.ComponentdropssetLocation(R_layouts_close_enough), so the view cannot hold the value for us; with a view present the observable round trip is the same either way. Anullpoint NPEs here exactly where the JDK'sp.xread does. -
getViewSize
AsgetViewPosition(), the origin while no view is set. -
setViewSize
Same no-view gate and same reason assetViewPosition(Point). -
getViewRect
-
getScrollMode
public int getScrollMode() -
setScrollMode
public void setScrollMode(int mode) Stores the mode with no peer effect — Vaadin owns scroll rendering.Deliberately accepts a mode outside the three JDK constants, because the JDK does:
setScrollMode(99)thengetScrollMode()answers 99 on JDK 25. Rejecting it would be the kind of unrequested improvement R_no_silent_improvements forbids — a migrated app that got away with a junk mode on the desktop must get away with it here. -
addChangeListener
-
removeChangeListener
-
getChangeListeners
-
scrollRectToVisible
- Overrides:
scrollRectToVisiblein classJComponent
-
getInsets
- Overrides:
getInsetsin classJComponent
-
getInsets
- Overrides:
getInsetsin classJComponent
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getUI
- Overrides:
getUIin classJComponent
-
setUI
-
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent
-