I also feel like I have already asked this but for life of me I can't find it. If I have please forgive the incompetence.
I have a business object that will have about 10 command handlers associated with it (only two are shown below). The problem is that some of these commands are really complex and should themselves be broken down into "sub" commands. With the exception of the "Summary" all these "sub" commands have their own load/save logic, each being a different "aspect" of an Associate. Each "sub" command is a View inside a ViewContainer controlled by a Menu.
The problem comes up when trying to invoke command based functionally in a child component. For example, queuing an async operation, or executing that operation.
My idea was to create a "Base" View that all the other views would extend and use that base to hold a reference to the actual command and a reference to the Associate instance from the instance list.
Code: Select all
begin_com role(*EXTENDS #PRIM_VIEW) displayposition(1) tabposition(1)
define_com class(#VF_AC010O) name(#Command) reference(*DYNAMIC)
define_com class(#ASCSRHAssociate) name(#Associate) reference(*DYNAMIC)
define_pty name(Command) get(*REFERENCE #Command) set(*REFERENCE #Command)
define_pty name(Associate) get(*REFERENCE #Associate) set(*REFERENCE #Associate)
end_com
I can set those properties from my command as such
Code: Select all
mthroutine name(uExecute) options(*REDEFINE)
if ((#SwitchCallerReference *IsNot *NULL) *And (#SwitchCallerReference *Is #ASCSRHAssociate))
#Associate <= #SwitchCallerReference *As #ASCSRHAssociate
else
#avFrameworkManager.avIssueMessage autoclear(False) requester(#COM_OWNER) text("Missing Current Associate")
endif
endroutine
evtroutine handling(#ViewContainer.ActiveViewChanged)
#CurrentView <= #ViewContainer.ActiveView *As #MGSCommandView
#CurrentView.Command <= #COM_OWNER
#CurrentView.Associate <= #Associate
endroutine
Any thoughts on how to better handle this?
Thanks,
Joe