Class 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.
  • Constructor Details

  • 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

      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.
      Specified by:
      updateHints in interface IntelliHints
      Overrides:
      updateHints in class AbstractIntelliHints
      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: