<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Up a Tree Without a Paddle (and Down Again)</title>
	<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/</link>
	<description>Just another WordPress weblog</description>
	<pubDate>Thu, 21 Aug 2008 15:19:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: SIyer</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-338</link>
		<dc:creator>SIyer</dc:creator>
		<pubDate>Wed, 13 Jun 2007 11:51:28 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-338</guid>
		<description>A good and clear post on dynamic tree loading. Though I see this has been written almost a year ago, I don't find any official documentation from Adobe on dynamic tree loading even today. This gives me a feel that though all the videos and tutorials make flex development appear like a childs play, it will be sometime before we can build truly enterprise class applications using Flex.</description>
		<content:encoded><![CDATA[<p>A good and clear post on dynamic tree loading. Though I see this has been written almost a year ago, I don&#8217;t find any official documentation from Adobe on dynamic tree loading even today. This gives me a feel that though all the videos and tutorials make flex development appear like a childs play, it will be sometime before we can build truly enterprise class applications using Flex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-337</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 08 Nov 2006 23:45:25 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-337</guid>
		<description>Thanks for you help.  I took your advice and now it is working great.   I made my collections inherit from ArrayCollections (rather than Array) and returned them directly.  As I understand it the ArrayCollections are basically wrappers around Arrays that are given the additional responsibility of broadcating events when the underlying array is altered.  The tree must be making use of these events for its internal bookkeeping.   Thanks again!

  I owe you one!</description>
		<content:encoded><![CDATA[<p>Thanks for you help.  I took your advice and now it is working great.   I made my collections inherit from ArrayCollections (rather than Array) and returned them directly.  As I understand it the ArrayCollections are basically wrappers around Arrays that are given the additional responsibility of broadcating events when the underlying array is altered.  The tree must be making use of these events for its internal bookkeeping.   Thanks again!</p>
<p>  I owe you one!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joe</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-336</link>
		<dc:creator>joe</dc:creator>
		<pubDate>Wed, 01 Nov 2006 11:30:07 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-336</guid>
		<description>Michael, I can't post our entire ITreeDataDescriptor class source because it has content that's proprietary to Allurent.  I wrote this article in order to convey the exact sense of what we were doing, without actually sharing the code.

One problem I see off the bat is that your code doesn't apply "Rule 2: Always return the same identical object from a call to getChildren() for a given value of the node argument."  Because you're calling new ArrayCollection() every time, this would tend to throw off the bookkeeping inside Tree.

It would be easier for you if the collections inside your nodes (.circulars, .pages, etc.) were already instances of ArrayCollection.  Then you wouldn't have to wrap them in anything.

You weren't specific about what "previously loaded" data meant, but the other thing I'd do is make absolutely sure that the events that fire when your loading operation completes are passing back the correct, newly loaded data set.  There might be a problem in there somewhere.  That's beyond the scope of what I could help with though.</description>
		<content:encoded><![CDATA[<p>Michael, I can&#8217;t post our entire ITreeDataDescriptor class source because it has content that&#8217;s proprietary to Allurent.  I wrote this article in order to convey the exact sense of what we were doing, without actually sharing the code.</p>
<p>One problem I see off the bat is that your code doesn&#8217;t apply &#8220;Rule 2: Always return the same identical object from a call to getChildren() for a given value of the node argument.&#8221;  Because you&#8217;re calling new ArrayCollection() every time, this would tend to throw off the bookkeeping inside Tree.</p>
<p>It would be easier for you if the collections inside your nodes (.circulars, .pages, etc.) were already instances of ArrayCollection.  Then you wouldn&#8217;t have to wrap them in anything.</p>
<p>You weren&#8217;t specific about what &#8220;previously loaded&#8221; data meant, but the other thing I&#8217;d do is make absolutely sure that the events that fire when your loading operation completes are passing back the correct, newly loaded data set.  There might be a problem in there somewhere.  That&#8217;s beyond the scope of what I could help with though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-335</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 01 Nov 2006 01:25:15 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-335</guid>
		<description>Hey Joe ...
  First off, thanks for posting info on this.   I have been trying for 2 days create a tree that loads on demand.  I am really struggling.  I would really appreciate it if you would post your ITreeDataDescriptor Class.  I am going to post mine below.   The first time I open a dynamic branch it works perfectly.  The 2nd through N times all open branches show the data retrieved on the last call.. make sence?   Thanks for the time and attention!!   I hope to return the favor one day!

	public function getChildren(node:Object, model:Object=null):ICollectionView
	{
 		if (node is EnvironmentVO)
 			return ICollectionView(new ArrayCollection(EnvironmentVO(node).circulars));
		if (node is CircularVO)
			return ICollectionView(new ArrayCollection(CircularVO(node).pages));
		if (node is PageVO)
			return ICollectionView(new ArrayCollection(PageVO(node).items));
		return null;
	}
	public function hasChildren(node:Object, model:Object=null):Boolean
	{
		if (node is EnvironmentVO) return true;
		if (node is CircularVO)
		{
			if (CircularVO(node).pages.length==0){
				CircularVO(node).pages.push(new PageVO({name:'loading'}));
				var cmd:CmdEvent = new CmdEvent(Controller.EVENT_DataLoadPageList);
				cmd.data = CircularVO(node);
				Controller.getInstance().executeCommand(cmd);
				return false;
			}else if (CircularVO(node).pages.length==1){
				if (PageVO(CircularVO(node).pages[0]).name=="loading")
				return false;
			}
			return true;
		}
		if (node is PageVO) return true;  // Got To Get The Top Level Working First!!
		if (node is ItemVO) return false;
		return false;
	}
	public function isBranch(node:Object, model:Object=null):Boolean
	{
		if (node is EnvironmentVO) return true;
		if (node is CircularVO) return true;
		if (node is PageVO) return true;
		if (node is ItemVO) return false;
		return false;
	}</description>
		<content:encoded><![CDATA[<p>Hey Joe &#8230;<br />
  First off, thanks for posting info on this.   I have been trying for 2 days create a tree that loads on demand.  I am really struggling.  I would really appreciate it if you would post your ITreeDataDescriptor Class.  I am going to post mine below.   The first time I open a dynamic branch it works perfectly.  The 2nd through N times all open branches show the data retrieved on the last call.. make sence?   Thanks for the time and attention!!   I hope to return the favor one day!</p>
<p>	public function getChildren(node:Object, model:Object=null):ICollectionView<br />
	{<br />
 		if (node is EnvironmentVO)<br />
 			return ICollectionView(new ArrayCollection(EnvironmentVO(node).circulars));<br />
		if (node is CircularVO)<br />
			return ICollectionView(new ArrayCollection(CircularVO(node).pages));<br />
		if (node is PageVO)<br />
			return ICollectionView(new ArrayCollection(PageVO(node).items));<br />
		return null;<br />
	}<br />
	public function hasChildren(node:Object, model:Object=null):Boolean<br />
	{<br />
		if (node is EnvironmentVO) return true;<br />
		if (node is CircularVO)<br />
		{<br />
			if (CircularVO(node).pages.length==0){<br />
				CircularVO(node).pages.push(new PageVO({name:&#8217;loading&#8217;}));<br />
				var cmd:CmdEvent = new CmdEvent(Controller.EVENT_DataLoadPageList);<br />
				cmd.data = CircularVO(node);<br />
				Controller.getInstance().executeCommand(cmd);<br />
				return false;<br />
			}else if (CircularVO(node).pages.length==1){<br />
				if (PageVO(CircularVO(node).pages[0]).name==&#8221;loading&#8221;)<br />
				return false;<br />
			}<br />
			return true;<br />
		}<br />
		if (node is PageVO) return true;  // Got To Get The Top Level Working First!!<br />
		if (node is ItemVO) return false;<br />
		return false;<br />
	}<br />
	public function isBranch(node:Object, model:Object=null):Boolean<br />
	{<br />
		if (node is EnvironmentVO) return true;<br />
		if (node is CircularVO) return true;<br />
		if (node is PageVO) return true;<br />
		if (node is ItemVO) return false;<br />
		return false;<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozren</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-334</link>
		<dc:creator>Ozren</dc:creator>
		<pubDate>Wed, 18 Oct 2006 21:31:42 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-334</guid>
		<description>Hello all,

I am trying to create a dinamic tree, but i just can get it to work. Can someone please post the code here, not everything but just the way i can handle results and insert them to my tree component. Btw, i got it to work with addChildAt, but it works if my result only has one XML row like "".

thx in advanced</description>
		<content:encoded><![CDATA[<p>Hello all,</p>
<p>I am trying to create a dinamic tree, but i just can get it to work. Can someone please post the code here, not everything but just the way i can handle results and insert them to my tree component. Btw, i got it to work with addChildAt, but it works if my result only has one XML row like &#8220;&#8221;.</p>
<p>thx in advanced</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Kurth</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-333</link>
		<dc:creator>Benjamin Kurth</dc:creator>
		<pubDate>Fri, 15 Sep 2006 19:40:26 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-333</guid>
		<description>Many thanks to Marcel Fahle for the dummy "...loading" node technique - this did the trick for me.

I did have to add a call to invalidateList() to get the expanded branch to refresh the display, revealing the newly added node(s):

Tree(event.target).dataDescriptor.addChildAt(selectedResultNode,{label:"item1 child"},0);
		Tree(event.target).invalidateList();</description>
		<content:encoded><![CDATA[<p>Many thanks to Marcel Fahle for the dummy &#8220;&#8230;loading&#8221; node technique - this did the trick for me.</p>
<p>I did have to add a call to invalidateList() to get the expanded branch to refresh the display, revealing the newly added node(s):</p>
<p>Tree(event.target).dataDescriptor.addChildAt(selectedResultNode,{label:&#8221;item1 child&#8221;},0);<br />
		Tree(event.target).invalidateList();</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: joe</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-332</link>
		<dc:creator>joe</dc:creator>
		<pubDate>Tue, 29 Aug 2006 11:31:33 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-332</guid>
		<description>Glad that worked for you, Marcel.  I think you understood the approach.

You are using XMLListCollection, and we are using an ArrayCollection (or something like it).  Perhaps that explains why you need your "lonely node" for the tree to work correctly.  We didn't seem to need such a node.

There are still some bugs in Tree that can occur when scrolling around as data is added.  Overall it is still in a delicate condition and I don't think this control is completely solid yet.</description>
		<content:encoded><![CDATA[<p>Glad that worked for you, Marcel.  I think you understood the approach.</p>
<p>You are using XMLListCollection, and we are using an ArrayCollection (or something like it).  Perhaps that explains why you need your &#8220;lonely node&#8221; for the tree to work correctly.  We didn&#8217;t seem to need such a node.</p>
<p>There are still some bugs in Tree that can occur when scrolling around as data is added.  Overall it is still in a delicate condition and I don&#8217;t think this control is completely solid yet.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcel Fahle</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-331</link>
		<dc:creator>Marcel Fahle</dc:creator>
		<pubDate>Wed, 23 Aug 2006 10:36:48 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-331</guid>
		<description>Joe, you made my day!! The words "... to signal the children’s arrival" gave me the right direction to solve my tree problem.
My problem was this:
I built a "lazy tree" myself, but everytime I added new Data to the DataProvider (XMLListCollection), the nodes in my tree got totally messed when scrolling around.
So, after I read your post I tried to prepare each branchNode for the later arrival of new childNodes.
What I did was to add on every branch node a single empty node with a label "...loading". And when the user clicks on the node to open it, the lonely loading-node gets replaced by the new real-nodes coming as xml from my streaming server. I don't know if it is the most elegant way to do this, but it works like a charm! thanks for giving me the right direction! :)</description>
		<content:encoded><![CDATA[<p>Joe, you made my day!! The words &#8220;&#8230; to signal the children’s arrival&#8221; gave me the right direction to solve my tree problem.<br />
My problem was this:<br />
I built a &#8220;lazy tree&#8221; myself, but everytime I added new Data to the DataProvider (XMLListCollection), the nodes in my tree got totally messed when scrolling around.<br />
So, after I read your post I tried to prepare each branchNode for the later arrival of new childNodes.<br />
What I did was to add on every branch node a single empty node with a label &#8220;&#8230;loading&#8221;. And when the user clicks on the node to open it, the lonely loading-node gets replaced by the new real-nodes coming as xml from my streaming server. I don&#8217;t know if it is the most elegant way to do this, but it works like a charm! thanks for giving me the right direction! :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcel Fahle</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-330</link>
		<dc:creator>Marcel Fahle</dc:creator>
		<pubDate>Wed, 23 Aug 2006 08:43:34 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-330</guid>
		<description>Hi Joe,

thanks for this post! I fully understand the theory behind that, but I don't really get it how for example rule 1 could be translated to code. That what you described is in my problem exactly the case. isBranch returns true and hasChildren returns false. How do I force the ITreeDataDescriptor to return true on hasChildren? Do I have to write my own custom datadescriptor? Sorry for that dumb question but I really don't get it.. Maybe you can post a little code snippet?
Thanks in advance!</description>
		<content:encoded><![CDATA[<p>Hi Joe,</p>
<p>thanks for this post! I fully understand the theory behind that, but I don&#8217;t really get it how for example rule 1 could be translated to code. That what you described is in my problem exactly the case. isBranch returns true and hasChildren returns false. How do I force the ITreeDataDescriptor to return true on hasChildren? Do I have to write my own custom datadescriptor? Sorry for that dumb question but I really don&#8217;t get it.. Maybe you can post a little code snippet?<br />
Thanks in advance!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos Rovira</title>
		<link>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-329</link>
		<dc:creator>Carlos Rovira</dc:creator>
		<pubDate>Thu, 22 Jun 2006 19:53:34 +0000</pubDate>
		<guid>http://www.joeberkovitz.com/blog/2006/06/21/up-a-tree-without-a-paddle-and-down-again/#comment-329</guid>
		<description>Hi Joe,

I post about the SVN idea in flexcoders and Matt Chotin responded that they were thinking in do something like that, but they want to think a little about how to manage the support.

I think that Adobe will surprise again to their developers if they show such innovative way to do their support and I don't think it will be bad for them, it should be very positive and make people trust them and go the flex way.

I'm afraid that the conservative way (give full updates from time to time) will be very bad, since people stuck and frustrade will drop flex and go other ways they know better and have less surprises.</description>
		<content:encoded><![CDATA[<p>Hi Joe,</p>
<p>I post about the SVN idea in flexcoders and Matt Chotin responded that they were thinking in do something like that, but they want to think a little about how to manage the support.</p>
<p>I think that Adobe will surprise again to their developers if they show such innovative way to do their support and I don&#8217;t think it will be bad for them, it should be very positive and make people trust them and go the flex way.</p>
<p>I&#8217;m afraid that the conservative way (give full updates from time to time) will be very bad, since people stuck and frustrade will drop flex and go other ways they know better and have less surprises.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
