org.homeunix.thecave.moss.swing
Class MossSmartFileChooser

java.lang.Object
  extended by org.homeunix.thecave.moss.swing.MossSmartFileChooser

public class MossSmartFileChooser
extends java.lang.Object

A class which helps set up 'smart' file choosers. These file choosers will remember the last selected location, check for read / write access to selected files, append default extensions if desired, etc.

Author:
wyatt

Method Summary
static java.io.File showOpenDialog(javax.swing.JFrame frame, javax.swing.filechooser.FileFilter filter)
          Shows the open dialog, with English translation strings.
static java.io.File showOpenDialog(javax.swing.JFrame frame, javax.swing.filechooser.FileFilter filter, java.lang.String title, java.lang.String okTranslation, java.lang.String cannotWriteDataFileTranslation, java.lang.String cannotReadDataFileTranslation, java.lang.String errorTranslation)
          Shows the open dialog, with custom translation strings.
static java.io.File showSaveFileDialog(javax.swing.JFrame frame, javax.swing.filechooser.FileFilter filter, java.lang.String extension)
          Shows the save dialog, with English translation strings.
static java.io.File showSaveFileDialog(javax.swing.JFrame frame, javax.swing.filechooser.FileFilter filter, java.lang.String defaultExtension, java.lang.String title, java.lang.String okTranslation, java.lang.String cancelTranslation, java.lang.String replaceTranslation, java.lang.String cannotWriteDataFileTranslation, java.lang.String error, java.lang.String promptOverwriteFileTranslation, java.lang.String promptOverwriteFileTitleTranslation)
          Shows the save file dialog, with custom translation strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

showOpenDialog

public static java.io.File showOpenDialog(javax.swing.JFrame frame,
                                          javax.swing.filechooser.FileFilter filter)
Shows the open dialog, with English translation strings.

Parameters:
frame - The calling frame
filter - The FileFilter to use.
Returns:

showOpenDialog

public static java.io.File showOpenDialog(javax.swing.JFrame frame,
                                          javax.swing.filechooser.FileFilter filter,
                                          java.lang.String title,
                                          java.lang.String okTranslation,
                                          java.lang.String cannotWriteDataFileTranslation,
                                          java.lang.String cannotReadDataFileTranslation,
                                          java.lang.String errorTranslation)
Shows the open dialog, with custom translation strings.

Parameters:
frame - The calling frame
filter - The FileFilter to use.
title - The title of the dialog
okTranslation - The translation for the OK button.
cannotWriteDataFileTranslation - The translation for "Cannot write to the selected file".
cannotReadDataFileTranslation - The translation for "Cannot read from the selected file".
errorTranslation - The translation for "Error"
Returns:

showSaveFileDialog

public static java.io.File showSaveFileDialog(javax.swing.JFrame frame,
                                              javax.swing.filechooser.FileFilter filter,
                                              java.lang.String extension)
Shows the save dialog, with English translation strings.

Parameters:
frame - The calling frame
filter - The FileFilter to use
defaultExtension - The default extension. If this is set, we wil ensure that it is appended to the file name. If this is null, we ignore it.
Returns:

showSaveFileDialog

public static java.io.File showSaveFileDialog(javax.swing.JFrame frame,
                                              javax.swing.filechooser.FileFilter filter,
                                              java.lang.String defaultExtension,
                                              java.lang.String title,
                                              java.lang.String okTranslation,
                                              java.lang.String cancelTranslation,
                                              java.lang.String replaceTranslation,
                                              java.lang.String cannotWriteDataFileTranslation,
                                              java.lang.String error,
                                              java.lang.String promptOverwriteFileTranslation,
                                              java.lang.String promptOverwriteFileTitleTranslation)
Shows the save file dialog, with custom translation strings.

Parameters:
frame - The calling frame
filter - The FileFilter to use
defaultExtension - The default extension. If this is set, we wil ensure that it is appended to the file name. If this is null, we ignore it.
title - The title of the file chooser
okTranslation - The translation for the OK button.
cancelTranslation - The translation for the Cancel button.
replaceTranslation - The translation for the Replace button.
cannotWriteDataFileTranslation - The translation for the message that the selected file is not writable.
error - The translation for "Error".
promptOverwriteFileTranslation - The translation for the message that the file exists, and will be overwritten.
promptOverwriteFileTitleTranslation - The translation for the title of the overwrite warning.
Returns: