org.pm4j.core.pm.impl.commands
Class PmCommandNaviBack

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.commands.PmCommandNaviBack
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<PmObject>, PmCommand, PmObject

public class PmCommandNaviBack
extends PmCommandImpl

Navigates back to the previous page.
It is intended for the usual 'Cancel' button functionality. So, it does not trigger PM attribute validation.
That validation may be overridden by subclasses or just by specifying 'requiresValidValues=true' using a PmCommandCfg annotation.

In some cases there might be no previous page. (E.g. in case of an application session that was started by a bookmark.) In this case it navigates back to the (optionally configured) start link.

If both are not available, the command will be disabled.

Attention: This command will only work when the navigation history is enabled.

Author:
olaf boede

Nested Class Summary
 
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
PmCommandNaviBack(PmObject pm, org.pm4j.navi.NaviLink... linksToSkip)
           
 
Method Summary
protected  void doItImpl()
          Updates the back-navigation link based on the current navigation history state.
protected  boolean isPmEnabledImpl()
          Is only enabled when there is a back-navigation link.
protected  void onPmInit()
          Sets the fix link value before command execution.
 
Methods inherited from class org.pm4j.core.pm.impl.PmCommandImpl
accept, actionReturnOnFailure, addCommandDecorator, afterDo, beforeDo, clone, doIt, doIt, doItReturnNextDlgPm, doItReturnString, doItReturnVoid, getCmdKind, getCommandState, getNavigateBackLink, getNaviLink, getNaviLinkImpl, getParentCommands, getUndoCommand, getVetoCommandDecorator, getVisiblePmCommands, initMetaData, isASubCommandEnabled, isASubCommandVisible, isPmVisibleImpl, 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, 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

PmCommandNaviBack

public PmCommandNaviBack(PmObject pm,
                         org.pm4j.navi.NaviLink... linksToSkip)
Parameters:
pm - The parent PM.
linksToSkip - An optional set of links to skip on back navigation.
Method Detail

onPmInit

protected void onPmInit()
Sets the fix link value before command execution.
That allows to use this command for static web client links that never execute the command and only ask PmCommandImpl.getNaviLink().

But: Be careful if the navigation path changes during the live time of this instance. In this case you should ask only the executed command instance for the real navigation link.

Overrides:
onPmInit in class PmObjectBase

isPmEnabledImpl

protected boolean isPmEnabledImpl()
Is only enabled when there is a back-navigation link.

Overrides:
isPmEnabledImpl in class PmCommandImpl

doItImpl

protected void doItImpl()
                 throws java.lang.Exception
Updates the back-navigation link based on the current navigation history state.

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