JIDE 3.5.15

com.jidesoft.hints
Class FileIntelliHints

java.lang.Object
  extended by com.jidesoft.hints.AbstractIntelliHints
      extended by com.jidesoft.hints.AbstractListIntelliHints
          extended by com.jidesoft.hints.FileIntelliHints
All Implemented Interfaces:
IntelliHints

public class FileIntelliHints
extends AbstractListIntelliHints

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
FileIntelliHints(JTextComponent comp)
           
 
Method Summary
 void acceptHint(Object selected)
          After user has selected a item in the hints popup, this method will update JTextComponent accordingly to accept the hint.
 FilenameFilter getFilter()
          Get FilenameFilter configured to this hints.
 boolean isFolderOnly()
          If the hints contain the folder names only.
 boolean isShowFullPath()
          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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileIntelliHints

public FileIntelliHints(JTextComponent comp)
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(Object value)
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.

Parameters:
value - the current context
Returns:
true or false. If it is false, hint popup will not be shown.

acceptHint

public void acceptHint(Object selected)
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 interface IntelliHints
Overrides:
acceptHint in class AbstractIntelliHints
Parameters:
selected - the hint to be accepted.

getFilter

public 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(FilenameFilter filter)
Set FilenameFilter to this hints.

Parameters:
filter - the FilenameFilter in use.
See Also:
getFilter()

JIDE 3.5.15