views:

59

answers:

1

a bit confused as to how my XML config file would change when switching over to Signals. Right now the 3 framework Commands I am using are defined as follows. Both ViewChangedCommand and the InitViewCommand are mapped to custom events.

<type name='app.controller::StartupCommand'> 
    <field name='dataService'/> 
</type> 
<type name='app.controller::ViewChangedCommand'> 
    <field name='event'/> 
    <field name='model'/> 
</type> 
<type name='app.controller::InitViewCommand'> 
    <field name='model'/> 
</type> 
A: 

can't say for sure about the XML config, but here's how to do it in code:

you have to use a SignalContext instead of the normal Context. This can be done using this library :

http://github.com/joelhooks/signals-extensions-CommandSignal/tree/48575b214da452e8c78d9eb2897bd018b1deaf3a

in the context, inject a singleton of the Signal, as if it was part of the model, like so :

injector.mapSingleton(DataLoadSignal);

then map the signal to a command, like so :

signalCommandMap.mapSignalClass(DataLoadSignal, DataLoadCommand, false);

for the xml config, I guess you only have to inject the signal, and the rest should be fairly easy.

Benoit Jadinon