Class FPMIFileUtilities


  • public class FPMIFileUtilities
    extends ClientFileUtilities
    These are the file utilities that have a GUI element.
    • Constructor Summary

      Constructors 
      Constructor Description
      FPMIFileUtilities​(java.awt.Component parent)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String openFile()
      Shows the open file dialog box with no file extension restrictions.
      static java.lang.String openFile​(java.awt.Component parent, java.lang.String extension)
      Shows the open file dialog box with a file extension filter for the given extension.
      static java.lang.String openFile​(java.awt.Component parent, java.lang.String extension, java.lang.String defaultLocation)
      Shows the open file dialog box with a file extension filter for the given extension.
      java.lang.String openFile​(java.lang.String extension)
      Shows the open file dialog box with a file extension filter for the given extension.
      java.lang.String openFile​(java.lang.String extension, java.lang.String defaultLocation)
      Shows the open file dialog box with a file extension filter for the given extension, at the given location.
      java.lang.String[] openFiles()
      Shows the open file dialog box, allows multiple files to be selected.
      static java.lang.String[] openFiles​(java.awt.Component parent, java.lang.String extension, java.lang.String defaultLocation)
      Shows the open file dialog box with a file extension filter for the given extension, at the given location.
      java.lang.String[] openFiles​(java.lang.String extension)
      Shows the open file dialog box with a file extension filter for the given extension.
      java.lang.String[] openFiles​(java.lang.String extension, java.lang.String defaultLocation)
      Shows the open file dialog box with a file extension filter for the given extension, at the given location.
      java.lang.String saveFile​(java.lang.String filename)
      Asks the user to save a file with the name filename Returns the chosen file's path if the user hits OK
      java.lang.String saveFile​(java.lang.String filename, java.lang.String extension, java.lang.String fileTypeDescription)
      Opens a save as dialog box, and returns the path to the selected file, or None if the dialog was canceled
      static java.lang.String saveToFile​(java.awt.Component parent, java.lang.String filename, java.lang.String extension, java.lang.String fileTypeDescription, ClientFileUtilities.FileWritingTask writer)
      Show a save as dialog box with the given filename as a suggestion.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FPMIFileUtilities

        public FPMIFileUtilities​(java.awt.Component parent)
    • Method Detail

      • saveFile

        public java.lang.String saveFile​(java.lang.String filename)
        Asks the user to save a file with the name filename Returns the chosen file's path if the user hits OK
      • saveFile

        public java.lang.String saveFile​(java.lang.String filename,
                                         java.lang.String extension,
                                         java.lang.String fileTypeDescription)
        Opens a save as dialog box, and returns the path to the selected file, or None if the dialog was canceled
      • saveToFile

        public static java.lang.String saveToFile​(java.awt.Component parent,
                                                  java.lang.String filename,
                                                  java.lang.String extension,
                                                  java.lang.String fileTypeDescription,
                                                  ClientFileUtilities.FileWritingTask writer)
        Show a save as dialog box with the given filename as a suggestion. If save is selected, the FileWritingTask will be invoked to write to the file
        Returns:
        The path to the saved file, or null if the action failed or was canceled.
      • openFile

        public java.lang.String openFile()
        Shows the open file dialog box with no file extension restrictions.
        Returns:
        A string representing the path to the selected file, or None if cancelled.
      • openFile

        public java.lang.String openFile​(java.lang.String extension)
        Shows the open file dialog box with a file extension filter for the given extension.
        Parameters:
        extension - a filename extension, like "pdf", without the prepending period.
        Returns:
        A string representing the path to the selected file, or None if cancelled.
      • openFile

        public java.lang.String openFile​(java.lang.String extension,
                                         java.lang.String defaultLocation)
        Shows the open file dialog box with a file extension filter for the given extension, at the given location.
        Parameters:
        extension - a filename extension, like "pdf", without the prepending period.
        defaultLocation - the default folder location to open with the file chooser.
        Returns:
        A string representing the path to the selected file, or None if cancelled.
      • openFile

        public static java.lang.String openFile​(java.awt.Component parent,
                                                java.lang.String extension)
        Shows the open file dialog box with a file extension filter for the given extension.
        Parameters:
        parent - The parent component of the dialog box
        extension - a filename extension, like "pdf", without the prepending period.
        Returns:
        A string representing the path to the selected file, or None if cancelled.
      • openFile

        public static java.lang.String openFile​(java.awt.Component parent,
                                                java.lang.String extension,
                                                java.lang.String defaultLocation)
        Shows the open file dialog box with a file extension filter for the given extension.
        Parameters:
        extension - a filename extension, like "pdf", without the prepending period.
        defaultLocation - the full path to a default location to open the dialog with.
        Returns:
        A string representing the path(s) to the selected file(s), or None if cancelled.
      • openFiles

        public java.lang.String[] openFiles()
        Shows the open file dialog box, allows multiple files to be selected.
        Returns:
        A list of the the path(s) to the selected file(s), or None if cancelled.
      • openFiles

        public java.lang.String[] openFiles​(java.lang.String extension)
        Shows the open file dialog box with a file extension filter for the given extension. Allows multiple files to be selected.
        Parameters:
        extension - a filename extension, like "pdf", without the prepending period.
        Returns:
        A list of the the path(s) to the selected file(s), or None if cancelled.
      • openFiles

        public java.lang.String[] openFiles​(java.lang.String extension,
                                            java.lang.String defaultLocation)
        Shows the open file dialog box with a file extension filter for the given extension, at the given location. Allows multiple files to be selected.
        Parameters:
        extension - a filename extension, like "pdf", without the prepending period.
        defaultLocation - the default folder location to open with the file chooser.
        Returns:
        A list of the the path(s) to the selected file(s), or None if cancelled.
      • openFiles

        public static java.lang.String[] openFiles​(java.awt.Component parent,
                                                   java.lang.String extension,
                                                   java.lang.String defaultLocation)
        Shows the open file dialog box with a file extension filter for the given extension, at the given location. Allows multiple files to be selected.
        Parameters:
        parent - The parent component of the dialog box
        extension - a filename extension, like "pdf", without the prepending period.
        defaultLocation - the default folder location to open with the file chooser.
        Returns:
        A list of the the path(s) to the selected file(s), or None if cancelled.