Class FastListUI
java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
javax.swing.plaf.basic.BasicListUI
org.fife.ui.autocomplete.FastListUI
A 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
as
CompletionCellRenderer), 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 BasicListUI
BasicListUI.FocusHandler, BasicListUI.ListDataHandler, BasicListUI.ListSelectionHandler, BasicListUI.MouseInputHandler, BasicListUI.PropertyChangeHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intIf 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 booleanWhether the selection background was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.private booleanWhether the selection foreground was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.Fields inherited from class BasicListUI
cellHeight, cellHeights, cellRendererChanged, cellWidth, fixedCellHeightChanged, fixedCellWidthChanged, focusListener, fontChanged, list, listDataListener, listSelectionListener, modelChanged, mouseInputListener, propertyChangeListener, prototypeCellValueChanged, rendererPane, selectionModelChanged, updateLayoutStateNeeded -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate Colorprivate Colorprotected voidOverridden 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 voidOverridden to work around a Nimbus issue.protected voidRecalculates the cell width and height of each cell in the list.Methods inherited from class 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, uninstallUIMethods inherited from class ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
-
Field Details
-
overriddenBackground
private boolean overriddenBackgroundWhether the selection background was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed. -
overriddenForeground
private boolean overriddenForegroundWhether 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_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.- See Also:
-
-
Constructor Details
-
FastListUI
FastListUI()
-
-
Method Details
-
determineSelectionBackground
-
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 classBasicListUI
-
uninstallDefaults
protected void uninstallDefaults()Overridden to work around a Nimbus issue.- Overrides:
uninstallDefaultsin classBasicListUI
-
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 classBasicListUI
-