com.frinika.gui
Class AbstractDialogAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by com.frinika.gui.AbstractDialogAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action
Direct Known Subclasses:
AbstractMidiAction, RepeatAction

public abstract class AbstractDialogAction
extends javax.swing.AbstractAction

Abstract superclass for menu-actions that will pop-up a dialog (usually to prompt options from the user) before actually performing the action. Note: The implementation is non-reentrant, because action-specific parameters are to be stored in instance-variables to make them accessible accross the different performXxx() methods. However, this is not considered to be harmful as a menu-action is supposed to be invoked from a single-user GUI, thus only one thread at a time runs through actionPerformed().

Author:
Jens Gulden
See Also:
OptionsDialog, OptionsEditor, Serialized Form

Field Summary
protected  java.lang.String actionId
           
protected  boolean canceled
           
protected  OptionsDialog dialog
           
protected  ProjectFrame frame
           
 
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
AbstractDialogAction(ProjectFrame frame, java.lang.String actionId)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void cancel()
           
protected  OptionsDialog createDialog()
          Creates a dialog to ask for options.
protected abstract  javax.swing.JComponent createGUI()
          Creates inner gui-editor of a dialog to show to the user.
 OptionsDialog getDialog()
           
 ProjectFrame getProjectFrame()
           
 void perform()
           
protected abstract  void performAction()
           
protected  void performDialog()
          Ask user for options, usually via modal GUI-dialog.
protected  void performPrepare()
           
protected  void performUndoable()
           
 
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

frame

protected ProjectFrame frame

actionId

protected java.lang.String actionId

dialog

protected OptionsDialog dialog

canceled

protected boolean canceled
Constructor Detail

AbstractDialogAction

public AbstractDialogAction(ProjectFrame frame,
                            java.lang.String actionId)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

cancel

public void cancel()

perform

public void perform()

performPrepare

protected void performPrepare()

performDialog

protected void performDialog()
Ask user for options, usually via modal GUI-dialog. If cancel is set to true after this method returns, no action will be taken. The default implementation shows the modal options dialog, if one is available, otherwise it does nothing (for commands that are directly executed without asking options.)


performUndoable

protected void performUndoable()

performAction

protected abstract void performAction()

getDialog

public OptionsDialog getDialog()

createDialog

protected OptionsDialog createDialog()
Creates a dialog to ask for options. Typically not overwritten by subclasses that use a gui-editor, they provide an inner editor-component to the dialog instead via createDialogContent(). Overwrite this method here if you need other kinds of dialogs than one with OK/Cancel buttons.

Returns:

getProjectFrame

public ProjectFrame getProjectFrame()

createGUI

protected abstract javax.swing.JComponent createGUI()
Creates inner gui-editor of a dialog to show to the user. The implementation may just return null, which makes the class effectually behave as an AbstractAction without user-interaction.

Returns: