org.pm4j.core.pm.impl
Class PmCommandProxy

java.lang.Object
  extended by org.pm4j.core.pm.impl.PmObjectBase
      extended by org.pm4j.core.pm.impl.PmCommandImpl
          extended by org.pm4j.core.pm.impl.PmCommandProxy
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<PmObject>, PmCommand, PmObject

public class PmCommandProxy
extends PmCommandImpl

Proxy commands are designed as stand-in's for optionally existing real application commands.

Command proxies do not directly trigger validations. That is the task of the delegateCmd to delegate the call to.

Author:
olaf boede

Nested Class Summary
static class PmCommandProxy.OnMissingDelegate
          Defines, what to do in case of a missing delegate command.
 
Nested classes/interfaces inherited from class org.pm4j.core.pm.impl.PmCommandImpl
PmCommandImpl.MetaData
 
Nested classes/interfaces inherited from class org.pm4j.core.pm.impl.PmObjectBase
PmObjectBase.NameBuilder, PmObjectBase.NameBuilderAbsoluteName, PmObjectBase.NameBuilderShortName, PmObjectBase.NameBuilderTitle
 
Nested classes/interfaces inherited from interface org.pm4j.core.pm.PmCommand
PmCommand.CmdKind, PmCommand.CommandSet, PmCommand.CommandState
 
Field Summary
 
Fields inherited from class org.pm4j.core.pm.impl.PmCommandImpl
NAVI_PARAM_NEXT_DLG_PM, PERFORMED_REDIRECT
 
Fields inherited from class org.pm4j.core.pm.impl.PmObjectBase
pmCacheLog
 
Fields inherited from interface org.pm4j.core.pm.PmObject
STYLE_CLASS_DISABLED, STYLE_CLASS_ERROR, STYLE_CLASS_INFO, STYLE_CLASS_REQUIRED, STYLE_CLASS_WARN
 
Constructor Summary
PmCommandProxy(PmObject pmParent)
          Defines a proxy that gets disabled if there is no forward command defined.
PmCommandProxy(PmObject pmParent, PmCommandProxy.OnMissingDelegate onMissingDelegate)
           
 
Method Summary
 PmCommand doIt(boolean changeCommandHistory)
          Returns the clone of the delegate that has been executed.
protected  void doItImpl()
          Subclasses may implement here their concrete logic.
protected  boolean isPmEnabledImpl()
          The default implementation checks the own enabled flag and the enablement of its parent context element.
protected  boolean isPmVisibleImpl()
           
 void setDelegateCmd(PmCommand delegateCmd)
          Defines the command that really executes the tool bar command functionality.
 
Methods inherited from class org.pm4j.core.pm.impl.PmCommandImpl
accept, actionReturnOnFailure, addCommandDecorator, afterDo, beforeDo, clone, doIt, doItReturnNextDlgPm, doItReturnString, doItReturnVoid, getCmdKind, getCommandState, getNavigateBackLink, getNaviLink, getNaviLinkImpl, getParentCommands, getUndoCommand, getVetoCommandDecorator, getVisiblePmCommands, initMetaData, isASubCommandEnabled, isASubCommandVisible, isRequiresValidValues, makeMetaData, makeOptionalSuccessMsg, navigateBack, navigateTo, setNaviLink, setUndoCommand, validate
 
Methods inherited from class org.pm4j.core.pm.impl.PmObjectBase
addToPmComposite, canSetPmTitle, clearCachedPmValues, clearPmInvalidValues, compareTo, ensurePmMetaDataInitialization, findAnnotationsInPmHierarchy, getPmConversation, getPmConversationImpl, getPmIconPath, getPmMetaData, getPmMetaDataWithoutPmInitCall, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmResKey, getPmResKeyBase, getPmResLoaderCtxtClasses, getPmShortTitle, getPmStyleClasses, getPmStyleClassesImpl, getPmTitle, getPmTitleDef, getPmTitleImpl, getPmTooltip, getPmTooltipImpl, getVisiblePmCommands, isMetaDataInitialized, isPmEnabled, isPmReadonly, isPmReadonlyImpl, isPmValid, isPmVisible, onPmChildStateChange, onPmInit, onPmValueChange, readCacheStrategy, removePmChild, setPmEnabled, setPmParent, setPmProperty, setPmTitle, setPmVisible, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.pm4j.core.pm.PmObject
canSetPmTitle, compareTo, getPmConversation, getPmIconPath, getPmName, getPmParent, getPmProperty, getPmRelativeName, getPmShortTitle, getPmStyleClasses, getPmTitle, getPmTooltip, isPmEnabled, isPmReadonly, isPmValid, isPmVisible, setPmEnabled, setPmParent, setPmProperty, setPmTitle, setPmVisible
 

Constructor Detail

PmCommandProxy

public PmCommandProxy(PmObject pmParent,
                      PmCommandProxy.OnMissingDelegate onMissingDelegate)
Parameters:
pmParent - The PM tree parent.
onMissingDelegate - Defines what to do in case of a missing forward command.

PmCommandProxy

public PmCommandProxy(PmObject pmParent)
Defines a proxy that gets disabled if there is no forward command defined.

Parameters:
pmParent - The PM tree parent.
Method Detail

isPmEnabledImpl

protected boolean isPmEnabledImpl()
Description copied from class: PmCommandImpl
The default implementation checks the own enabled flag and the enablement of its parent context element.

If the command is child of a command (group), the enablement of the first non-command parent will be checked.

Overrides:
isPmEnabledImpl in class PmCommandImpl

isPmVisibleImpl

protected boolean isPmVisibleImpl()
Overrides:
isPmVisibleImpl in class PmCommandImpl

doItImpl

protected void doItImpl()
                 throws java.lang.Exception
Description copied from class: PmCommandImpl
Subclasses may implement here their concrete logic.

Overrides:
doItImpl in class PmCommandImpl
Throws:
java.lang.Exception - In case of an unexpected failure.

doIt

public PmCommand doIt(boolean changeCommandHistory)
Returns the clone of the delegate that has been executed.

Overrides:
doIt in class PmCommandImpl
Returns:

setDelegateCmd

public void setDelegateCmd(PmCommand delegateCmd)
Defines the command that really executes the tool bar command functionality.

Parameters:
delegateCmd - The command that defines the logic.