Class JList<E>
- All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable
JList, over an SJList peer that renders the
Grid<Integer> (SD_sjlist). R_leaf_peer_lockdown-locked-down (JDK leaf — private
peer ctor). Implements Scrollable and
Accessible to match the JDK interface set.
The list owns its state, as the JDK's does: dataModel and
selectionModel are this class's fields, the selection methods are the JDK's
bodies over them, and no getter reads the peer
(D_emulator_owned_state). The surrogate shares both model objects,
pushed to it through withPeer: it renders the model, mirrors the selection onto
the Grid, and writes a browser selection into the selection model. It also shifts the
selection when the model inserts or removes rows, which is the JDK's
BasicListUI behaviour, not JList's. The selection reaches this class's
listeners the JDK's way: a ListSelectionHandler on the selection model,
registered by the first addListSelectionListener(ListSelectionListener).
Item clicks come from a ctor-installed bridge re-sourcing the surrogate's
SMouseListener with source rebound to this, so
addMouseListener + getClickCount()==2 + locationToIndex
works as written. The JDK ListCellRenderer surface lives here; a
dynamic Vaadin renderer on the surrogate resolves it per render call and
snapshots the result (D_event_port_policy / D_jcombobox / R_vaadin_first). See installSurrogateBridges() /
renderCellViaEmulator(Integer).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classDrop location for a JList drop (D_drag_and_drop — emulator forjavax.swing.JList.DropLocation). -
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddSelectionInterval(int anchor, int lead) voidprotected ListSelectionModelReturns a freshDefaultListSelectionModel; a subclass overrides this to install its own.voidensureIndexIsVisible(int index) Scrolls the Grid to the row; the JDK'sgetCellBoundsroute has no server-side geometry here.protected voidfireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) intgetCellBounds(int index0, int index1) ListCellRenderer<? super E> booleanfinal DropModeintintintintintintintintgetModel()intgetScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) booleanbooleanintgetScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) intint[]intgetUI()booleanintindexToLocation(int index) booleanisSelectedIndex(int index) booleanintlocationToIndex(Point location) The clicked row during a mouse handler's dispatch,-1otherwise, whatever the coordinates: there is no server-side pixel→cell map (R_layouts_close_enough).voidvoidremoveSelectionInterval(int index0, int index1) voidsetCellRenderer(ListCellRenderer<? super E> cellRenderer) voidsetDragEnabled(boolean b) final voidsetDropMode(DropMode dropMode) voidsetFixedCellHeight(int height) voidsetFixedCellWidth(int width) voidsetLayoutOrientation(int layoutOrientation) voidsetListData(E[] listData) voidsetListData(Vector<E> listData) voidvoidsetPrototypeCellValue(E prototypeCellValue) Fires"prototypeCellValue"on this emulator in addition to delegating.voidsetSelectedIndex(int index) An index below 0 does not clear the selection:DefaultListSelectionModelignores it, as in the JDK.voidsetSelectedIndices(int[] indices) voidsetSelectedValue(Object anObject, boolean shouldScroll) A value that is already selected, or that the model does not hold, leaves the selection as it is: the JDK's fallbacksetSelectedIndex(-1)is ignored by the selection model.voidvoidvoidsetSelectionInterval(int anchor, int lead) voidsetSelectionMode(int selectionMode) voidsetSelectionModel(ListSelectionModel selectionModel) voidvoidsetValueIsAdjusting(boolean b) voidsetVisibleRowCount(int visibleRowCount) 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, getInsets, getInsets, 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, scrollRectToVisible, 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
-
VERTICAL
public static final int VERTICAL- See Also:
-
VERTICAL_WRAP
public static final int VERTICAL_WRAP- See Also:
-
HORIZONTAL_WRAP
public static final int HORIZONTAL_WRAP- See Also:
-
-
Constructor Details
-
JList
public JList() -
JList
-
JList
-
JList
-
-
Method Details
-
getModel
-
setModel
-
setListData
-
setListData
-
getCellRenderer
-
setCellRenderer
-
createSelectionModel
Returns a freshDefaultListSelectionModel; a subclass overrides this to install its own. -
getSelectionModel
-
setSelectionModel
-
setSelectionMode
public void setSelectionMode(int selectionMode) -
getSelectionMode
public int getSelectionMode() -
getAnchorSelectionIndex
public int getAnchorSelectionIndex() -
getLeadSelectionIndex
public int getLeadSelectionIndex() -
getMinSelectionIndex
public int getMinSelectionIndex() -
getMaxSelectionIndex
public int getMaxSelectionIndex() -
isSelectedIndex
public boolean isSelectedIndex(int index) -
isSelectionEmpty
public boolean isSelectionEmpty() -
clearSelection
public void clearSelection() -
setSelectionInterval
public void setSelectionInterval(int anchor, int lead) -
addSelectionInterval
public void addSelectionInterval(int anchor, int lead) -
removeSelectionInterval
public void removeSelectionInterval(int index0, int index1) -
setValueIsAdjusting
public void setValueIsAdjusting(boolean b) -
getValueIsAdjusting
public boolean getValueIsAdjusting() -
getSelectedIndices
public int[] getSelectedIndices() -
setSelectedIndex
public void setSelectedIndex(int index) An index below 0 does not clear the selection:DefaultListSelectionModelignores it, as in the JDK. -
setSelectedIndices
public void setSelectedIndices(int[] indices) -
getSelectedValuesList
-
getSelectedIndex
public int getSelectedIndex() -
getSelectedValue
-
setSelectedValue
A value that is already selected, or that the model does not hold, leaves the selection as it is: the JDK's fallbacksetSelectedIndex(-1)is ignored by the selection model. -
ensureIndexIsVisible
public void ensureIndexIsVisible(int index) Scrolls the Grid to the row; the JDK'sgetCellBoundsroute has no server-side geometry here. -
addListSelectionListener
-
removeListSelectionListener
-
getListSelectionListeners
-
fireSelectionValueChanged
protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) -
locationToIndex
The clicked row during a mouse handler's dispatch,-1otherwise, whatever the coordinates: there is no server-side pixel→cell map (R_layouts_close_enough).As
BasicListUI's, a null location throws and the answer is the closest cell: a list shrunk while the handler was parked on a dialog answers its last row. -
indexToLocation
-
getCellBounds
-
getLayoutOrientation
public int getLayoutOrientation() -
setLayoutOrientation
public void setLayoutOrientation(int layoutOrientation) -
getVisibleRowCount
public int getVisibleRowCount() -
setVisibleRowCount
public void setVisibleRowCount(int visibleRowCount) -
getFixedCellWidth
public int getFixedCellWidth() -
setFixedCellWidth
public void setFixedCellWidth(int width) -
getFixedCellHeight
public int getFixedCellHeight() -
setFixedCellHeight
public void setFixedCellHeight(int height) -
getPrototypeCellValue
-
setPrototypeCellValue
Fires"prototypeCellValue"on this emulator in addition to delegating. The surrogate fires on its own listener list, which a migrator'saddPropertyChangeListeneron the JList never reaches — the two-layer fan-out is independent by design (D_owed_events). -
getSelectionForeground
-
setSelectionForeground
-
getSelectionBackground
-
setSelectionBackground
-
getDragEnabled
public boolean getDragEnabled() -
setDragEnabled
public void setDragEnabled(boolean b) -
getDropMode
-
setDropMode
-
getFirstVisibleIndex
public int getFirstVisibleIndex() -
getLastVisibleIndex
public int getLastVisibleIndex() -
getPreferredScrollableViewportSize
- Specified by:
getPreferredScrollableViewportSizein interfaceScrollable
-
getScrollableUnitIncrement
- Specified by:
getScrollableUnitIncrementin interfaceScrollable
-
getScrollableBlockIncrement
- Specified by:
getScrollableBlockIncrementin interfaceScrollable
-
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()- Specified by:
getScrollableTracksViewportWidthin interfaceScrollable
-
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()- Specified by:
getScrollableTracksViewportHeightin interfaceScrollable
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getUI
- Overrides:
getUIin classJComponent
-
setUI
-
getAccessibleContext
- Specified by:
getAccessibleContextin interfaceAccessible- Overrides:
getAccessibleContextin classComponent
-