commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rahul Akolkar <rahul.akol...@gmail.com>
Subject Re: [scxml] Trigger "complicated" events
Date Sat, 21 May 2011 22:48:30 GMT
On Sat, May 21, 2011 at 4:41 PM, Artem Vovk <vovk.artem@googlemail.com> 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="_event.data..@source.toString() == 'GUI'
&&
>         _event.data..@status.toString() == '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)

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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message