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
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 javax.swing.plaf.basic.BasicListUI
BasicListUI.FocusHandler, BasicListUI.ListDataHandler, BasicListUI.ListSelectionHandler, BasicListUI.MouseInputHandler, BasicListUI.PropertyChangeHandler
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
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.private boolean
Whether the selection background was overridden (usually because of Nimbus) so we know to manually uninstall the color we installed.private boolean
Whether 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 -
Method Summary
Modifier and TypeMethodDescriptionprivate Color
private Color
protected void
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 void
Overridden to work around a Nimbus issue.protected void
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
Methods inherited from class javax.swing.plaf.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:
installDefaults
in classBasicListUI
-
uninstallDefaults
protected void uninstallDefaults()Overridden to work around a Nimbus issue.- Overrides:
uninstallDefaults
in 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:
updateLayoutState
in classBasicListUI
-