Package org.jdesktop.swingx.plaf
Class YListUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
org.jdesktop.swingx.plaf.YListUI
- Direct Known Subclasses:
BasicYListUI
Similar to
javax.swing.plaf.basic.ListUI
this abstract class
defines a pluggable look and feel delegate for JYList
and JXList
.
Most of the implementation is like in javax.swing.plaf.basic.BasicListUI
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected int[]
protected static final int
protected int
protected int
protected static final int
protected static final int
protected static final int
protected FocusListener
protected static final int
protected static final int
protected boolean
protected boolean
protected int
protected static final int
protected ListDataListener
protected int
protected ListSelectionListener
protected int
protected static final int
protected MouseInputListener
protected int
protected PropertyChangeListener
protected static final int
protected CellRendererPane
protected int
protected static final int
protected long
protected int
protected static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
convertLocationToColumn
(int x, int y) Returns the closest column to the passed in location.protected int
convertLocationToRow
(int x, int y0, boolean closest) Returns the row at location x/y.protected int
convertModelToColumn
(int index) Returns the column that the model indexindex
will be displayed in.protected int
convertModelToRow
(int index) Returns the row that the model indexindex
will be displayed in.protected int
convertRowToY
(int row) protected int
convertYToRow
(int y0) protected Rectangle
getCellBounds
(JList<?> list, int index) Gets the bounds of the specified model index, returning the resulting bounds, or null ifindex
is not valid.getCellBounds
(JList<?> list, int index1, int index2) protected int
protected int
getHeight
(int column, int row) Returns the height of the cell at the passed in location.protected int
getModelIndex
(int column, int row) Returns the model index for the specified display location.protected int
getRowCount
(int column) Returns the number of rows in the given column.indexToLocation
(JList<?> list, int index) protected void
protected void
protected void
void
int
locationToIndex
(JList<?> list, Point location) protected void
If updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded.protected void
Recompute the value of cellHeight or cellHeights based and cellWidth, based on the current font and the current values of fixedCellWidth, fixedCellHeight, and prototypeCellValue.Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, paint, uninstallUI, update
-
Field Details
-
list
-
rendererPane
-
focusListener
-
mouseInputListener
-
listSelectionListener
-
listDataListener
-
propertyChangeListener
-
cellHeights
protected int[] cellHeights -
cellHeight
protected int cellHeight -
cellWidth
protected int cellWidth -
modelChanged
protected static final int modelChanged- See Also:
-
selectionModelChanged
protected static final int selectionModelChanged- See Also:
-
fontChanged
protected static final int fontChanged- See Also:
-
fixedCellWidthChanged
protected static final int fixedCellWidthChanged- See Also:
-
fixedCellHeightChanged
protected static final int fixedCellHeightChanged- See Also:
-
prototypeCellValueChanged
protected static final int prototypeCellValueChanged- See Also:
-
cellRendererChanged
protected static final int cellRendererChanged- See Also:
-
layoutOrientationChanged
protected static final int layoutOrientationChanged- See Also:
-
heightChanged
protected static final int heightChanged- See Also:
-
widthChanged
protected static final int widthChanged- See Also:
-
componentOrientationChanged
protected static final int componentOrientationChanged- See Also:
-
updateLayoutStateNeeded
protected int updateLayoutStateNeeded -
layoutOrientation
protected int layoutOrientation -
listHeight
protected int listHeight -
listWidth
protected int listWidth -
columnCount
protected int columnCount -
preferredHeight
protected int preferredHeight -
rowsPerColumn
protected int rowsPerColumn -
timeFactor
protected long timeFactor -
isFileList
protected boolean isFileList -
isLeftToRight
protected boolean isLeftToRight
-
-
Constructor Details
-
YListUI
public YListUI()
-
-
Method Details
-
locationToIndex
- Specified by:
locationToIndex
in classListUI
-
indexToLocation
- Specified by:
indexToLocation
in classListUI
-
getCellBounds
- Specified by:
getCellBounds
in classListUI
-
getViewModel
-
getElementCount
protected int getElementCount() -
installUI
Initializes
super.list
withJComponent c
by calling protected void installDefaults() protected void installListeners() protected void installKeyboardActions()- Overrides:
installUI
in classComponentUI
-
installDefaults
protected void installDefaults() -
installListeners
protected void installListeners() -
installKeyboardActions
protected void installKeyboardActions() -
getCellBounds
Gets the bounds of the specified model index, returning the resulting bounds, or null ifindex
is not valid.- Parameters:
list
- JListindex
- int- Returns:
- Rectangle
-
convertLocationToRow
protected int convertLocationToRow(int x, int y0, boolean closest) Returns the row at location x/y.- Parameters:
x
- inty0
- intclosest
- If true and the location doesn't exactly match a particular location, this will return the closest row.- Returns:
- int row at location x/y
-
convertLocationToColumn
protected int convertLocationToColumn(int x, int y) Returns the closest column to the passed in location. -
getModelIndex
protected int getModelIndex(int column, int row) Returns the model index for the specified display location. Ifcolumn
xrow
is beyond the length of the model, this will return the model size - 1. -
convertModelToRow
protected int convertModelToRow(int index) Returns the row that the model indexindex
will be displayed in. -
convertModelToColumn
protected int convertModelToColumn(int index) Returns the column that the model indexindex
will be displayed in. -
getHeight
protected int getHeight(int column, int row) Returns the height of the cell at the passed in location. -
maybeUpdateLayoutState
protected void maybeUpdateLayoutState()If updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded. This method should be called by methods before doing any computation based on the geometry of the list. For example it's the first call in paint() and getPreferredSize().- See Also:
-
updateLayoutState
protected void updateLayoutState()Recompute the value of cellHeight or cellHeights based and cellWidth, based on the current font and the current values of fixedCellWidth, fixedCellHeight, and prototypeCellValue.- See Also:
-
convertYToRow
protected int convertYToRow(int y0) - See Also:
-
convertRowToY
protected int convertRowToY(int row) - See Also:
-
getRowCount
protected int getRowCount(int column) Returns the number of rows in the given column.
-