Package com.jidesoft.hints
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 interfaceIntelliHints
. 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
Fields Modifier and Type Field Description protected javax.swing.KeyStroke[]
_keyStrokes
-
Fields inherited from interface com.jidesoft.hints.IntelliHints
CLIENT_PROPERTY_INTELLI_HINTS
-
-
Constructor Summary
Constructors Constructor Description AbstractListIntelliHints(javax.swing.text.JTextComponent textComponent)
Creates a Completion for JTextComponent
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.swing.JComponent
createHintsComponent()
Creates the component which contains hints.protected javax.swing.JList
createList()
Creates the list to display the hints.javax.swing.JComponent
getDelegateComponent()
Gets the delegate component in the hint popup.javax.swing.KeyStroke[]
getDelegateKeyStrokes()
Gets the delegate keystrokes.protected javax.swing.JList
getList()
Gets the list.java.lang.Object
getSelectedHint()
Gets the selected value.protected void
setListData(java.lang.Object[] objects)
Sets the list data.protected void
setListData(java.util.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, updateHints, updateHints
-
-
-
-
Method Detail
-
createHintsComponent
public javax.swing.JComponent createHintsComponent()
Description copied from interface:IntelliHints
Creates the component which contains hints. At this moment, the content should be empty. Following callIntelliHints.updateHints(Object, boolean)
will update the content.- Returns:
- the component which will be used to display the hints.
-
createList
protected javax.swing.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 javax.swing.JList getList()
Gets the list.- Returns:
- the list.
-
setListData
protected void setListData(java.lang.Object[] objects)
Sets the list data.- Parameters:
objects
-
-
setListData
protected void setListData(java.util.Vector<?> objects)
Sets the list data.- Parameters:
objects
-
-
getSelectedHint
public java.lang.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 javax.swing.JComponent getDelegateComponent()
Description copied from class:AbstractIntelliHints
Gets the delegate component in the hint popup.- Specified by:
getDelegateComponent
in classAbstractIntelliHints
- Returns:
- the component that will receive the keystrokes that are delegated to hint popup.
-
getDelegateKeyStrokes
public javax.swing.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 classAbstractIntelliHints
- Returns:
- the keystrokes that will be delegated to the JList when hints popup is visible.
-
-