org.oddjob.monitor.actions
Interface ExplorerAction

All Superinterfaces:
PropertyChangeNotifier, SelectedContextAware
All Known Subinterfaces:
FormAction
All Known Implementing Classes:
AddJobAction, DesignerAction, DesignInsideAction, ExecuteAction, ForceAction, HardResetAction, JobAction, JobFormAction, LoadAction, SetPropertyAction, SoftResetAction, StopAction, UnloadAction

public interface ExplorerAction
extends PropertyChangeNotifier, SelectedContextAware

Abstraction for an Action that acts on a Job and is executed in from OddjobExplorer or another user interface.

The life cycle for an action is:

Author:
rob

Field Summary
static String DESIGN_GROUP
          The name of the 'design' menu group.
static String ENABLED_PROPERTY
          The enabled property name.
static String JOB_GROUP
          The name of the 'job' menu group.
static String PROPERTY_GROUP
          The name of the 'property' menu group.
static String VISIBLE_PROPERTY
          The visible property name.
 
Method Summary
 void action()
          Called to perform the action.
 KeyStroke getAcceleratorKey()
          Get the Accelerator key for the action.
 String getGroup()
          Get the group name.
 Integer getMnemonicKey()
          Get the Mnemonic Key for the action.
 String getName()
          Get the name for the option.
 boolean isEnabled()
          Is this action currently enabled?
 boolean isVisible()
          Is this action currently visible?
 void prepare()
          Called when the Job Menu is selected.
 void setSelectedContext(ExplorerContext eContext)
          This method will be called when a component is selected or unselected.
 
Methods inherited from interface org.oddjob.framework.PropertyChangeNotifier
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

ENABLED_PROPERTY

static final String ENABLED_PROPERTY
The enabled property name.

See Also:
Constant Field Values

VISIBLE_PROPERTY

static final String VISIBLE_PROPERTY
The visible property name.

See Also:
Constant Field Values

JOB_GROUP

static final String JOB_GROUP
The name of the 'job' menu group.

See Also:
Constant Field Values

PROPERTY_GROUP

static final String PROPERTY_GROUP
The name of the 'property' menu group.

See Also:
Constant Field Values

DESIGN_GROUP

static final String DESIGN_GROUP
The name of the 'design' menu group.

See Also:
Constant Field Values
Method Detail

getName

String getName()
Get the name for the option. This will typically be used as a menu item name.

Returns:
The name for the action.

getGroup

String getGroup()
Get the group name. This is which group in the Job menu to place the action in.

Returns:
A name. Must not be null.

getMnemonicKey

Integer getMnemonicKey()
Get the Mnemonic Key for the action.

Returns:
The MnemonicKey. May be null.

getAcceleratorKey

KeyStroke getAcceleratorKey()
Get the Accelerator key for the action.

Returns:
The KeyStroke. May be null.

setSelectedContext

void setSelectedContext(ExplorerContext eContext)
This method will be called when a component is selected or unselected.

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

action

void action()
            throws Exception
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.

Throws:
Exception - The exception will be caught and presented to the user.

prepare

void prepare()
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 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 SelectedContextAware

isEnabled

boolean isEnabled()
Is this action currently enabled?

Returns:
true if this action is enabled, false if it isn't.

isVisible

boolean isVisible()
Is this action currently visible?

Returns:
true if this action is visible, false if it isn't.