net.shredzone.ifish.actions
Class IFishAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.shredzone.ifish.actions.IFishAction
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
AboutAction, AsyncIFishAction, DeleteDatabaseAction, ExportDatabaseAction, PlayerAction, PlaylistPane.AllAction, PlaylistPane.CreateAction, PlaylistPane.DeleteAction, PlaylistPane.MoveAction, PlaylistPane.PasteAction, PlaylistPane.RemoveAction, PlaylistPane.RenameAction, PlaylistPane.SortAction, PrefsAction, QuitAction

public abstract class IFishAction
extends AbstractAction

The basic class for all IFish actions. The action is executed synchronously with in the GUI thread, so it is rather meant to be used for actions that either take very little time to execute, or for actions which open a modal dialog.

Version:
$Id: IFishAction.java 291 2009-04-28 21:29:27Z shred $
See Also:
Serialized Form

Field Summary
protected  IFishPane fish
           
protected  IFishPrefs prefs
           
 
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
IFishAction(IFishPane fish, String name, Icon icon, String tip, KeyStroke accel)
          Create a new, synchronous Action.
 
Method Summary
protected abstract  void action()
          The action implementation itself.
 void actionPerformed(ActionEvent e)
          The action has been invoked from a button, menu item etc.
 void perform()
          You can use this method if you want to invoke the action directly from your current application code.
 
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

fish

protected final IFishPane fish

prefs

protected final IFishPrefs prefs
Constructor Detail

IFishAction

public IFishAction(IFishPane fish,
                   String name,
                   Icon icon,
                   String tip,
                   KeyStroke accel)
Create a new, synchronous Action. Event processing will be stopped during execution, which also means that there is no GUI update. If you do not fancy this, you should have a look at AsyncIFishAction.

Parameters:
fish - IFishPane this action belongs to
name - Action Name
icon - Action Icon or null
tip - Action Tooltip or null
accel - Accelerator Key or null
Method Detail

actionPerformed

public void actionPerformed(ActionEvent e)
The action has been invoked from a button, menu item etc.

Parameters:
e - ActionEvent

perform

public void perform()
You can use this method if you want to invoke the action directly from your current application code.


action

protected abstract void action()
The action implementation itself. Overwrite this method with your desired action. You do not need to care for threading, locking etc. Anyhow keep in mind that for AsyncIFishActions, this method is actually running in a separate thread.



Copyright © 2007-2011 shredzone.org. All Rights Reserved.