Package org.cytoscape.util.swing
Interface FileUtil
public interface FileUtil
Provides a platform-dependent way to open files. Mainly
because Mac would prefer that you use java.awt.FileDialog
instead of the Swing FileChooser.
Module: swing-util-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>swing-util-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Equal to FileDialog.LOAD + FileDialog.SAVE.static final String
Deprecated.static final int
Equal to FileDialog.LOAD.static final int
Equal to FileDialog.SAVE.static final String
A string that defines a simplified java regular expression for a URL. -
Method Summary
Modifier and TypeMethodDescriptiongetFile
(Component parent, String title, int loadSaveCustom, String startDir, String fileName, String customApproveText, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.getFile
(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.getFile
(Component parent, String title, int loadSaveCustom, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.File[]
getFiles
(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, boolean multiselect, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.File[]
getFiles
(Component parent, String title, int loadSaveCustom, String startDir, String fileName, String customApproveText, boolean multiselect, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.File[]
getFiles
(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.File[]
getFiles
(Component parent, String title, int loadSaveCustom, Collection<FileChooserFilter> filters) Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.Returns a File object representing a folder, this method should be used instead of rolling your own JFileChooser.
-
Field Details
-
LAST_DIRECTORY
Deprecated.The Cytoscape property that stores the last save/load directory.- See Also:
-
LOAD
static final int LOADEqual to FileDialog.LOAD.- See Also:
-
SAVE
static final int SAVEEqual to FileDialog.SAVE.- See Also:
-
CUSTOM
static final int CUSTOMEqual to FileDialog.LOAD + FileDialog.SAVE.- See Also:
-
urlPattern
A string that defines a simplified java regular expression for a URL. This may need to be updated to be more precise.- See Also:
-
-
Method Details
-
getFile
File getFile(Component parent, String title, int loadSaveCustom, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogfilters
- a non-empty collection of file filters- Returns:
- the location of the selected file
-
getFile
File getFile(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogstartDir
- an alternate start dir, if null the default Cytoscape MUD will be usedcustomApproveText
- if this is a custom dialog, then custom text should be on the approve button.filters
- a non-empty collection of file filters- Returns:
- the location of the selected file
-
getFile
File getFile(Component parent, String title, int loadSaveCustom, String startDir, String fileName, String customApproveText, Collection<FileChooserFilter> filters) Returns a File object, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogstartDir
- an alternate start dir, if null the default Cytoscape MUD will be usedfileName
- a suggested file name to usecustomApproveText
- if this is a custom dialog, then custom text should be on the approve button.filters
- a non-empty collection of file filters- Returns:
- the location of the selected file
-
getFiles
File[] getFiles(Component parent, String title, int loadSaveCustom, Collection<FileChooserFilter> filters) Returns an array of File objects, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogfilters
- a non-empty collection of file filters- Returns:
- the location of the selected file
-
getFiles
File[] getFiles(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogstartDir
- an alternate start dir, if null the default Cytoscape MUD will be usedcustomApproveText
- if this is a custom dialog, then custom text should be on the approve button.filters
- a non-empty collection of file filters- Returns:
- and array of selected files, or null if none are selected
-
getFiles
File[] getFiles(Component parent, String title, int loadSaveCustom, String startDir, String customApproveText, boolean multiselect, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogstartDir
- an alternate start dir, if null the default cytoscape MUD will be usedcustomApproveText
- if this is a custom dialog, then custom text should be on the approve button.multiselect
- Enable selection of multiple files (Macs are still limited to a single file because we use FileDialog there -- is this fixed in Java 1.5?)filters
- a non-empty collection of file filters- Returns:
- and array of selected files, or null if none are selected
-
getFiles
File[] getFiles(Component parent, String title, int loadSaveCustom, String startDir, String fileName, String customApproveText, boolean multiselect, Collection<FileChooserFilter> filters) Returns a list of File objects, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxloadSaveCustom
- a flag for the type of file dialogstartDir
- an alternate start dir, if null the default cytoscape MUD will be usedfileName
- a suggested file name to usecustomApproveText
- if this is a custom dialog, then custom text should be on the approve button.multiselect
- Enable selection of multiple files (Macs are still limited to a single file because we use FileDialog there -- is this fixed in Java 1.5?)filters
- a non-empty collection of file filters- Returns:
- and array of selected files, or null if none are selected
-
getFolder
Returns a File object representing a folder, this method should be used instead of rolling your own JFileChooser.- Parameters:
parent
- the parent of the JFileChooser or FileDialogtitle
- the title of the dialog boxstartDir
- an alternate start dir, if null the default Cytoscape MUD will be used- Returns:
- the location of the selected folder
-