Package ucar.ui.widget
Class FileManager
- java.lang.Object
-
- ucar.ui.widget.FileManager
-
public class FileManager extends Object
Cover for JFileChooser.javax.swing.filechooser.FileFilter[] filters = new javax.swing.filechooser.FileFilter[2]; filters[0] = new FileManager.HDF5ExtFilter(); filters[1] = new FileManager.NetcdfExtFilter(); fileChooser = new FileManager(parentFrame, null, filters, (PreferencesExt) prefs.node("FileManager")); AbstractAction fileAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String filename = fileChooser.chooseFilename(); if (filename == null) return; process(filename); } }; BAMutil.setActionProperties( fileAction, "FileChooser", "open Local dataset...", false, 'L', -1);
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FileManager.ExtFilter
static class
FileManager.HDF5ExtFilter
static class
FileManager.NetcdfExtFilter
static class
FileManager.XMLExtFilter
-
Constructor Summary
Constructors Constructor Description FileManager(JFrame parent)
FileManager(JFrame parent, String defDir)
FileManager(JFrame parent, String defDir, String file_extension, String desc, PreferencesExt prefs)
FileManager(JFrame parent, String defDir, FileFilter[] filters, PreferencesExt prefs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
chooseDirectory(String defaultDirectory)
String
chooseFilename()
Allow user to select file, then return the filename, in canonical form, always using '/', never '\'String
chooseFilename(File def)
String
chooseFilename(String defaultFilename)
String
chooseFilenameToSave(String defaultFilename)
File[]
chooseFiles()
String
getCurrentDirectory()
JFileChooser
getFileChooser()
void
save()
void
setCurrentDirectory(String dirName)
-
-
-
Field Detail
-
main
protected JPanel main
-
-
Constructor Detail
-
FileManager
public FileManager(JFrame parent)
-
FileManager
public FileManager(JFrame parent, String defDir, String file_extension, String desc, PreferencesExt prefs)
-
FileManager
public FileManager(JFrame parent, String defDir, FileFilter[] filters, PreferencesExt prefs)
-
-
Method Detail
-
save
public void save()
-
getFileChooser
public JFileChooser getFileChooser()
-
chooseFilename
@Nullable public String chooseFilename()
Allow user to select file, then return the filename, in canonical form, always using '/', never '\'- Returns:
- chosen filename in canonical form, or null if nothing chosen.
-
chooseFiles
public File[] chooseFiles()
-
getCurrentDirectory
public String getCurrentDirectory()
-
setCurrentDirectory
public void setCurrentDirectory(String dirName)
-
-