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] Transition/Var question
Date Mon, 02 Mar 2009 13:08:24 GMT
On Mon, Mar 2, 2009 at 5:07 AM, Linda Erlenhov <linda.erlenhov@gmail.com> wrote:
> Hello
>
> Yes this is what I want to do, but I don´t understand how (1) is done. With
> the getEngine you get the rootContext, The rootContext describes ALL var:s
> in the StateMachine as I understand,
<snip/>

No, just the bits defined in the root datamodel (child of <scxml>) and
any injected programmatically. This can be changed, but thats the
default behavior.


> so then it should be the context
> associated with the transition I want. How do I do that? The transition type
> doesn´t have a name and I can´t find a method that takes an "executable
> object"ish and returns something that I want.
>
<snap/>

In (1) below, we were identifying the value of the name attribute of
the <assign>. Given that you have a listener in use,
SCXMLListener#onTransition() provides a handle to the Transition
object -- iterate over the list of actions using
Transition#getActions() to find this assign action, then use
Assign#getName().

-Rahul


> best regards
> //Linda
>
> On Sat, Feb 28, 2009 at 6:20 AM, Rahul Akolkar <rahul.akolkar@gmail.com>wrote:
>
>> On Fri, Feb 27, 2009 at 7:06 AM, Linda Erlenhov
>> <linda.erlenhov@gmail.com> wrote:
>> > Hello again!
>> >
>> >
>> >> <snip>
>> >>
>> >> followed by introspection like so:
>> >>
>> >>    getEngine().getRootContext().get("outcome");
>> >>
>> >> </snip>
>> >
>> > The problem with that approach is that i won´t know the names of my
>> "var":s.
>> >
>> > The idéa is:
>> > I´m building an graphical editor for Statecharts, where you can model a
>> > statemachine with some simple drag and drop actions. When your satisfied
>> > with your machine the editor generates an SCXML-file which then is meant
>> to
>> > be run. Everything I do has to be "generic" so what I wanted was a way
>> to,
>> > when the listner registers an "onTransition" ( the class Implements the
>> > SCXMLListener interface) move:
>> > 1. Check if there is an "var" associated with that transition
>> > 2. If so, fetch the exp.
>> >
>> <snip/>
>>
>> IIUC, for (1), introspect the Transition object (the list of actions
>> therein). (2) is above (replace the String constant "outcome" with the
>> value obtained in 1).
>>
>> -Rahul
>>
>>
>> > best regards
>> > //Linda
>> >
>>

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


Mime
View raw message