run event?

8 views
Skip to first unread message

Bob Marinier

unread,
Sep 5, 2012, 1:07:35 PM9/5/12
to jsoar...@googlegroups.com
I have a UI connected to a ThreadedAgent. My UI has a start/run button, and I'm also launching the jsoar debugger. What I would like to do is disable the run button and enable the stop button in my UI when Soar is running, and vice versa when Soar is stopped. There is a stop event I can listen for to update the buttons in that case. But there doesn't appear to be a corresponding run event. There is a isRunning() method, though.

How should I detect if the agent is running or not? I can imagine polling the isRunning() method, but that seems ugly. I can also imagine registering for a phase event on stop, and then unregistering for it when it occurs (if it is even possible to unregister for an event from that event's handler). But these seem pretty complicated just to change button states. (My application is just a simple example, and adding the code to do these things would be a significant increase in the code size.)

My application is available here if the details matter (Java 7 required):

https://github.com/marinier/javafxfun

Any suggestions?

Thanks,
Bob

Dave Ray

unread,
Sep 5, 2012, 1:13:15 PM9/5/12
to jsoar...@googlegroups.com
Huh. That's weird. No StartEvent :)

Well, you could just add one and fire it in ThreadedAgent.runFor()
which is where StopEvent is fired. Otherwise, there's the
SoarProperties.IS_RUNNING property on the agent. You could add a
listener for changes in that property as well.

cheers,

Dave
> --
> You received this message because you are subscribed to the Google Groups
> "jsoar-user" group.
> To post to this group, send email to jsoar...@googlegroups.com.
> To unsubscribe from this group, send email to
> jsoar-user+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jsoar-user?hl=en.

Jonathan Voigt

unread,
Sep 5, 2012, 1:15:00 PM9/5/12
to jsoar...@googlegroups.com
Bob, I can implement this if you want.

Bob Marinier

unread,
Sep 5, 2012, 2:43:18 PM9/5/12
to jsoar...@googlegroups.com
If it's easy, it would make my demo a little cooler, but it's not a big deal if it turns out to be harder than it looks. I'm giving the demo on Tuesday, so if that's not a realistic timeline, then don't worry about it.

Thanks!
Bob
Reply all
Reply to author
Forward
0 new messages