Class AbstractListIntelliHints

java.lang.Object
com.jidesoft.hints.AbstractIntelliHints
com.jidesoft.hints.AbstractListIntelliHints
All Implemented Interfaces:
IntelliHints
Direct Known Subclasses:
FileIntelliHints, ListDataIntelliHints

public abstract class AbstractListIntelliHints extends AbstractIntelliHints
AbstractListIntelliHints extends AbstractIntelliHints and further implement most of the methods in interface IntelliHints. In this class, it assumes the hints can be represented as a JList, so it used JList in the hints popup.
Author:
Santhosh Kumar T - santhosh@in.fiorano.com, JIDE Software, Inc.
  • Field Details

    • _keyStrokes

      protected KeyStroke[] _keyStrokes
  • Constructor Details

    • AbstractListIntelliHints

      public AbstractListIntelliHints(JTextComponent textComponent)
      Creates a Completion for JTextComponent
      Parameters:
      textComponent -
  • Method Details

    • createHintsComponent

      public JComponent createHintsComponent()
      Description copied from interface: IntelliHints
      Creates the component which contains hints. At this moment, the content should be empty. Following call IntelliHints.updateHints(Object, boolean) will update the content.
      Returns:
      the component which will be used to display the hints.
    • createList

      protected JList createList()
      Creates the list to display the hints. By default, we create a JList using the code below.
       return new JList() {
           public int getVisibleRowCount() {
               int size = getModel().getSize();
               return size < super.getVisibleRowCount() ? size : super.getVisibleRowCount();
           }
       

      public Dimension getPreferredScrollableViewportSize() { if (getModel().getSize() == 0) { return new Dimension(0, 0); } else { return super.getPreferredScrollableViewportSize(); } } };

      Returns:
      the list.
    • getList

      protected JList getList()
      Gets the list.
      Returns:
      the list.
    • setListData

      protected void setListData(Object[] objects)
      Sets the list data.
      Parameters:
      objects -
    • setListData

      protected void setListData(Vector<?> objects)
      Sets the list data.
      Parameters:
      objects -
    • getSelectedHint

      public Object getSelectedHint()
      Description copied from interface: IntelliHints
      Gets the selected value. This value will be used to complete the text component.
      Returns:
      the selected value.
    • getDelegateComponent

      public JComponent getDelegateComponent()
      Description copied from class: AbstractIntelliHints
      Gets the delegate component in the hint popup.
      Specified by:
      getDelegateComponent in class AbstractIntelliHints
      Returns:
      the component that will receive the keystrokes that are delegated to hint popup.
    • getDelegateKeyStrokes

      public KeyStroke[] getDelegateKeyStrokes()
      Gets the delegate keystrokes. Since we know the hints popup is a JList, we return eight keystrokes so that they can be delegate to the JList. Those keystrokes are DOWN, UP, PAGE_DOWN, PAGE_UP, HOME and END.
      Specified by:
      getDelegateKeyStrokes in class AbstractIntelliHints
      Returns:
      the keystrokes that will be delegated to the JList when hints popup is visible.