public class JFileDataStoreChooser extends Object
Examples of use:
// prompt the user for a shapefile
File file = JFileDataStoreChooser.showOpenFile("shp", parentFrame);
if (file != null) {
...
}
// prompt the user for a given data format
Constructor and Description |
---|
JFileDataStoreChooser(Shell parent,
int style,
FileDataStoreFactorySpi format)
Creates a dialog that filters for files matching the specified
data format.
|
JFileDataStoreChooser(Shell parent,
int style,
List<String> extensions)
Create a dialog that filters for files with the specified extensions.
|
JFileDataStoreChooser(Shell parent,
int style,
Map<String,String> fileAssociations)
Creates a dialog based on the given file associations.
|
JFileDataStoreChooser(Shell parent,
int style,
String extension)
Create a dialog that filters for files with the specified extension.
|
JFileDataStoreChooser(Shell parent,
int style,
String[] extensions)
Create a dialog that filters for files with the specified extensions.
|
Modifier and Type | Method and Description |
---|---|
FileDialog |
getFileDialog() |
static void |
main(String[] arg)
Demonstrates the file data store dialog by prompting for a shapefile
|
void |
setSaveFile(File file)
Consider the provided file as a candidate for a new filename.
|
static File |
showOpenFile(FileDataStoreFactorySpi format,
File initialDir,
Shell parent)
Show a file open dialog that filters for files that match a given file
data store format
|
static File |
showOpenFile(FileDataStoreFactorySpi format,
Shell parent)
Show a file open dialog that filters for files that match a given file
data store format
|
static File |
showOpenFile(String[] extensions,
File initialDir,
Shell parent)
Show a file open dialog that filters for files with the given extensions.
|
static File |
showOpenFile(String[] extensions,
Shell parent)
Show a file open dialog that filters for files with the given extensions.
|
static File |
showOpenFile(String extension,
File initialDir,
Shell parent)
Show a file open dialog that filters for files with the given extension.
|
static File |
showOpenFile(String extension,
Shell parent)
Show a file open dialog that filters for files with the given extension.
|
public JFileDataStoreChooser(Shell parent, int style, String extension)
extension
- the file extension, with or without the leading '.'public JFileDataStoreChooser(Shell parent, int style, List<String> extensions)
extensions
- the file extensions, with or without the leading '.'public JFileDataStoreChooser(Shell parent, int style, String[] extensions)
extensions
- the file extensions, with or without the leading '.'public JFileDataStoreChooser(Shell parent, int style, Map<String,String> fileAssociations)
Map assoc = new HashMap();
assoc.put(".foo", "Foo data files (*.foo)");
assoc.put(".bar", "Bar data files (*.bar)");
JFileDataStoreChooser chooser = new JFileDataStoreChooser(assoc);
fileAssociations
- a Map
where keys are extensions (with or
wirhout the leading dot) and values are descriptions.public JFileDataStoreChooser(Shell parent, int style, FileDataStoreFactorySpi format)
format
- data file formatpublic FileDialog getFileDialog()
public static File showOpenFile(String extension, Shell parent)
extension
- file extension, with or without leading '.'parent
- parent GUI component (may be null
)HeadlessException
- if run in an unsupported environmentpublic static File showOpenFile(String extension, File initialDir, Shell parent)
extension
- file extension, with or without leading '.'initialDir
- initial directory to display; if null
the initial directory
will be the user's default directoryparent
- parent GUI component (may be null
)HeadlessException
- if run in an unsupported environmentpublic static File showOpenFile(String[] extensions, Shell parent)
extensions
- array of file extension, with or without leading '.'parent
- parent GUI component (may be null)HeadlessException
- if run in an unsupported environmentpublic static File showOpenFile(String[] extensions, File initialDir, Shell parent)
extensions
- array of file extension, with or without leading '.'initialDir
- initial directory to display; if null
the initial directory
will be the user's default directoryparent
- parent GUI component (may be null)HeadlessException
- if run in an unsupported environmentpublic static File showOpenFile(FileDataStoreFactorySpi format, Shell parent)
format
- the file data store formatparent
- parent GUI component (may be null)HeadlessException
- if run in an unsupported environmentpublic static File showOpenFile(FileDataStoreFactorySpi format, File initialDir, Shell parent)
format
- the file data store formatinitialDir
- initial directory to display; if null
the initial directory
will be the user's default directoryparent
- parent GUI component (may be null)HeadlessException
- if run in an unsupported environmentpublic static void main(String[] arg)
arg
- ignoredpublic void setSaveFile(File file)
file
- the candidate file nameCopyright © 1996–2018 Geotools. All rights reserved.