Class FastListUI


class FastListUI extends BasicListUI
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
  • Field Details

    • 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:
  • Constructor Details

    • FastListUI

      FastListUI()
  • Method Details

    • determineSelectionBackground

      private Color determineSelectionBackground()
    • determineSelectionForeground

      private 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:
      installDefaults in class BasicListUI
    • uninstallDefaults

      protected void uninstallDefaults()
      Overridden to work around a Nimbus issue.
      Overrides:
      uninstallDefaults in class 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:
      updateLayoutState in class BasicListUI