public class FileManager
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
FileManager.ExtFilter
A
FileFilter extension that allows specifiying
an extension and description. |
static class |
FileManager.MyFileChooser
Have our own class here so it can put the hook in
to fix the lock up problem on windows.
|
static class |
FileManager.NetcdfExtFilter
A
FileFilter extension for netCDF files. |
Modifier and Type | Field and Description |
---|---|
static PatternFileFilter |
FILTER_ANIMATEDGIF
Filter for QuickTime files
|
static PatternFileFilter |
FILTER_AVI
Filter for QuickTime files
|
static PatternFileFilter |
FILTER_CSV
Filter for CSV files
|
static PatternFileFilter |
FILTER_IMAGE
Filter for Image files
|
static PatternFileFilter |
FILTER_IMAGE_OR_PDF
Filter for image or pdf files
|
static PatternFileFilter |
FILTER_IMAGEWRITE
Filter for Image files for writing
|
static PatternFileFilter |
FILTER_JAR
File filter used for bundle files
|
static PatternFileFilter |
FILTER_JPG
Filter for JPEG files
|
static PatternFileFilter |
FILTER_KML
Filter for xls files
|
static PatternFileFilter |
FILTER_KMZ
Filter for kmz files
|
static PatternFileFilter |
FILTER_LOG
Filter for log files
|
static PatternFileFilter |
FILTER_MOV
Filter for QuickTime files
|
static PatternFileFilter |
FILTER_MP4
File filter for MPEG-4 files.
|
static PatternFileFilter |
FILTER_NETCDF
Filter for netCDF files
|
static PatternFileFilter |
FILTER_SHP |
static PatternFileFilter |
FILTER_TXT
Filter for Text files
|
static PatternFileFilter |
FILTER_XLS
Filter for xls files
|
static PatternFileFilter |
FILTER_XML
Filter for XML files
|
static PatternFileFilter |
FILTER_ZIP
Filter for ZIP files
|
static java.lang.String |
NULL_BTNTEXT
null button text intrinsic
|
static java.lang.String |
NULL_STRING
null string intrinsic
|
static java.lang.String |
NULL_TITLE
null title intrinsic
|
static java.lang.String |
PROP_DIR_HISTORY
Property in the store for the history list
|
static java.lang.String |
PROP_DIRECTORY
Property in the store for the last dir
|
static java.lang.String |
SUFFIX_AVI
_more_
|
static java.lang.String |
SUFFIX_CSV
Suffix for CSV files
|
static java.lang.String |
SUFFIX_GIF
Suffix for GIF files
|
static java.lang.String |
SUFFIX_JAR
Suffix for JAR files
|
static java.lang.String |
SUFFIX_JPG
Suffix for JPEG files
|
static java.lang.String |
SUFFIX_KML
Suffix for CSV files
|
static java.lang.String |
SUFFIX_KMZ
Suffix for CSV files
|
static java.lang.String |
SUFFIX_LOG
Suffix for log files
|
static java.lang.String |
SUFFIX_MOV
Suffix for Quicktime files
|
static java.lang.String |
SUFFIX_MP4
Suffix for MPEG-4 files.
|
static java.lang.String |
SUFFIX_NETCDF
Suffix for netCDF files
|
static java.lang.String |
SUFFIX_PNG
Suffix for PNG files
|
static java.lang.String |
SUFFIX_SHP
Suffix for JAR files
|
static java.lang.String |
SUFFIX_TXT
Suffix for CSV files
|
static java.lang.String |
SUFFIX_XLS
Suffix for CSV files
|
static java.lang.String |
SUFFIX_XML
Suffix for XML files
|
static java.lang.String |
SUFFIX_ZIP
Suffix for JAR files
|
Constructor and Description |
---|
FileManager(java.awt.Component parent)
Create a FileManager and use
parent as the
parent for the dialog. |
FileManager(java.awt.Component parent,
java.lang.String defDir,
javax.swing.filechooser.FileFilter filter)
Create a FileManager and use the specified params to configure its
behavior.
|
FileManager(java.awt.Component parent,
java.lang.String defDir,
javax.swing.filechooser.FileFilter filter,
java.lang.String title)
Create a FileManager and use the specified params to configure its
behavior.
|
FileManager(java.awt.Component parent,
java.lang.String defDir,
java.util.List filters)
Create a FileManager and use the specified params to configure its
behavior.
|
FileManager(java.awt.Component parent,
java.lang.String defDir,
java.util.List filters,
java.lang.String title)
Create a FileManager and use the specified params to configure its
behavior.
|
FileManager(java.awt.Component parent,
java.lang.String defDir,
java.util.List filters,
java.lang.String title,
boolean includeAllFilter)
Create a FileManager and use the specified params to configure its
behavior.
|
FileManager(java.awt.Component parent,
java.lang.String defDir,
java.lang.String file_extension,
java.lang.String desc)
Create a FileManager and use the specified params to configure its
behavior.
|
Modifier and Type | Method and Description |
---|---|
static void |
addToHistory(java.io.File file)
Add the file (or its parent directory if it is not a directory)
to the history list.
|
java.lang.String |
chooseFilename()
Choose a filename.
|
java.lang.String |
chooseFilename(java.lang.String title)
Choose a filename and set the title in the dialog.
|
java.lang.String |
chooseFilename(java.lang.String title,
java.lang.String approveButtonText)
Choose a filename, set the title in the dialog, and set the
text of the approve button on the chooser.
|
java.lang.String |
chooseFilename(java.lang.String title,
java.lang.String approveButtonText,
boolean includeUrl)
Choose a filename, set the title in the dialog, and set the
text of the approve button on the chooser.
|
javax.swing.JFileChooser |
getChooser()
Get the chooser that this
FileManager wraps. |
static java.io.File |
getDirectory(java.lang.String dfltDir)
Return a directory selection.
|
static java.io.File |
getDirectory(java.lang.String dfltDir,
java.lang.String title)
Have the user select a directory
|
static java.io.File |
getDirectory(java.lang.String dfltDir,
java.lang.String title,
javax.swing.JComponent accessory)
_more_
|
java.lang.String |
getDirectoryName()
Get the current directory name.
|
static java.lang.String |
getFile(boolean forWrite,
java.lang.String title,
java.lang.String buttonText,
java.lang.String property,
java.util.List filters,
java.lang.String suffix,
boolean includeAllFilter,
javax.swing.JComponent accessory,
boolean includeUrl)
Get the file that this FileManager is pointing to.
|
static java.lang.String |
getFile(boolean forWrite,
java.lang.String title,
java.lang.String buttonText,
java.lang.String property,
java.util.List filters,
java.lang.String suffix,
boolean includeAllFilter,
javax.swing.JComponent accessory,
boolean includeUrl,
java.lang.String dfltFile)
Get the file that this FileManager is pointing to.
|
static boolean |
getFileHidingEnabled()
_more_
|
static java.util.List |
getHistoryList()
Get the history list.
|
static java.util.List |
getHistoryList(java.awt.event.ActionListener listener)
Get the history list.
|
static java.lang.String |
getReadFile()
Get the file that this FileManager will read from using the defaults.
|
static java.lang.String |
getReadFile(javax.swing.filechooser.FileFilter filter)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getReadFile(javax.swing.filechooser.FileFilter filter,
boolean includeAllFilter)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getReadFile(java.lang.String title,
javax.swing.filechooser.FileFilter filter)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getReadFile(java.lang.String title,
java.util.List filters)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getReadFile(java.lang.String title,
java.util.List filters,
javax.swing.JComponent accessory)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getReadFileOrURL(java.lang.String title,
java.util.List filters,
javax.swing.JComponent accessory)
Get the file that this FileManager will read from using the specified
parameters to configure the widget.
|
static java.lang.String |
getWriteFile()
Get the file that this FileManager will write to using the defaults.
|
static java.lang.String |
getWriteFile(javax.swing.filechooser.FileFilter filter,
java.lang.String suffix)
Get the file that this FileManager will write to using the specified
parameters.
|
static java.lang.String |
getWriteFile(javax.swing.filechooser.FileFilter filter,
java.lang.String suffix,
javax.swing.JComponent accessory)
Get the file that this FileManager will write to using the specified
parameters.
|
static java.lang.String |
getWriteFile(java.util.List filters,
java.lang.String suffix)
Get the file that this FileManager will write to using the specified
parameters.
|
static java.lang.String |
getWriteFile(java.util.List filters,
java.lang.String suffix,
javax.swing.JComponent accessory)
Get the file that this FileManager will write to using the specified
parameters.
|
static java.lang.String |
getWriteFile(java.lang.String filename)
Get the file that this FileManager will write to using the defaults.
|
static java.lang.String |
getWriteFile(java.lang.String title,
javax.swing.filechooser.FileFilter filter,
java.lang.String suffix)
Get the file that this FileManager will write to using the specified
parameters.
|
static java.lang.String |
getWriteFile(java.lang.String title,
java.util.List filters,
java.lang.String suffix)
Get the file that this FileManager will write to using the specified
parameters.
|
static javax.swing.JComponent |
makeDirectoryHistoryComponent(javax.swing.JFileChooser fileChooser,
boolean includeLabel)
Create the directory history button and menu
|
void |
setAccessory(javax.swing.JComponent comp)
Set the accessory for the file chooser to
comp . |
void |
setApproveButtonText(java.lang.String approveButtonText)
Set the approve button text for the chooser.
|
static void |
setFileHidingEnabled(boolean value)
_more_
|
static void |
setFixFileLockup(boolean b)
Do we set the FileChooser.useShellFolder=false
This fixes the occasional problemo of a system lockup running under windows
|
void |
setSelectedFile(java.lang.String file)
Set the selected file for the chooser.
|
static void |
setStore(PersistentStore store,
java.lang.String writeProperty,
java.lang.String readProperty)
Set the persistent store for this FileManager.
|
public static final java.lang.String PROP_DIR_HISTORY
public static final java.lang.String PROP_DIRECTORY
public static final java.lang.String SUFFIX_XML
public static final java.lang.String SUFFIX_AVI
public static final java.lang.String SUFFIX_CSV
public static final java.lang.String SUFFIX_XLS
public static final java.lang.String SUFFIX_KML
public static final java.lang.String SUFFIX_KMZ
public static final java.lang.String SUFFIX_JPG
public static final java.lang.String SUFFIX_PNG
public static final java.lang.String SUFFIX_GIF
public static final java.lang.String SUFFIX_MOV
public static final java.lang.String SUFFIX_MP4
public static final java.lang.String SUFFIX_TXT
public static final java.lang.String SUFFIX_LOG
public static final java.lang.String SUFFIX_NETCDF
public static final java.lang.String SUFFIX_JAR
public static final java.lang.String SUFFIX_ZIP
public static final java.lang.String SUFFIX_SHP
public static final PatternFileFilter FILTER_XML
public static final PatternFileFilter FILTER_NETCDF
public static final PatternFileFilter FILTER_CSV
public static final PatternFileFilter FILTER_TXT
public static final PatternFileFilter FILTER_XLS
public static final PatternFileFilter FILTER_KML
public static final PatternFileFilter FILTER_JAR
public static final PatternFileFilter FILTER_JPG
public static final PatternFileFilter FILTER_IMAGE
public static final PatternFileFilter FILTER_IMAGEWRITE
public static final PatternFileFilter FILTER_IMAGE_OR_PDF
public static final PatternFileFilter FILTER_MOV
public static final PatternFileFilter FILTER_AVI
public static final PatternFileFilter FILTER_ANIMATEDGIF
public static final PatternFileFilter FILTER_MP4
public static final PatternFileFilter FILTER_SHP
public static final PatternFileFilter FILTER_ZIP
public static final PatternFileFilter FILTER_LOG
public static final PatternFileFilter FILTER_KMZ
public static final java.lang.String NULL_STRING
public static final java.lang.String NULL_BTNTEXT
public static final java.lang.String NULL_TITLE
public FileManager(java.awt.Component parent)
parent
as the
parent for the dialog.parent
- parent component for the dialog.public FileManager(java.awt.Component parent, java.lang.String defDir, java.lang.String file_extension, java.lang.String desc)
parent
- parent component for the dialog.defDir
- default directory to open upfile_extension
- file_extention to use for a filterdesc
- description of files of type file_extension
public FileManager(java.awt.Component parent, java.lang.String defDir, javax.swing.filechooser.FileFilter filter)
parent
- parent component for the dialog.defDir
- default directory to open upfilter
- default FileFilter
public FileManager(java.awt.Component parent, java.lang.String defDir, javax.swing.filechooser.FileFilter filter, java.lang.String title)
parent
- parent component for the dialog.defDir
- default directory to open upfilter
- default FileFilter
title
- title for the dialog windowpublic FileManager(java.awt.Component parent, java.lang.String defDir, java.util.List filters)
parent
- parent component for the dialog.defDir
- default directory to open upfilters
- List
of default FileFilter
'spublic FileManager(java.awt.Component parent, java.lang.String defDir, java.util.List filters, java.lang.String title)
parent
- parent component for the dialog.defDir
- default directory to open upfilters
- List
of default FileFilter
'stitle
- title for the dialog windowpublic FileManager(java.awt.Component parent, java.lang.String defDir, java.util.List filters, java.lang.String title, boolean includeAllFilter)
parent
- parent component for the dialog.defDir
- default directory to open upfilters
- List
of default FileFilter
'stitle
- title for the dialog windowincludeAllFilter
- true to include the "All files" filter.public javax.swing.JFileChooser getChooser()
FileManager
wraps.public static void setFixFileLockup(boolean b)
b
- valuepublic static boolean getFileHidingEnabled()
public static void setFileHidingEnabled(boolean value)
value
- _more_public void setSelectedFile(java.lang.String file)
file
- name of the filepublic java.lang.String chooseFilename()
public java.lang.String chooseFilename(java.lang.String title)
title
- for dialogpublic java.lang.String chooseFilename(java.lang.String title, java.lang.String approveButtonText)
title
- title for the dialog windowapproveButtonText
- text for the approve button in the dialogpublic java.lang.String chooseFilename(java.lang.String title, java.lang.String approveButtonText, boolean includeUrl)
title
- title for the dialog windowapproveButtonText
- text for the approve button in the dialogincludeUrl
- inclues a URLpublic static java.util.List getHistoryList(java.awt.event.ActionListener listener)
listener
- Listener to notifypublic static java.util.List getHistoryList()
public static void addToHistory(java.io.File file)
file
- File to addpublic void setAccessory(javax.swing.JComponent comp)
comp
.comp
- component to use for the accessory.public java.lang.String getDirectoryName()
public void setApproveButtonText(java.lang.String approveButtonText)
approveButtonText
- text for the button.public static void setStore(PersistentStore store, java.lang.String writeProperty, java.lang.String readProperty)
store
- store for persistencewriteProperty
- write propertyreadProperty
- read propertypublic static java.io.File getDirectory(java.lang.String dfltDir)
dfltDir
- public static java.io.File getDirectory(java.lang.String dfltDir, java.lang.String title)
dfltDir
- Default dirtitle
- Window titlepublic static java.io.File getDirectory(java.lang.String dfltDir, java.lang.String title, javax.swing.JComponent accessory)
dfltDir
- _more_title
- _more_accessory
- _more_public static java.lang.String getWriteFile(java.lang.String filename)
filename
- default file namepublic static java.lang.String getWriteFile()
public static java.lang.String getWriteFile(java.util.List filters, java.lang.String suffix)
filters
- List
of file filterssuffix
- default suffixpublic static java.lang.String getWriteFile(javax.swing.filechooser.FileFilter filter, java.lang.String suffix)
filter
- file filtersuffix
- default suffixpublic static java.lang.String getWriteFile(javax.swing.filechooser.FileFilter filter, java.lang.String suffix, javax.swing.JComponent accessory)
filter
- file filtersuffix
- default suffixaccessory
- accessory componentpublic static java.lang.String getWriteFile(java.util.List filters, java.lang.String suffix, javax.swing.JComponent accessory)
filters
- file filterssuffix
- default suffixaccessory
- accessory componentpublic static java.lang.String getWriteFile(java.lang.String title, javax.swing.filechooser.FileFilter filter, java.lang.String suffix)
title
- title for the dialog.filter
- file filtersuffix
- default suffixpublic static java.lang.String getWriteFile(java.lang.String title, java.util.List filters, java.lang.String suffix)
title
- title for the dialog.filters
- List
of file filterssuffix
- default suffixpublic static java.lang.String getReadFile()
public static java.lang.String getReadFile(javax.swing.filechooser.FileFilter filter)
filter
- filter to usepublic static java.lang.String getReadFile(javax.swing.filechooser.FileFilter filter, boolean includeAllFilter)
filter
- filter to useincludeAllFilter
- true to include the "All files (*.*)" filterpublic static java.lang.String getReadFile(java.lang.String title, javax.swing.filechooser.FileFilter filter)
title
- title for the dialogfilter
- filter to usepublic static java.lang.String getReadFile(java.lang.String title, java.util.List filters)
title
- title for the dialogfilters
- List
of filters to usepublic static java.lang.String getReadFile(java.lang.String title, java.util.List filters, javax.swing.JComponent accessory)
title
- title for the dialogfilters
- List
of filters to useaccessory
- accessory for the chooser (may be null)public static java.lang.String getReadFileOrURL(java.lang.String title, java.util.List filters, javax.swing.JComponent accessory)
title
- title for the dialogfilters
- List
of filters to useaccessory
- accessory for the chooser (may be null)public static java.lang.String getFile(boolean forWrite, java.lang.String title, java.lang.String buttonText, java.lang.String property, java.util.List filters, java.lang.String suffix, boolean includeAllFilter, javax.swing.JComponent accessory, boolean includeUrl)
forWrite
- true if this is for getting a file to write totitle
- title for the dialogbuttonText
- text for the approve buttonproperty
- property for the storefilters
- List
of filters to usesuffix
- default suffix for file to writeincludeAllFilter
- true to include the "All files (*.*)" filteraccessory
- accessory for the chooserincludeUrl
- allow a URLpublic static java.lang.String getFile(boolean forWrite, java.lang.String title, java.lang.String buttonText, java.lang.String property, java.util.List filters, java.lang.String suffix, boolean includeAllFilter, javax.swing.JComponent accessory, boolean includeUrl, java.lang.String dfltFile)
forWrite
- true if this is for getting a file to write totitle
- title for the dialogbuttonText
- text for the approve buttonproperty
- property for the storefilters
- List
of filters to usesuffix
- default suffix for file to writeincludeAllFilter
- true to include the "All files (*.*)" filteraccessory
- accessory for the chooserincludeUrl
- allow a URLdfltFile
- the default filepublic static javax.swing.JComponent makeDirectoryHistoryComponent(javax.swing.JFileChooser fileChooser, boolean includeLabel)
fileChooser
- The chooser to set the dir onincludeLabel
- Should the label be included in the component.