Class DirectoryChooserFactory


  • public class DirectoryChooserFactory
    extends Object
    Factor for instantiating directory choosers.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • CANCEL_OPTION

        public static final int CANCEL_OPTION
        Return value if cancel is chosen.
        See Also:
        Constant Field Values
      • APPROVE_OPTION

        public static final int APPROVE_OPTION
        Return value if approve (yes, ok) is chosen.
        See Also:
        Constant Field Values
      • ERROR_OPTION

        public static final int ERROR_OPTION
        Return value if an error occurred.
        See Also:
        Constant Field Values
      • FILES_ONLY

        public static final int FILES_ONLY
        Instruction to display only files.
        See Also:
        Constant Field Values
      • DIRECTORIES_ONLY

        public static final int DIRECTORIES_ONLY
        Instruction to display only directories.
        See Also:
        Constant Field Values
      • FILES_AND_DIRECTORIES

        public static final int FILES_AND_DIRECTORIES
        Instruction to display both files and directories.
        See Also:
        Constant Field Values
      • CANCEL_SELECTION

        public static final String CANCEL_SELECTION
        Instruction to cancel the current selection.
        See Also:
        Constant Field Values
      • APPROVE_SELECTION

        public static final String APPROVE_SELECTION
        Instruction to approve the current selection (same as pressing yes or ok).
        See Also:
        Constant Field Values
    • Constructor Detail

      • DirectoryChooserFactory

        public DirectoryChooserFactory()
    • Method Detail

      • createChooser

        public static FileChooser createChooser()
        Returns a directory chooser instance with the user's default directory as initial directory.
        Returns:
        the chooser
      • createChooser

        public static FileChooser createChooser​(String initialDir)
        Returns a directory chooser instance with the specified initial directory.
        Parameters:
        initialDir - the initial directory to use
        Returns:
        the chooser
      • createChooser

        public static FileChooser createChooser​(File initialDir)
        Returns a directory chooser instance with the specified initial directory.
        Parameters:
        initialDir - the initial directory to use
        Returns:
        the chooser
      • getSelectedDirectory

        public static PlaceholderDirectory getSelectedDirectory​(FileChooser chooser)
        Retrieves the current directory as PlaceholderDirectory from the chooser.
        Parameters:
        chooser - the chooser to obtain the current dir from
        Returns:
        the dir, null if not available