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 intprotected int[]protected static final intprotected intprotected intprotected static final intprotected static final intprotected static final intprotected FocusListenerprotected static final intprotected static final intprotected booleanprotected booleanprotected intprotected static final intprotected ListDataListenerprotected intprotected ListSelectionListenerprotected intprotected static final intprotected MouseInputListenerprotected intprotected PropertyChangeListenerprotected static final intprotected CellRendererPaneprotected intprotected static final intprotected longprotected intprotected static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intconvertLocationToColumn(int x, int y) Returns the closest column to the passed in location.protected intconvertLocationToRow(int x, int y0, boolean closest) Returns the row at location x/y.protected intconvertModelToColumn(int index) Returns the column that the model indexindexwill be displayed in.protected intconvertModelToRow(int index) Returns the row that the model indexindexwill be displayed in.protected intconvertRowToY(int row) protected intconvertYToRow(int y0) protected RectanglegetCellBounds(JList<?> list, int index) Gets the bounds of the specified model index, returning the resulting bounds, or null ifindexis not valid.getCellBounds(JList<?> list, int index1, int index2) protected intprotected intgetHeight(int column, int row) Returns the height of the cell at the passed in location.protected intgetModelIndex(int column, int row) Returns the model index for the specified display location.protected intgetRowCount(int column) Returns the number of rows in the given column.indexToLocation(JList<?> list, int index) protected voidprotected voidprotected voidvoidintlocationToIndex(JList<?> list, Point location) protected voidIf updateLayoutStateNeeded is non zero, call updateLayoutState() and reset updateLayoutStateNeeded.protected voidRecompute 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:
locationToIndexin classListUI
-
indexToLocation
- Specified by:
indexToLocationin classListUI
-
getCellBounds
- Specified by:
getCellBoundsin classListUI
-
getViewModel
-
getElementCount
protected int getElementCount() -
installUI
Initializes
super.listwithJComponent cby calling protected void installDefaults() protected void installListeners() protected void installKeyboardActions()- Overrides:
installUIin 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 ifindexis 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. Ifcolumnxrowis 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 indexindexwill be displayed in. -
convertModelToColumn
protected int convertModelToColumn(int index) Returns the column that the model indexindexwill 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.
-