com.pietschy.command
Class LazyCommand

java.lang.Object
  extended by com.pietschy.command.Command
      extended by com.pietschy.command.ActionCommand
          extended by com.pietschy.command.LazyCommand
All Implemented Interfaces:
ActionCommandExecutor, Bindable, Identifiable

public abstract class LazyCommand
extends ActionCommand

An ActionCommand that defers construction until the first execution. Subclasses must implement the build() and lazyExecute() methods.


Field Summary
 
Fields inherited from class com.pietschy.command.ActionCommand
PARAMETER_ACTION_EVENT, PARAMETER_INVOKER, PARAMETER_INVOKER_WINDOW, PARAMETER_MODIFIERS
 
Fields inherited from class com.pietschy.command.Command
internalLog, PROPERTY_ENABLED, PROPERTY_VISIBLE
 
Constructor Summary
LazyCommand()
          Constructs a new anonymous instance.
LazyCommand(java.lang.String commandId)
          Constructs a new command with the specified id.
 
Method Summary
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 com.pietschy.command.ActionCommand
addActionCommandListener, addInterceptor, bindToContainer, createButton, createButton, createButton, createButton, createMenuItem, createMenuItem, createMenuItem, createMenuItem, doButtonAttachments, doButtonDetachments, execute, execute, getActionAdapter, getActionAdapter, getActionEvent, getInvoker, getInvokerWindow, getModifiers, getParameter, getParameter, getParameters, installShortCut, installShortCut, postExecute, preExecute, putParameter, putParameters, removeActionCommandListener, removeInterceptor, requestDefaultIn, unbindFromContainer, uninstallShortCut, uninstallShortCut
 
Methods inherited from class com.pietschy.command.Command
addContainerPropertyListener, addFace, addHoverListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, attach, bind, bind, bind, buttonIterator, configureAppearance, configureAppearances, configureButtonAppearances, configureButtonStates, configureButtonStates, createButton, createButton, createButton, createButton, createComponent, createMenuItem, createMenuItem, createMenuItem, createMenuItem, detach, faceExists, findBestFace, fireHoverEnded, fireHoverStarted, fireIndexedPropertyChange, fireIndexedPropertyChange, fireIndexedPropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlternativeFaceContexts, getButtonFactory, getButtonIn, getCommandContainer, getContainerProperty, getContainerPropertySupport, getDefaultFace, getDefaultFace, getFace, getFace, getId, getMenuFactory, getProperty, getProperty, getPropertyNames, getToolbarFactory, isAnonymous, isAttachedTo, isBound, isEnabled, isVisible, loadConfiguration, notifyCommandContainerHierarchyChanged, putProperties, putProperty, rebind, removeContainerPropertyListener, removeHoverListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, requestFocusIn, setButtonFactory, setEnabled, setMenuFactory, setToolbarFactory, setVisible, toString, unbind, validateId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.pietschy.command.ActionCommandExecutor
addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener
 
Methods inherited from interface com.pietschy.command.Identifiable
getId
 

Constructor Detail

LazyCommand

public LazyCommand()
Constructs a new anonymous instance.


LazyCommand

public LazyCommand(java.lang.String commandId)
Constructs a new command with the specified id.

Parameters:
commandId - the command id.
Method Detail

handleExecute

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

Specified by:
handleExecute in class ActionCommand

build

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


lazyExecute

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



Copyright © 2006 - 2007 Andrew Pietsch