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
public class FileIntelliHints extends AbstractListIntelliHints
FileIntelliHintsis a concrete implementation ofIntelliHints. 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 usesetFolderOnly(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 Constructor Description FileIntelliHints(javax.swing.text.JTextComponent comp)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidacceptHint(java.lang.Object selected)After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint.java.io.FilenameFiltergetFilter()Get FilenameFilter configured to this hints.booleanisFolderOnly()If the hints contain the folder names only.booleanisShowFullPath()If the hints contain the full path.voidsetFilter(java.io.FilenameFilter filter)Set FilenameFilter to this hints.voidsetFolderOnly(boolean folderOnly)Sets the property of folder only.voidsetShowFullPath(boolean showFullPath)Sets the property of showing full path.booleanupdateHints(java.lang.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
-
-
-
-
Method Detail
-
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
public boolean updateHints(java.lang.Object value)
Description copied from interface:IntelliHintsUpdate 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:
updateHintsin interfaceIntelliHints- Overrides:
updateHintsin classAbstractIntelliHints- Parameters:
value- the current context- Returns:
- true or false. If it is false, hint popup will not be shown.
-
acceptHint
public void acceptHint(java.lang.Object selected)
Description copied from class:AbstractIntelliHintsAfter 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,FileIntelliHintswill append the selected item at the end of the existing text in order to complete a full file path.- Specified by:
acceptHintin interfaceIntelliHints- Overrides:
acceptHintin classAbstractIntelliHints- Parameters:
selected- the hint to be accepted.
-
getFilter
public java.io.FilenameFilter 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
public void setFilter(java.io.FilenameFilter filter)
Set FilenameFilter to this hints.- Parameters:
filter- the FilenameFilter in use.- See Also:
getFilter()
-
-