JIDE 3.5.15

com.jidesoft.hints
Class AbstractListIntelliHints

java.lang.Object
  extended by com.jidesoft.hints.AbstractIntelliHints
      extended by 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 Summary
protected  KeyStroke[] _keyStrokes
           
 
Fields inherited from interface com.jidesoft.hints.IntelliHints
CLIENT_PROPERTY_INTELLI_HINTS
 
Constructor Summary
AbstractListIntelliHints(JTextComponent textComponent)
          Creates a Completion for JTextComponent
 
Method Summary
 JComponent createHintsComponent()
          Creates the component which contains hints.
protected  JList createList()
          Creates the list to display the hints.
 JComponent getDelegateComponent()
          Gets the delegate component in the hint popup.
 KeyStroke[] getDelegateKeyStrokes()
          Gets the delegate keystrokes.
protected  JList getList()
          Gets the list.
 Object getSelectedHint()
          Gets the selected value.
protected  void setListData(Object[] objects)
          Sets the list data.
protected  void setListData(Vector<?> objects)
          Sets the list data.
 
Methods inherited from class com.jidesoft.hints.AbstractIntelliHints
acceptHint, addShowHintsKeyStroke, createPopup, getAllShowHintsKeyStrokes, getCaretPositionForPopup, getCaretRectangleForPopup, getContext, getIntelliHints, getShowHintsDelay, getShowHintsKeyStroke, getTextComponent, hideHintsPopup, isAutoPopup, isFollowCaret, isHintsPopupVisible, isMultilineTextComponent, removeShowHintsKeyStroke, setAutoPopup, setFollowCaret, setHintsEnabled, setShowHintsDelay, showHints, showHintsPopup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jidesoft.hints.IntelliHints
updateHints
 

Field Detail

_keyStrokes

protected KeyStroke[] _keyStrokes
Constructor Detail

AbstractListIntelliHints

public AbstractListIntelliHints(JTextComponent textComponent)
Creates a Completion for JTextComponent

Parameters:
textComponent -
Method Detail

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) 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.

JIDE 3.5.15