<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Chaining commands in Cairngorm with Prana</title>
	<atom:link href="http://www.herrodius.com/blog/80/feed" rel="self" type="application/rss+xml" />
	<link>http://www.herrodius.com/blog/80</link>
	<description>Thoughts from a software developer</description>
	<lastBuildDate>Wed, 10 Mar 2010 12:47:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ahmad</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13664</link>
		<dc:creator>Ahmad</dc:creator>
		<pubDate>Wed, 24 Sep 2008 10:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13664</guid>
		<description>Hello Chris,

I didn&#039;t try this .. but the idea seems very nice to me. And I can already think of some places in my code where to use this and it could become very handy.

I have not used sequence commands before, what i did was firing a complete event at the end of a command, which will be listened to by the view, and so it would fire the next event to run the next command! which is not a very handy way.

Do you think it would be good to adjust the addSequenceEvent, so it can take also an event type which would be the trigger to dispatch the next event?

// Wait for “userInfoReadyEvent” to be dispatched, then dispatch “LoadPrivateMessagesEvent”
sequence.addSequenceEvent(
  LoadPrivateMessagesEvent,
  [new Property(ModelLocator.getInstance, &quot;user&quot;, &quot;id&quot;)],
  [new Property(ModelLocator.getInstance, &quot;user&quot;)], “userInfoReadyEvent”
);</description>
		<content:encoded><![CDATA[<p>Hello Chris,</p>
<p>I didn&#8217;t try this .. but the idea seems very nice to me. And I can already think of some places in my code where to use this and it could become very handy.</p>
<p>I have not used sequence commands before, what i did was firing a complete event at the end of a command, which will be listened to by the view, and so it would fire the next event to run the next command! which is not a very handy way.</p>
<p>Do you think it would be good to adjust the addSequenceEvent, so it can take also an event type which would be the trigger to dispatch the next event?</p>
<p>// Wait for “userInfoReadyEvent” to be dispatched, then dispatch “LoadPrivateMessagesEvent”<br />
sequence.addSequenceEvent(<br />
  LoadPrivateMessagesEvent,<br />
  [new Property(ModelLocator.getInstance, "user", "id")],<br />
  [new Property(ModelLocator.getInstance, "user")], “userInfoReadyEvent”<br />
);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13432</link>
		<dc:creator>Christophe</dc:creator>
		<pubDate>Thu, 10 Apr 2008 19:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13432</guid>
		<description>Hi Douglas,

conditional event sequences would be a great feature! I think they could be implemented with a combination of the Property class we now have and some kind of Specification or Criteria implementation.

For now I would just set the second event up to listen for a change to a flag in the modellocator (e.g. newDataAvailable). That change would be a flag that is set only if their is new data detected on the server. If it is set (changed from &quot;false&quot; to &quot;true&quot;) then the sequence will continue. If there is no new data, then don&#039;t update the flag in the result of your command. The sequence will hence never reach the second event and will not continue.

Does that make sense?

regards,
Christophe</description>
		<content:encoded><![CDATA[<p>Hi Douglas,</p>
<p>conditional event sequences would be a great feature! I think they could be implemented with a combination of the Property class we now have and some kind of Specification or Criteria implementation.</p>
<p>For now I would just set the second event up to listen for a change to a flag in the modellocator (e.g. newDataAvailable). That change would be a flag that is set only if their is new data detected on the server. If it is set (changed from &#8220;false&#8221; to &#8220;true&#8221;) then the sequence will continue. If there is no new data, then don&#8217;t update the flag in the result of your command. The sequence will hence never reach the second event and will not continue.</p>
<p>Does that make sense?</p>
<p>regards,<br />
Christophe</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas McCarroll</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13422</link>
		<dc:creator>Douglas McCarroll</dc:creator>
		<pubDate>Wed, 09 Apr 2008 18:48:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13422</guid>
		<description>Hi Christophe,

I have a related question. This works well for chaining commands, but what do you do if you need conditional logic? 

For example, I&#039;m working with synchronizing server &amp; client data so I need logic that says &quot;1) check the server to see if there&#039;s new data and, *if* there is, 2) clear the model, 3) clear the local (SQLite) DB, 4) store the new data in the DB, then 5) recreate the model from the local DB&quot;.

Obviously, several of these actions are asynchronous and will be implemented (in Cairngorm) with commands that use service delegates.

And it seems that (2)-(5) could easily be chained by subclassing EventSequence.

But where/how would you implement the &quot;if&quot; logic?

Douglas</description>
		<content:encoded><![CDATA[<p>Hi Christophe,</p>
<p>I have a related question. This works well for chaining commands, but what do you do if you need conditional logic? </p>
<p>For example, I&#8217;m working with synchronizing server &amp; client data so I need logic that says &#8220;1) check the server to see if there&#8217;s new data and, *if* there is, 2) clear the model, 3) clear the local (SQLite) DB, 4) store the new data in the DB, then 5) recreate the model from the local DB&#8221;.</p>
<p>Obviously, several of these actions are asynchronous and will be implemented (in Cairngorm) with commands that use service delegates.</p>
<p>And it seems that (2)-(5) could easily be chained by subclassing EventSequence.</p>
<p>But where/how would you implement the &#8220;if&#8221; logic?</p>
<p>Douglas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13160</link>
		<dc:creator>Christophe</dc:creator>
		<pubDate>Wed, 05 Mar 2008 10:26:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13160</guid>
		<description>Hi Sefi,

thanks for reporting this. I&#039;ll file a bug and look into it soon. Try checking the bug tracker on the sourceforge account for a resolution (if any) in the coming days.</description>
		<content:encoded><![CDATA[<p>Hi Sefi,</p>
<p>thanks for reporting this. I&#8217;ll file a bug and look into it soon. Try checking the bug tracker on the sourceforge account for a resolution (if any) in the coming days.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sefi</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13159</link>
		<dc:creator>Sefi</dc:creator>
		<pubDate>Wed, 05 Mar 2008 09:42:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13159</guid>
		<description>Hi Christophe,

I tried using this solution and observed a glitch.
I have a command that updates the ModelLocator, and I want to dispatch another command after it. The thing is that the variable in the ModelLocator is an int that has a default value (0) and if the command updates it with the same value, the next command in the EventSequence isn&#039;t being dispatched. I guess it&#039;s a BindingUtils glitch, but still...</description>
		<content:encoded><![CDATA[<p>Hi Christophe,</p>
<p>I tried using this solution and observed a glitch.<br />
I have a command that updates the ModelLocator, and I want to dispatch another command after it. The thing is that the variable in the ModelLocator is an int that has a default value (0) and if the command updates it with the same value, the next command in the EventSequence isn&#8217;t being dispatched. I guess it&#8217;s a BindingUtils glitch, but still&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas McCarroll</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13149</link>
		<dc:creator>Douglas McCarroll</dc:creator>
		<pubDate>Mon, 25 Feb 2008 14:55:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13149</guid>
		<description>Thanks, Christophe. I&#039;m happy to report that I found it pretty easy to understand and use EventSequence. I think that I downloaded it after you&#039;d upgraded those comments...</description>
		<content:encoded><![CDATA[<p>Thanks, Christophe. I&#8217;m happy to report that I found it pretty easy to understand and use EventSequence. I think that I downloaded it after you&#8217;d upgraded those comments&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13147</link>
		<dc:creator>Christophe</dc:creator>
		<pubDate>Sat, 23 Feb 2008 06:00:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13147</guid>
		<description>Hi Douglas,

at this time there is no example available. I&#039;ll put it on the TODO list for the next release.

If this helps, I added more documentation to the EventSequence class some days ago. http://prana.svn.sourceforge.net/viewvc/prana/trunk/main/src/org/pranaframework/cairngorm/EventSequence.as?view=markup</description>
		<content:encoded><![CDATA[<p>Hi Douglas,</p>
<p>at this time there is no example available. I&#8217;ll put it on the TODO list for the next release.</p>
<p>If this helps, I added more documentation to the EventSequence class some days ago. <a href="http://prana.svn.sourceforge.net/viewvc/prana/trunk/main/src/org/pranaframework/cairngorm/EventSequence.as?view=markup" rel="nofollow">http://prana.svn.sourceforge.net/viewvc/prana/trunk/main/src/org/pranaframework/cairngorm/EventSequence.as?view=markup</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Douglas McCarroll</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-13145</link>
		<dc:creator>Douglas McCarroll</dc:creator>
		<pubDate>Fri, 22 Feb 2008 18:14:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-13145</guid>
		<description>Christophe - Do you have a working example project that uses this? I can&#039;t find anything of the sort in the SVN...</description>
		<content:encoded><![CDATA[<p>Christophe &#8211; Do you have a working example project that uses this? I can&#8217;t find anything of the sort in the SVN&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian Zarzycki</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-12823</link>
		<dc:creator>Sebastian Zarzycki</dc:creator>
		<pubDate>Mon, 07 Jan 2008 17:02:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-12823</guid>
		<description>&quot;PendingCommandRegistry.getInstance().unregister(this);&quot;

- is this implemented? (the launch of trigger for next event) In 0.3.1 all I see is custom event dispatched, but is never used. The triggers for next commands cannot rely just on some model binding. The manual option to trigger next event (end of command execution) is extremely useful.</description>
		<content:encoded><![CDATA[<p>&#8220;PendingCommandRegistry.getInstance().unregister(this);&#8221;</p>
<p>- is this implemented? (the launch of trigger for next event) In 0.3.1 all I see is custom event dispatched, but is never used. The triggers for next commands cannot rely just on some model binding. The manual option to trigger next event (end of command execution) is extremely useful.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bjorn</title>
		<link>http://www.herrodius.com/blog/80/comment-page-1#comment-12804</link>
		<dc:creator>Bjorn</dc:creator>
		<pubDate>Mon, 07 Jan 2008 04:58:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.herrodius.com/blog/?p=80#comment-12804</guid>
		<description>In terms of where to create event sequences, usually events don&#039;t contain references to the ModelLocator.

Is an EventSequence instance to be treated similar to an Event instance?

Should an event sequence be created in a command?</description>
		<content:encoded><![CDATA[<p>In terms of where to create event sequences, usually events don&#8217;t contain references to the ModelLocator.</p>
<p>Is an EventSequence instance to be treated similar to an Event instance?</p>
<p>Should an event sequence be created in a command?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
