Package org.jdesktop.swingx.plaf.basic
Class BasicYListUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
org.jdesktop.swingx.plaf.YListUI
org.jdesktop.swingx.plaf.basic.BasicYListUI
- Direct Known Subclasses:
BasicXListUI,SynthYListUI
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classclassThis class should be treated as a "protected" inner class.protected classclassTheListDataListenerthat's added to theJListsmodel atinstallUI time, and whenever the JList.model property changes.classThe ListSelectionListener that's added to the JLists selection model at installUI time, and whenever the JList.selectionModel property changes.classMouse input, and focus handling for JList.classThe PropertyChangeListener that's added to the JList at installUI time. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringBuilderprotected static final intUsed by IncrementLeadSelectionAction.protected static final intUsed by IncrementLeadSelectionAction.protected static final TransferHandlerprotected static final intprotected static final intUsed by IncrementLeadSelectionAction.protected BasicYListUI.HandlerFields inherited from class org.jdesktop.swingx.plaf.YListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, columnCount, componentOrientationChanged, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, heightChanged, isFileList, isLeftToRight, layoutOrientation, layoutOrientationChanged, list, listDataListener, listHeight, listSelectionListener, listWidth, modelChanged, mouseInputListener, preferredHeight, propertyChangeListener, prototypeCellValueChanged, rendererPane, rowsPerColumn, selectionModelChanged, timeFactor, updateLayoutStateNeeded, widthChanged -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckBaselinePrecondition(JComponent c, int width, int height) Fix for Issue #1495: NPE on getBaseline.protected FocusListenerprotected ListDataListenerCreates an instance ofListDataListenerthat's added to theJListsby model as needed.protected ListSelectionListenerCreates an instance ofListSelectionHandlerthat's added to theJListsby selectionModel as needed.protected MouseInputListenerCreates a delegate that implementsMouseInputListener.protected PropertyChangeListenerCreates an instance ofPropertyChangeHandlerthat's added to theJListbyinstallUI().static ComponentUIintgetBaseline(JComponent c, int width, int height) protected RectanglegetCellBounds(JList<?> list, int index) Gets the bounds of the specified model index, returning the resulting bounds, or null ifindexis not valid.protected Rectangleprotected BasicYListUI.Handlerprotected voidthis method is called at installUI() time.protected voidthis method is called at installUI() time.protected voidthis method is called at installUI() time.voidstatic voidvoidpaint(Graphics g, JComponent c) protected voidpaintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer<Object> cellRenderer, ListModel<Object> dataModel, ListSelectionModel selModel, int leadIndex) Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use theCellRendererPaneto paint it.protected voidprotected voidpaintImpl(Graphics g, JComponent c) protected voidprotected voidSelect the next row and force it to be visible.protected voidSelect the previous row and force it to be visible.protected voidprotected voidprotected voidvoidprotected voidMethods inherited from class org.jdesktop.swingx.plaf.YListUI
convertLocationToColumn, convertLocationToRow, convertModelToColumn, convertModelToRow, convertRowToY, convertYToRow, getCellBounds, getElementCount, getHeight, getModelIndex, getRowCount, getViewModel, indexToLocation, locationToIndex, maybeUpdateLayoutState, updateLayoutStateMethods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
-
Field Details
-
handler
-
DROP_LINE_THICKNESS
protected static final int DROP_LINE_THICKNESS- See Also:
-
BASELINE_COMPONENT_KEY
-
CHANGE_LEAD
protected static final int CHANGE_LEADUsed by IncrementLeadSelectionAction. Indicates the action should change the lead, and not select it.- See Also:
-
CHANGE_SELECTION
protected static final int CHANGE_SELECTIONUsed by IncrementLeadSelectionAction. Indicates the action should change the selection and lead.- See Also:
-
EXTEND_SELECTION
protected static final int EXTEND_SELECTIONUsed by IncrementLeadSelectionAction. Indicates the action should extend the selection from the anchor to the next index.- See Also:
-
defaultTransferHandler
-
-
Constructor Details
-
BasicYListUI
-
-
Method Details
-
createUI
-
loadActionMap
-
paintCell
protected void paintCell(Graphics g, int row, Rectangle rowBounds, ListCellRenderer<Object> cellRenderer, ListModel<Object> dataModel, ListSelectionModel selModel, int leadIndex) Paint one List cell: compute the relevant state, get the "rubber stamp" cell renderer component, and then use theCellRendererPaneto paint it. Subclasses may want to override this method rather thanpaint().- Parameters:
g- an instance ofGraphicsrow- a rowrowBounds- a bounding rectangle to render tocellRenderer- a list ofListCellRendererdataModel- a list modelselModel- a selection modelleadIndex- a lead index- See Also:
-
paint
copied from javax.swing.plaf.basic.BasicListUI to call paintImpl
- Overrides:
paintin classComponentUI
-
paintImpl
-
paintDropLine
-
getDropLineRect
-
getBaseline
- Overrides:
getBaselinein classComponentUI
-
checkBaselinePrecondition
Fix for Issue #1495: NPE on getBaseline. As per contract, that methods needs to throw Exceptions on illegal parameters. As we by-pass super, need to do the check and throw ouerselves.- Parameters:
c- JComponentwidth- expected ≥ 0height- expected ≥ 0- Throws:
IllegalArgumentException- if width or height < 0NullPointerException- if c == null
-
getBaselineResizeBehavior
- Overrides:
getBaselineResizeBehaviorin classComponentUI
-
getPreferredSize
The preferredSize of the list depends upon the layout orientation. Threre are 3 layouts
VERTICAL,HORIZONTAL_WRAP, andVERTICAL_WRAP- Overrides:
getPreferredSizein classComponentUI- See Also:
-
selectPreviousIndex
protected void selectPreviousIndex()Select the previous row and force it to be visible.- See Also:
-
selectNextIndex
protected void selectNextIndex()Select the next row and force it to be visible.- See Also:
-
installKeyboardActions
protected void installKeyboardActions()this method is called at installUI() time.- Overrides:
installKeyboardActionsin classYListUI- See Also:
-
uninstallKeyboardActions
protected void uninstallKeyboardActions() -
installListeners
protected void installListeners()this method is called at installUI() time.- Overrides:
installListenersin classYListUI- See Also:
-
uninstallListeners
protected void uninstallListeners() -
installDefaults
protected void installDefaults()this method is called at installUI() time.- Overrides:
installDefaultsin classYListUI- See Also:
-
updateIsFileList
protected void updateIsFileList() -
uninstallDefaults
protected void uninstallDefaults() -
installUI
Initializes
super.listwithJComponent cby calling protected void installDefaults() protected void installListeners() protected void installKeyboardActions()Initializes
super.listwithJComponent cby calling protected void installDefaults() protected void installListeners() protected void installKeyboardActions() -
uninstallUI
- Overrides:
uninstallUIin classComponentUI
-
getCellBounds
Gets the bounds of the specified model index, returning the resulting bounds, or null ifindexis not valid.with LOG
- Overrides:
getCellBoundsin classYListUI- Parameters:
list- JListindex- int- Returns:
- Rectangle
-
getHandler
-
createMouseInputListener
Creates a delegate that implementsMouseInputListener. The delegate is added to the correspondingjava.awt.Componentlistener lists atinstallUI()time. Subclasses can override this method to return a customMouseInputListener, e.g.class MyListUI extends BasicListUI { protected MouseInputListener createMouseInputListener() { return new MyMouseInputHandler(); } public class MyMouseInputHandler extends MouseInputHandler { public void mouseMoved(MouseEvent e) { // do some extra work when the mouse moves super.mouseMoved(e); } } }- Returns:
- an instance of
MouseInputListener - See Also:
-
createFocusListener
-
createListSelectionListener
Creates an instance ofListSelectionHandlerthat's added to theJListsby selectionModel as needed. Subclasses can override this method to return a customListSelectionListener, e.g.class MyListUI extends BasicListUI { protected ListSelectionListener createListSelectionListener() { return new MySelectionListener(); } public class MySelectionListener extends ListSelectionHandler { public void valueChanged(ListSelectionEvent e) { // do some extra work when the selection changes super.valueChange(e); } } }- Returns:
- an instance of
ListSelectionHandler - See Also:
-
redrawList
protected void redrawList() -
createListDataListener
Creates an instance ofListDataListenerthat's added to theJListsby model as needed. Subclasses can override this method to return a customListDataListener, e.g.class MyListUI extends BasicListUI { protected ListDataListener createListDataListener() { return new MyListDataListener(); } public class MyListDataListener extends ListDataHandler { public void contentsChanged(ListDataEvent e) { // do some extra work when the models contents change super.contentsChange(e); } } }- Returns:
- an instance of
ListDataListener - See Also:
-
createPropertyChangeListener
Creates an instance ofPropertyChangeHandlerthat's added to theJListbyinstallUI(). Subclasses can override this method to return a customPropertyChangeListener, e.g.class MyListUI extends BasicListUI { protected PropertyChangeListener createPropertyChangeListener() { return new MyPropertyChangeListener(); } public class MyPropertyChangeListener extends PropertyChangeHandler { public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName().equals("model")) { // do some extra work when the model changes } super.propertyChange(e); } } }- Returns:
- an instance of
PropertyChangeHandler - See Also:
-