Package com.jidesoft.hints
Class FileIntelliHints
java.lang.Object
com.jidesoft.hints.AbstractIntelliHints
com.jidesoft.hints.AbstractListIntelliHints
com.jidesoft.hints.FileIntelliHints
- All Implemented Interfaces:
IntelliHints
FileIntelliHints
is a concrete implementation of IntelliHints
.
It allows user to type in a file patch quickly by providing them the hints based on what
is existed on file system. You can use setFolderOnly(boolean)
to control if
the hints contain only the folders, or folders and files.-
Field Summary
Fields inherited from class com.jidesoft.hints.AbstractListIntelliHints
_keyStrokes
Fields inherited from interface com.jidesoft.hints.IntelliHints
CLIENT_PROPERTY_INTELLI_HINTS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
acceptHint
(Object selected) After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint.Get FilenameFilter configured to this hints.boolean
If the hints contain the folder names only.boolean
If the hints contain the full path.void
setFilter
(FilenameFilter filter) Set FilenameFilter to this hints.void
setFolderOnly
(boolean folderOnly) Sets the property of folder only.void
setShowFullPath
(boolean showFullPath) Sets the property of showing full path.boolean
updateHints
(Object value) Update hints depending on the context.Methods inherited from class com.jidesoft.hints.AbstractListIntelliHints
createHintsComponent, createList, getDelegateComponent, getDelegateKeyStrokes, getList, getSelectedHint, setListData, setListData
Methods inherited from class com.jidesoft.hints.AbstractIntelliHints
addShowHintsKeyStroke, createPopup, getAllShowHintsKeyStrokes, getCaretPositionForPopup, getCaretRectangleForPopup, getContext, getIntelliHints, getShowHintsDelay, getShowHintsKeyStroke, getTextComponent, hideHintsPopup, isAutoPopup, isFollowCaret, isHintsPopupVisible, isMultilineTextComponent, removeShowHintsKeyStroke, setAutoPopup, setFollowCaret, setHintsEnabled, setShowHintsDelay, showHints, showHintsPopup, updateHints
-
Constructor Details
-
FileIntelliHints
-
-
Method Details
-
isFolderOnly
public boolean isFolderOnly()If the hints contain the folder names only.- Returns:
- true if the hints contain the folder names only.
-
setFolderOnly
public void setFolderOnly(boolean folderOnly) Sets the property of folder only. If true, the hints will only show the folder names. Otherwise, both folder and file names will be shown in the hints.- Parameters:
folderOnly
- only provide hints for the folders.
-
isShowFullPath
public boolean isShowFullPath()If the hints contain the full path.- Returns:
- true if the hints contain the full path.
-
setShowFullPath
public void setShowFullPath(boolean showFullPath) Sets the property of showing full path. If true, the hints will show the full path. Otherwise, it will only show the path after user typed in so far.- Parameters:
showFullPath
- whether show the full path.
-
updateHints
Description copied from interface:IntelliHints
Update hints depending on the context. This method will be triggered for every key typed event in the text component. Subclass can override it to provide your own list of hints and call setListData to set it and returns true after that.- Specified by:
updateHints
in interfaceIntelliHints
- Overrides:
updateHints
in classAbstractIntelliHints
- Parameters:
value
- the current context- Returns:
- true or false. If it is false, hint popup will not be shown.
-
acceptHint
Description copied from class:AbstractIntelliHints
After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint. For JTextArea, the default implementation will insert the hint into current caret position. For JTextField, by default it will replace the whole content with the item user selected. Subclass can always choose to override it to accept the hint in a different way. For example,FileIntelliHints
will append the selected item at the end of the existing text in order to complete a full file path.- Specified by:
acceptHint
in interfaceIntelliHints
- Overrides:
acceptHint
in classAbstractIntelliHints
- Parameters:
selected
- the hint to be accepted.
-
getFilter
Get FilenameFilter configured to this hints. By default, it returns null. You could set this field to let the IntelliHints only show the files meet your criteria.- Returns:
- the FilenameFilter in use.
-
setFilter
Set FilenameFilter to this hints.- Parameters:
filter
- the FilenameFilter in use.- See Also:
-