org.pietschy.command

Class LazyCommand

Implemented Interfaces:
ActionCommandExecutor

public abstract class LazyCommand
extends ActionCommand

The LazyCommand defers the construction of the command until the first execution. Subclasses must implement the build() and lazyExecute() methods.

Field Summary

Fields inherited from class org.pietschy.command.ActionCommand

HINT_ACTION_EVENT, HINT_INVOKER, HINT_INVOKER_WINDOW, HINT_MODIFIERS

Fields inherited from class org.pietschy.command.Command

internalLog, listenerList, pcs

Constructor Summary

LazyCommand()
Creates a new anonymous ActionCommand.
LazyCommand(String commandId)
Creates a new command with the speicifed Id that is bound to the CommandManager.defaultInstance().
LazyCommand(CommandManager commandManager, String commandId)
Creates a new ActionCommand with the specified id that is bound to the specified CommandManager.

Method Summary

protected void
afterExecute()
Deprecated. Use ActionCommandInterceptor instead.
protected void
beforeExecute()
Deprecated. Use ActionCommandInterceptor instead.
abstract void
build()
Invoked on the first time the command is executed.
void
handleExecute()
This implementation will call build() on the first execution and delegate the handling of the request to lazyExecute().
abstract void
lazyExecute()
Invoked after build and then again whenever the command is executed.

Methods inherited from class org.pietschy.command.ActionCommand

addCommandListener, addInterceptor, areEqual, attach, configureButtonStates, detach, execute, execute, getActionAdapter, getActionAdapter, getActionCommand, getActionEvent, getHint, getHint, getHints, getInvoker, getInvokerWindow, getModifiers, handleExecute, installShortCut, installShortCut, postExecute, preExecute, putHint, putHints, removeCommandListener, removeInterceptor, requestDefautIn, setActionCommand, uninstallShortCut, uninstallShortCut

Methods inherited from class org.pietschy.command.Command

addFace, addHoverListener, addNewFace, addNotify, addPropertyChangeListener, addPropertyChangeListener, attach, buttonIterator, configureButtonAppearance, configureButtonAppearances, configureButtonAppearances, configureButtonStates, createButton, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, createMenuItem, detach, export, faceExists, fireHoverEnded, fireHoverStarted, getAccelerator, getAlternativeFaceNames, getButtonFactory, getButtonIn, getCommandManager, getDefaultFace, getDefaultFace, getDescription, getFace, getFace, getIcon, getId, getLongDescription, getMenuFactory, getMnemonic, getMnemonicIndex, getProperty, getProperty, getPropertyNames, getSelectedIcon, getText, getTextPosition, getToolbarFactory, initCommandManager, installFace, isAnonymous, isAttachedTo, isEnabled, isVisible, putProperty, removeHoverListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, requestFocusIn, setAccelerator, setButtonFactory, setDescription, setEnabled, setIcon, setLongDescription, setMenuFactory, setMnemonic, setMnemonicIndex, setSelectedIcon, setText, setTextPosition, setToolbarFactory, setVisible, toString

Constructor Details

LazyCommand

public LazyCommand()
Creates a new anonymous ActionCommand. Anonymous commands must be fully programatically generated and can only be added to groups manually by calling groupCommand.installFace(myAnonymousCommand).

LazyCommand

public LazyCommand(String commandId)

LazyCommand

public LazyCommand(CommandManager commandManager,
                   String commandId)
Creates a new ActionCommand with the specified id that is bound to the specified CommandManager.

Method Details

afterExecute

protected void afterExecute()

Deprecated. Use ActionCommandInterceptor instead.

Invoked after the command is executed.

beforeExecute

protected void beforeExecute()

Deprecated. Use ActionCommandInterceptor instead.

Invoked before the command is executed.

build

public abstract void build()
Invoked on the first time the command is executed.

handleExecute

public void handleExecute()
This implementation will call build() on the first execution and delegate the handling of the request to lazyExecute().
Overrides:
handleExecute in interface ActionCommand

lazyExecute

public abstract void lazyExecute()
Invoked after build and then again whenever the command is executed.