org.oddjob.monitor.model
Class JobAction

java.lang.Object
  extended by org.oddjob.monitor.model.JobAction
All Implemented Interfaces:
PropertyChangeNotifier, ExplorerAction, SelectedContextAware
Direct Known Subclasses:
ExecuteAction, ForceAction, HardResetAction, JobFormAction, LoadAction, SoftResetAction, StopAction, UnloadAction

public abstract class JobAction
extends Object
implements ExplorerAction

The interface for an action which can be performed on a selected job node. This interface defines a view independent sequence for the action.


Field Summary
 
Fields inherited from interface org.oddjob.monitor.actions.ExplorerAction
DESIGN_GROUP, ENABLED_PROPERTY, JOB_GROUP, PROPERTY_GROUP, VISIBLE_PROPERTY
 
Constructor Summary
JobAction()
           
 
Method Summary
 void action()
          Called to perform the action.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a Listener.
protected  boolean checkPrepare()
           
protected abstract  void doAction()
           
protected  void doFree(ExplorerContext explorerContext)
           
protected  void doPrepare(ExplorerContext explorerContext)
           
protected  ExplorerContext getExplorerContext()
           
 boolean isEnabled()
          Is this action currently enabled?
protected  boolean isPrepared()
           
 boolean isVisible()
          Is this action currently visible?
 void prepare()
          Called when the Job Menu is selected.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a Listener.
protected  void setEnabled(boolean enabled)
           
 void setSelectedContext(ExplorerContext explorerContext)
          This method will be called when a component is selected or unselected.
protected  void setVisible(boolean visible)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.oddjob.monitor.actions.ExplorerAction
getAcceleratorKey, getGroup, getMnemonicKey, getName
 

Constructor Detail

JobAction

public JobAction()
Method Detail

isEnabled

public final boolean isEnabled()
Is this action currently enabled?

Specified by:
isEnabled in interface ExplorerAction
Returns:
true if this action is enabled, false if it isn't.

setEnabled

protected void setEnabled(boolean enabled)

isVisible

public final boolean isVisible()
Description copied from interface: ExplorerAction
Is this action currently visible?

Specified by:
isVisible in interface ExplorerAction
Returns:
true if this action is visible, false if it isn't.

setVisible

protected void setVisible(boolean visible)

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangeNotifier
Add a Listener. No validation is done for if the property name is not one for which the bean provides notifications.

Specified by:
addPropertyChangeListener in interface PropertyChangeNotifier
Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Description copied from interface: PropertyChangeNotifier
Remove a Listener.

Specified by:
removePropertyChangeListener in interface PropertyChangeNotifier
Parameters:
listener - The listener.

setSelectedContext

public final void setSelectedContext(ExplorerContext explorerContext)
Description copied from interface: ExplorerAction
This method will be called when a component is selected or unselected.

Specified by:
setSelectedContext in interface ExplorerAction
Specified by:
setSelectedContext in interface SelectedContextAware
Parameters:
explorerContext - the ExplorerContext for the current node. Null when the node is unselected.

prepare

public final void prepare()
Description copied from interface: ExplorerAction
Called when the Job Menu is selected. This provides an action with the opportunity to work out if it is disabled or not.

This method was added in addition to ExplorerAction.setSelectedContext(ExplorerContext) because prepare can be relatively slow if, for instance, it involves ascertaining the state of a remote job, so this method allows this to be done only when the menu is to be shown.

Specified by:
prepare in interface ExplorerAction
Specified by:
prepare in interface SelectedContextAware

getExplorerContext

protected ExplorerContext getExplorerContext()

isPrepared

protected boolean isPrepared()

doAction

protected abstract void doAction()
                          throws Exception
Throws:
Exception

checkPrepare

protected final boolean checkPrepare()

action

public final void action()
                  throws Exception
Description copied from interface: ExplorerAction
Called to perform the action.

If this is a FormAction this method will be called once the form has been completed. Otherwise this method is called immediately the menu item or other trigger for the action has been selected.

Specified by:
action in interface ExplorerAction
Throws:
Exception - The exception will be caught and presented to the user.

doPrepare

protected void doPrepare(ExplorerContext explorerContext)

doFree

protected void doFree(ExplorerContext explorerContext)