You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Artem Vovk <vo...@googlemail.com> on 2011/05/21 22:41:58 UTC

[scxml] Trigger "complicated" events

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)

Cheers,
Artem

Re: [scxml] Trigger "complicated" events

Posted by Artem Vovk <vo...@googlemail.com>.
Thanks, that's exactly what I want. No encoding problems between mac users :)


On May 22, 2011, at 12:54 AM, Rahul Akolkar wrote:

> On Sat, May 21, 2011 at 6:48 PM, Rahul Akolkar <ra...@gmail.com> wrote:
>> On Sat, May 21, 2011 at 4:41 PM, Artem Vovk <vo...@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)
>> 
> <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: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [scxml] Trigger "complicated" events

Posted by Rahul Akolkar <ra...@gmail.com>.
On Sat, May 21, 2011 at 6:48 PM, Rahul Akolkar <ra...@gmail.com> wrote:
> On Sat, May 21, 2011 at 4:41 PM, Artem Vovk <vo...@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)
>
<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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [scxml] Trigger "complicated" events

Posted by Rahul Akolkar <ra...@gmail.com>.
On Sat, May 21, 2011 at 4:41 PM, Artem Vovk <vo...@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