Re: [flexcoders] Re: Flex Tree having 20000 nodes crashes

2008-08-04 Thread Jon Bradley


On Aug 4, 2008, at 10:48 AM, Guilherme Blanco wrote:


I have implemented a DynamicTree for my own usage, after spending
almost a week looking for an URL about this subject.
Until now, I haven't seen any implementation, and I plan to write a
pot in my blog about it.


Great post, Guilherme!

Thanks for adding that to the archives.

cheers,

jon

Re: [flexcoders] Re: Flex Tree having 20000 nodes crashes

2008-08-04 Thread Guilherme Blanco
Hi,


I have implemented a DynamicTree for my own usage, after spending
almost a week looking for an URL about this subject.
Until now, I haven't seen any implementation, and I plan to write a
pot in my blog about it.

The secret is one event called itemOpening of the tree... there's no
need to hack getChildren.

Th second point, as much important as the first one are the requests
persistence.
When you fire an event using HTTPService and you call another request
without completing the first one, you'll have troubles, for sure.
I overcome this issue by using token (httpServiceInstance.send(params)
returns an AsyncToken instance), which provided me the ability to
receive all instances. without using this (and defining my custom
params again), the request first was never completed and second never
has the correct values.
Ok, then I have the requests queue... how do I remember which node I
was looking for? I had to include another queue to control that.
Then, it started another issue... how will I know that request 1 is
for node 1 and node for node 2 (which has a faster response)? Again,
another control to that.

The third point is to decide which item has children or not. It's
defined by a property isBranch.


After all issues controlled, we can come with the implementation...

You start the tree with the rootElement. Consider passing the rootId.
You can implement it without root, but you'll have to modify my
implementation... =)

So, your tree node will be something like this:



  
  


Then you implement the node children retrieval in the event itemOpening.
In my source, I added a dummy node "Loading..." and then removed it
when it loads the things.

Here's my full class, based on my implementation and without any line
of code removed.
I hope it helps:



http://www.adobe.com/2006/mxml"; showRoot="false"
labelField="@name"
dataProvider="{treeDataProvider}" 
itemOpening="handleItemOpening(event)">









If you need more help, just ask.


Cheers,


On Mon, Aug 4, 2008 at 6:24 AM, Johannes Nel <[EMAIL PROTECTED]> wrote:
> The class you need to look at to load sub nodes on demand is
> the ITreeDataDescriptor and the method you ned to implement is public
> function getChildren(node:Object, model:Object=null):ICollectionView
>
> On Sun, Aug 3, 2008 at 9:50 AM, profiles_arun <[EMAIL PROTECTED]>
> wrote:
>>
>> Hi Jon,
>>
>> Thanks for you response, but basically i have the requirement to
>> load the complete tree.
>> Since am new, can you give me a snippet of code, which will load the
>> sub-nodes of the tree on demand ?
>>
>> Thanks in advance.
>> arun
>>
>> --- In flexcoders@yahoogroups.com, Jon Bradley <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> > On Aug 2, 2008, at 7:25 AM, profiles_arun wrote:
>> >
>> > > I have a tree, which has 21000 plus nodes, when i load the .swf
>> file
>> > > in IE, it crashes. As such i dont get any error messages, so i
>> > > checked into widows application error log and found this error
>> > >
>> > > "Faulting application iexplore.exe, version 7.0.6000.16674,
>> faulting
>> > > module fldbg9f.ocx, version 9.0.124.0, fault address 0x00241305."
>> >
>> > Your first problem is how much data you are loading into a tree. In
>> my
>> > opinion, there is no reason to be doing that.
>> >
>> > Second problem, IE 7. It's the absolute worst browser on the
>> planet
>> > with CPU and memory management. Try this in Firefox. Although you
>> > might crash, it will probably take longer to crash (unless there's
>> a
>> > bug in the debug flash player).
>> >
>> > > Below is the snippet of my impl. Please suggest a solution, to
>> > > overcome this issue.
>> >
>> > Your solution to overcome the issue is as you already found -
>> don't
>> > try to load that much information into a Tree.
>> >
>> > cheers,
>> >
>> > jon
>> >
>>
>
>
>
> --
> j:pn
> \\no comment
> 



-- 
Guilherme Blanco - Web Developer
CBC - Certified Bindows Consultant
Cell Phone: +55 (16) 9166-6902
MSN: [EMAIL PROTECTED]
URL: http://blog.bisna.com
Rio de Janeiro - RJ/Brazil


Re: [flexcoders] Re: Flex Tree having 20000 nodes crashes

2008-08-04 Thread Johannes Nel
The class you need to look at to load sub nodes on demand is the
ITreeDataDescriptor
and the method you ned to implement is public function
getChildren(node:Object, model:Object=null):ICollectionView

On Sun, Aug 3, 2008 at 9:50 AM, profiles_arun <[EMAIL PROTECTED]>
wrote:

>   Hi Jon,
>
> Thanks for you response, but basically i have the requirement to
> load the complete tree.
> Since am new, can you give me a snippet of code, which will load the
> sub-nodes of the tree on demand ?
>
> Thanks in advance.
> arun
>
>
> --- In flexcoders@yahoogroups.com , Jon
> Bradley <[EMAIL PROTECTED]> wrote:
> >
> >
> > On Aug 2, 2008, at 7:25 AM, profiles_arun wrote:
> >
> > > I have a tree, which has 21000 plus nodes, when i load the .swf
> file
> > > in IE, it crashes. As such i dont get any error messages, so i
> > > checked into widows application error log and found this error
> > >
> > > "Faulting application iexplore.exe, version 7.0.6000.16674,
> faulting
> > > module fldbg9f.ocx, version 9.0.124.0, fault address 0x00241305."
> >
> > Your first problem is how much data you are loading into a tree. In
> my
> > opinion, there is no reason to be doing that.
> >
> > Second problem, IE 7. It's the absolute worst browser on the
> planet
> > with CPU and memory management. Try this in Firefox. Although you
> > might crash, it will probably take longer to crash (unless there's
> a
> > bug in the debug flash player).
> >
> > > Below is the snippet of my impl. Please suggest a solution, to
> > > overcome this issue.
> >
> > Your solution to overcome the issue is as you already found -
> don't
> > try to load that much information into a Tree.
> >
> > cheers,
> >
> > jon
> >
>
>  
>



-- 
j:pn
\\no comment