be.ugent.caagt.swirl.actions

Class FileAction

Known Direct Subclasses:
FileOpenAction, FileSaveAction

public abstract class FileAction
extends AbstractAction

Common (abstract) super class of FileOpenAction and FileSaveAction. Clients should consider extending one of those classes instead of this one.

Field Summary

protected JFileChooser
fileChooser
The file chooser which is used by this action.
protected Window
parent
Parent window for any dialogs which need to be shown, in particular the file chooser dialog.

Constructor Summary

FileAction(Window parent, FileFilter... filters)
Create an action of this type

Method Summary

void
actionPerformed(ActionEvent e)
Shows the file chooser dialog and dispatches to the appropriate dialog... method depending on the users choice
protected JFileChooser
createFileChooser()
Factory method which creates the file chooser at initialization time.
protected abstract void
dialogApproved()
Called when the dialog is approved.
protected void
dialogCanceled()
Called when the dialog is canceled.
protected void
dialogClosed()
Called when the dialog is dismissed.
protected abstract int
showDialog()
Shows the dialog appropriate for this type of file action

Field Details

fileChooser

protected JFileChooser fileChooser
The file chooser which is used by this action.

parent

protected Window parent
Parent window for any dialogs which need to be shown, in particular the file chooser dialog.

Constructor Details

FileAction

public FileAction(Window parent,
                  FileFilter... filters)
Create an action of this type
Parameters:
parent - Window which will be used as parent for all dialogs
filters - File filters for the file chooser dialog

Method Details

actionPerformed

public void actionPerformed(ActionEvent e)
Shows the file chooser dialog and dispatches to the appropriate dialog... method depending on the users choice

createFileChooser

protected JFileChooser createFileChooser()
Factory method which creates the file chooser at initialization time. to initialize its 'approve' button.

dialogApproved

protected abstract void dialogApproved()
Called when the dialog is approved.

dialogCanceled

protected void dialogCanceled()
Called when the dialog is canceled. This implementation is empty.

dialogClosed

protected void dialogClosed()

showDialog

protected abstract int showDialog()
Shows the dialog appropriate for this type of file action