Any possible way to make modular communication work in COMMAND Partern like ordinary robotlegs
Hi,everyone.
I have a question when I use org.robotlegs.utilities.modular to
communicate between two modulars.
When I dipatch an inner-Event in Modular A ,It is obviously the
mapped Command will excute.
But before I dispatchToModules a outer-Event in Modular A,I should
set a "addEventListener" in Modular B in order to catch the
outer-Event , then do some thing I want in this event Handler,it is
unflexible.
I just want to make modular communication in Command Partern just
like inner-Event do.
thanks for helping me
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Ondina D.F. on 29 Feb, 2012 11:11 AM
Hi Dante,
All you have to do is:
moduleCommandMap.mapEvent(SomeModuleEvent.TRIGGER_COMMAND, SomeModuleCommand, SomeModuleEvent);
moduleDispatcher.dispatchEvent(new SomeModuleEvent (SomeModuleEvent.TRIGGER_COMMAND));
In SomeModuleCommand you can also dispatch events, if need be:
[1] inter-module communication:
eventMap.mapListener(moduleDispatcher, SomeModuleEvent.MESSAGE, handleModuleMessage);
[2] within a module:
eventMap.mapListener(eventDispatcher, SomeModuleEvent.MESSAGE, handleModuleMessage);
If this doesn’t answer your question, please explain more clearly what you want to achieve :)
Ondina
Ondina D.F. closed this discussion on 30 Mar, 2012 08:59 AM.