On Sat, May 21, 2011 at 6:48 PM, Rahul Akolkar <[email protected]> wrote: > On Sat, May 21, 2011 at 4:41 PM, Artem Vovk <[email protected]> wrote: >> Hi, >> >> In the document about Authoring Applications for the Multimodal >> Architecture(http://www.w3.org/TR/mmi-auth/), I have noticed an interesting >> <transition> tag : >> >> <!-- handle GUI input --> >> <transition event="mmi:extension" cond="[email protected]() >> == 'GUI' && >> [email protected]() == 'success'" target="echoColor"/> >> <!-- save color to data model --> >> <assign location="_data.color" expr="_event.data..color.toString()"/> >> </transition> >> >> It looks that a data was send with the event and one can access this data >> with _event.data... . How can I send such events from commons scxml to >> scxml document?(with method fireEvent(String event) I can fire only the >> event name, without data) >> > <snip/> > > When you instantiate the TriggerEvent, use the three argument > constructor to add event payload: > > http://commons.apache.org/scxml/0.9/apidocs/org/apache/commons/scxml/TriggerEvent.html#TriggerEvent(java.lang.String, > int, java.lang.Object) > <snip/>
Encoding above to increase chances of a good hyperlink in mail readers: http://commons.apache.org/scxml/0.9/apidocs/org/apache/commons/scxml/TriggerEvent.html#TriggerEvent(java.lang.String%2C%20int%2C%20java.lang.Object) -Rahul > Then, you may refer to the payload Object as _eventdata (in v0.9, in > next release it will change to _event.data as the spec now requires). > > Here is an example from the test suite that uses event payload to > determine transitions to follow; so you can look up syntax (see parent > directory for more samples, syntax depends on EL in use): > > http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/eventdata-02.xml > > -Rahul > > >> Cheers, >> Artem > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
