Package org.fife.ui.autocomplete
Class FastListUI
- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ListUI
-
- javax.swing.plaf.basic.BasicListUI
-
- org.fife.ui.autocomplete.FastListUI
-
class FastListUI extends javax.swing.plaf.basic.BasicListUIA custom list UI, used by the completion choices list. If the number of completion choices is "large," it does a fast estimate of the preferred width and height of list items. This allows HTML renderers to be used (such asCompletionCellRenderer), with thousands of completion choices, with no performance penalty. With standard BasicListUI subclasses, this can cause very poor performance each time the list is displayed, which is bad for lists that are repeatedly hidden and re-displayed, such as completion choices. This is all because the calculation to get the preferred size of each list item, when it is displayed with HTML, is slow.- Version:
- 1.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicListUI
javax.swing.plaf.basic.BasicListUI.FocusHandler, javax.swing.plaf.basic.BasicListUI.ListDataHandler, javax.swing.plaf.basic.BasicListUI.ListSelectionHandler, javax.swing.plaf.basic.BasicListUI.MouseInputHandler, javax.swing.plaf.basic.BasicListUI.PropertyChangeHandler
-
-
Field Summary
Fields Modifier and Type Field Description private static intESTIMATION_THRESHOLDIf there are more than this many completions in a single list, this UI will estimate the cell width and height needed for each item instead of computing it, for performance reasons.private booleanoverriddenBackgroundWhether the selection background was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.private booleanoverriddenForegroundWhether the selection foreground was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.-
Fields inherited from class javax.swing.plaf.basic.BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded
-
-
Constructor Summary
Constructors Constructor Description FastListUI()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.ColordetermineSelectionBackground()private java.awt.ColordetermineSelectionForeground()protected voidinstallDefaults()Overridden to ensure we have selection background/foreground colors defined, even if we're in some weirdo LAF such as Nimbus which doesn't define them.protected voiduninstallDefaults()Overridden to work around a Nimbus issue.protected voidupdateLayoutState()Recalculates the cell width and height of each cell in the list.-
Methods inherited from class javax.swing.plaf.basic.BasicListUI
convertRowToY, convertYToRow, createFocusListener, createListDataListener, createListSelectionListener, createMouseInputListener, createPropertyChangeListener, createUI, getBaseline, getBaselineResizeBehavior, getCellBounds, getPreferredSize, getRowHeight, indexToLocation, installKeyboardActions, installListeners, installUI, locationToIndex, maybeUpdateLayoutState, paint, paintCell, selectNextIndex, selectPreviousIndex, uninstallKeyboardActions, uninstallListeners, uninstallUI
-
-
-
-
Field Detail
-
overriddenBackground
private boolean overriddenBackground
Whether the selection background was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.
-
overriddenForeground
private boolean overriddenForeground
Whether the selection foreground was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.
-
ESTIMATION_THRESHOLD
private static final int ESTIMATION_THRESHOLD
If there are more than this many completions in a single list, this UI will estimate the cell width and height needed for each item instead of computing it, for performance reasons.- See Also:
- Constant Field Values
-
-
Method Detail
-
determineSelectionBackground
private java.awt.Color determineSelectionBackground()
-
determineSelectionForeground
private java.awt.Color determineSelectionForeground()
-
installDefaults
protected void installDefaults()
Overridden to ensure we have selection background/foreground colors defined, even if we're in some weirdo LAF such as Nimbus which doesn't define them. Since FastListUI extends BasicListUI, we need these values to be defined.- Overrides:
installDefaultsin classjavax.swing.plaf.basic.BasicListUI
-
uninstallDefaults
protected void uninstallDefaults()
Overridden to work around a Nimbus issue.- Overrides:
uninstallDefaultsin classjavax.swing.plaf.basic.BasicListUI
-
updateLayoutState
protected void updateLayoutState()
Recalculates the cell width and height of each cell in the list. This method is overridden to do a fast estimation if the completion list is too long, to improve performance for lists with huge amounts of completions.- Overrides:
updateLayoutStatein classjavax.swing.plaf.basic.BasicListUI
-
-