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
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
FieldsFields inherited from interface com.jidesoft.hints.IntelliHints
CLIENT_PROPERTY_INTELLI_HINTS
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractListIntelliHints
(JTextComponent textComponent) Creates a Completion for JTextComponent -
Method Summary
Modifier and TypeMethodDescriptionCreates the component which contains hints.protected JList
Creates the list to display the hints.Gets the delegate component in the hint popup.Gets the delegate keystrokes.protected JList
getList()
Gets the list.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, updateHints, updateHints
-
Field Details
-
_keyStrokes
-
-
Constructor Details
-
AbstractListIntelliHints
Creates a Completion for JTextComponent- Parameters:
textComponent
-
-
-
Method Details
-
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
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 invalid input: '<' 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
Gets the list.- Returns:
- the list.
-
setListData
Sets the list data.- Parameters:
objects
-
-
setListData
Sets the list data.- Parameters:
objects
-
-
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
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
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.
-