be.ugent.caagt.swirl.actions
Class FileAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by be.ugent.caagt.swirl.actions.FileAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
FileOpenAction, FileSaveAction

public abstract class FileAction
extends javax.swing.AbstractAction

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

See Also:
Serialized Form

Field Summary
protected  javax.swing.JFileChooser fileChooser
          The file chooser which is used by this action.
protected  java.awt.Window parent
          Parent window for any dialogs which need to be shown, in particular the file chooser dialog.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
FileAction(java.awt.Window parent, javax.swing.filechooser.FileFilter... filters)
          Create an action of this type
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Shows the file chooser dialog and dispatches to the appropriate dialog... method depending on the users choice
protected  javax.swing.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
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileChooser

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


parent

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

Constructor Detail

FileAction

public FileAction(java.awt.Window parent,
                  javax.swing.filechooser.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 Detail

createFileChooser

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


dialogCanceled

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


dialogClosed

protected void dialogClosed()
Called when the dialog is dismissed. This implementation calls dialogCanceled().


dialogApproved

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


showDialog

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


actionPerformed

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