[flexcoders] Re: ListCollectionView#removeAll wants to dispatch undefined

2007-12-01 Thread florian.salihovic

I managed my Problem by adding a wrapper which manages the access of the tree.

Thanx for the helpful infos.

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Yes.  Basically we need unique child collections
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of florian.salihovic
 Sent: Friday, November 30, 2007 12:34 AM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] Re: ListCollectionView#removeAll wants to dispatch
 undefined
 
 
 
 
 Thanx for the reply!
 
 So would it be alright from the perspective of modelling the
 application, that i create a 
 field children in each class, that hold references to all of its childs
 that i want to display?
 
 I thought that the treedatadesciptor would be responsible melting the
 children to display 
 together. But the classes themselves are responsible for providing an
 access to the childs 
 to be displayed?
 
 Sorry if my english ain't that good. I'm from Germany and i may need to
 refresh grammar 
 and vocab ;)
 
 Best regards!
 
 --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 , Alex Harui aharui@ wrote:
 
  Actually, you don't want to do either option. You want to implement
  getChildren to return a separate array collection for each collection
 of
  children. This is because the individual sets of children are tracked
  an managed by the tree so you can't reuse one collection instance, and
  you should not return different instances for the same set of
 children,
  otherwise one part of the tree code will make changes that some other
  part will not notice. Look at the default descriptor and see that it
  caches the AC instances per node/children set
  
  
  
  From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 [mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
 ] On
  Behalf Of florian.salihovic
  Sent: Thursday, November 29, 2007 4:27 PM
  To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
  Subject: [flexcoders] ListCollectionView#removeAll wants to dispatch
  undefined
  
  
  
  Currently i write a lil' component to display class hierachies. I
 wrote
  my own 
  TreeDataDescriptor. SInce i work with my own class-, packages- and
  interface-descriptor 
  classes to describe the structure, i encapsule some ArrayCollection.
 In
  order to display the 
  structures in a tree, i need to melt them together in one
  ArrayCollection. So far so good...
  
  Since i want not to create a new ArrayCollection everytime the 
  ITreeDataDescriptor#getChildren is called, i thought to create one
  ArrayCollection and 
  remove all items when the function is called. I thought it would be ok
  to create a new field 
  (typed: ArrayCollection) for the class. But actually the forces my
  component to crash. 
  Here's the code:
  precode
  public function getChildren(node:Object,
  model:Object=null):ICollectionView {
  trace(this._className+#getChildren);
  try {
  if(node is PackageDescriptor) {
  this._children.sort = null;
  /*try {
  this._children.removeAll();
  this._children.refresh();
  } catch (e:Error) {
  trace(Error: +e.message)
  } catch (e1:StackOverflowError) {
  trace(StackOverflowError: +e1.message);
  } catch (e2:CollectionViewError) {
  trace(CollectionViewError: +e2.message);
  } catch (e3:ArgumentError) {
  trace(ArgumentError: +e2.message);
  }*/
  trace(\tnode.className: +PackageDescriptor(node).className);
  this._children = new ArrayCollection();
  var packageDescriptor:PackageDescriptor = PackageDescriptor(node);
  for (var i:uint = 0; ipackageDescriptor.packages.length; i++) {
 
 this._children.addItem(PackageDescriptor(packageDescriptor.packages.getI
  temAt(i)));
  }
  for (var j:uint = 0; jpackageDescriptor.classes.length; j++) {
 
 this._children.addItem(ClassDescriptor(packageDescriptor.classes.getItem
  At(j)));
  }
  for (var k:uint = 0; kpackageDescriptor.interfaces.length; k++) {
 
 this._children.addItem(InterfaceDescriptor(packageDescriptor.interfaces.
  getItemAt(k)));
  }
  /*for (var l:uint = 0; lthis._children.length; l++) {
  trace(\t\t+l+: +this._children.getItemAt(l).name);
  }*/
  return this._children;
  }
  } catch (e:Error) {
  trace(Error: +e.message)
  } catch (e1:StackOverflowError) {
  trace(StackOverflowError: +e1.message);
  } catch (e2:CollectionViewError) {
  trace(CollectionViewError: +e2.message);
  } finally {
  return _children;
  }
  }/code/pre
  So why is it at this point wrong to call removeAll to remove all
  references from the 
  ArrayCollection instead of creating a new ArrayCollection all the
 time?
  The code above 
  compiles. If i uncomment the first try/ctach statement, the
 application
  crashes.
 






[flexcoders] Re: ListCollectionView#removeAll wants to dispatch undefined

2007-11-30 Thread florian.salihovic

Thanx for the reply!

So would it be alright from the perspective of modelling the application, that 
i create a 
field children in each class, that hold references to all of its childs that i 
want to display?

I thought that the treedatadesciptor would be responsible melting the children 
to display 
together. But the classes themselves are responsible for providing an access to 
the childs 
to be displayed?

Sorry if my english ain't that good. I'm from Germany and i may need to refresh 
grammar 
and vocab ;)

Best regards!

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Actually, you don't want to do either option.  You want to implement
 getChildren to return a separate array collection for each collection of
 children.  This is because the individual sets of children are tracked
 an managed by the tree so you can't reuse one collection instance, and
 you should not return different instances for the same set of children,
 otherwise one part of the tree code will make changes that some other
 part will not notice.  Look at the default descriptor and see that it
 caches the AC instances per node/children set
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of florian.salihovic
 Sent: Thursday, November 29, 2007 4:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] ListCollectionView#removeAll wants to dispatch
 undefined
 
 
 
 Currently i write a lil' component to display class hierachies. I wrote
 my own 
 TreeDataDescriptor. SInce i work with my own class-, packages- and
 interface-descriptor 
 classes to describe the structure, i encapsule some ArrayCollection. In
 order to display the 
 structures in a tree, i need to melt them together in one
 ArrayCollection. So far so good...
 
 Since i want not to create a new ArrayCollection everytime the 
 ITreeDataDescriptor#getChildren is called, i thought to create one
 ArrayCollection and 
 remove all items when the function is called. I thought it would be ok
 to create a new field 
 (typed: ArrayCollection) for the class. But actually the forces my
 component to crash. 
 Here's the code:
 precode
 public function getChildren(node:Object,
 model:Object=null):ICollectionView {
 trace(this._className+#getChildren);
 try {
 if(node is PackageDescriptor) {
 this._children.sort = null;
 /*try {
 this._children.removeAll();
 this._children.refresh();
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } catch (e3:ArgumentError) {
 trace(ArgumentError: +e2.message);
 }*/
 trace(\tnode.className: +PackageDescriptor(node).className);
 this._children = new ArrayCollection();
 var packageDescriptor:PackageDescriptor = PackageDescriptor(node);
 for (var i:uint = 0; ipackageDescriptor.packages.length; i++) {
 this._children.addItem(PackageDescriptor(packageDescriptor.packages.getI
 temAt(i)));
 }
 for (var j:uint = 0; jpackageDescriptor.classes.length; j++) {
 this._children.addItem(ClassDescriptor(packageDescriptor.classes.getItem
 At(j)));
 }
 for (var k:uint = 0; kpackageDescriptor.interfaces.length; k++) {
 this._children.addItem(InterfaceDescriptor(packageDescriptor.interfaces.
 getItemAt(k)));
 }
 /*for (var l:uint = 0; lthis._children.length; l++) {
 trace(\t\t+l+: +this._children.getItemAt(l).name);
 }*/
 return this._children;
 }
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } finally {
 return _children;
 }
 }/code/pre
 So why is it at this point wrong to call removeAll to remove all
 references from the 
 ArrayCollection instead of creating a new ArrayCollection all the time?
 The code above 
 compiles. If i uncomment the first try/ctach statement, the application
 crashes.






[flexcoders] Re: ListCollectionView#removeAll wants to dispatch undefined

2007-11-30 Thread florian.salihovic
I really thought i got it - but i was wrong... i isolated my problem and 
perhaps someone 
could elaborate what i need to change and why.

Here are the srcs: [FONT=Century Gothic]Ich konnte den Fehler rekonstruieren 
auch bei 
einem anderen Modell feststellen. Ich glaube ich hab eine Blockade gerade. 
Vielleicht mag 
sich das nochmal jemand anschauen?

http://www.box.net/shared/gmbrc5yc2k

--- In flexcoders@yahoogroups.com, Alex Harui [EMAIL PROTECTED] wrote:

 Actually, you don't want to do either option.  You want to implement
 getChildren to return a separate array collection for each collection of
 children.  This is because the individual sets of children are tracked
 an managed by the tree so you can't reuse one collection instance, and
 you should not return different instances for the same set of children,
 otherwise one part of the tree code will make changes that some other
 part will not notice.  Look at the default descriptor and see that it
 caches the AC instances per node/children set
 
 
 
 From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
 Behalf Of florian.salihovic
 Sent: Thursday, November 29, 2007 4:27 PM
 To: flexcoders@yahoogroups.com
 Subject: [flexcoders] ListCollectionView#removeAll wants to dispatch
 undefined
 
 
 
 Currently i write a lil' component to display class hierachies. I wrote
 my own 
 TreeDataDescriptor. SInce i work with my own class-, packages- and
 interface-descriptor 
 classes to describe the structure, i encapsule some ArrayCollection. In
 order to display the 
 structures in a tree, i need to melt them together in one
 ArrayCollection. So far so good...
 
 Since i want not to create a new ArrayCollection everytime the 
 ITreeDataDescriptor#getChildren is called, i thought to create one
 ArrayCollection and 
 remove all items when the function is called. I thought it would be ok
 to create a new field 
 (typed: ArrayCollection) for the class. But actually the forces my
 component to crash. 
 Here's the code:
 precode
 public function getChildren(node:Object,
 model:Object=null):ICollectionView {
 trace(this._className+#getChildren);
 try {
 if(node is PackageDescriptor) {
 this._children.sort = null;
 /*try {
 this._children.removeAll();
 this._children.refresh();
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } catch (e3:ArgumentError) {
 trace(ArgumentError: +e2.message);
 }*/
 trace(\tnode.className: +PackageDescriptor(node).className);
 this._children = new ArrayCollection();
 var packageDescriptor:PackageDescriptor = PackageDescriptor(node);
 for (var i:uint = 0; ipackageDescriptor.packages.length; i++) {
 this._children.addItem(PackageDescriptor(packageDescriptor.packages.getI
 temAt(i)));
 }
 for (var j:uint = 0; jpackageDescriptor.classes.length; j++) {
 this._children.addItem(ClassDescriptor(packageDescriptor.classes.getItem
 At(j)));
 }
 for (var k:uint = 0; kpackageDescriptor.interfaces.length; k++) {
 this._children.addItem(InterfaceDescriptor(packageDescriptor.interfaces.
 getItemAt(k)));
 }
 /*for (var l:uint = 0; lthis._children.length; l++) {
 trace(\t\t+l+: +this._children.getItemAt(l).name);
 }*/
 return this._children;
 }
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } finally {
 return _children;
 }
 }/code/pre
 So why is it at this point wrong to call removeAll to remove all
 references from the 
 ArrayCollection instead of creating a new ArrayCollection all the time?
 The code above 
 compiles. If i uncomment the first try/ctach statement, the application
 crashes.




RE: [flexcoders] Re: ListCollectionView#removeAll wants to dispatch undefined

2007-11-30 Thread Alex Harui
Yes.  Basically we need unique child collections



From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of florian.salihovic
Sent: Friday, November 30, 2007 12:34 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: ListCollectionView#removeAll wants to dispatch
undefined




Thanx for the reply!

So would it be alright from the perspective of modelling the
application, that i create a 
field children in each class, that hold references to all of its childs
that i want to display?

I thought that the treedatadesciptor would be responsible melting the
children to display 
together. But the classes themselves are responsible for providing an
access to the childs 
to be displayed?

Sorry if my english ain't that good. I'm from Germany and i may need to
refresh grammar 
and vocab ;)

Best regards!

--- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
, Alex Harui [EMAIL PROTECTED] wrote:

 Actually, you don't want to do either option. You want to implement
 getChildren to return a separate array collection for each collection
of
 children. This is because the individual sets of children are tracked
 an managed by the tree so you can't reuse one collection instance, and
 you should not return different instances for the same set of
children,
 otherwise one part of the tree code will make changes that some other
 part will not notice. Look at the default descriptor and see that it
 caches the AC instances per node/children set
 
 
 
 From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
[mailto:flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com
] On
 Behalf Of florian.salihovic
 Sent: Thursday, November 29, 2007 4:27 PM
 To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com 
 Subject: [flexcoders] ListCollectionView#removeAll wants to dispatch
 undefined
 
 
 
 Currently i write a lil' component to display class hierachies. I
wrote
 my own 
 TreeDataDescriptor. SInce i work with my own class-, packages- and
 interface-descriptor 
 classes to describe the structure, i encapsule some ArrayCollection.
In
 order to display the 
 structures in a tree, i need to melt them together in one
 ArrayCollection. So far so good...
 
 Since i want not to create a new ArrayCollection everytime the 
 ITreeDataDescriptor#getChildren is called, i thought to create one
 ArrayCollection and 
 remove all items when the function is called. I thought it would be ok
 to create a new field 
 (typed: ArrayCollection) for the class. But actually the forces my
 component to crash. 
 Here's the code:
 precode
 public function getChildren(node:Object,
 model:Object=null):ICollectionView {
 trace(this._className+#getChildren);
 try {
 if(node is PackageDescriptor) {
 this._children.sort = null;
 /*try {
 this._children.removeAll();
 this._children.refresh();
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } catch (e3:ArgumentError) {
 trace(ArgumentError: +e2.message);
 }*/
 trace(\tnode.className: +PackageDescriptor(node).className);
 this._children = new ArrayCollection();
 var packageDescriptor:PackageDescriptor = PackageDescriptor(node);
 for (var i:uint = 0; ipackageDescriptor.packages.length; i++) {

this._children.addItem(PackageDescriptor(packageDescriptor.packages.getI
 temAt(i)));
 }
 for (var j:uint = 0; jpackageDescriptor.classes.length; j++) {

this._children.addItem(ClassDescriptor(packageDescriptor.classes.getItem
 At(j)));
 }
 for (var k:uint = 0; kpackageDescriptor.interfaces.length; k++) {

this._children.addItem(InterfaceDescriptor(packageDescriptor.interfaces.
 getItemAt(k)));
 }
 /*for (var l:uint = 0; lthis._children.length; l++) {
 trace(\t\t+l+: +this._children.getItemAt(l).name);
 }*/
 return this._children;
 }
 } catch (e:Error) {
 trace(Error: +e.message)
 } catch (e1:StackOverflowError) {
 trace(StackOverflowError: +e1.message);
 } catch (e2:CollectionViewError) {
 trace(CollectionViewError: +e2.message);
 } finally {
 return _children;
 }
 }/code/pre
 So why is it at this point wrong to call removeAll to remove all
 references from the 
 ArrayCollection instead of creating a new ArrayCollection all the
time?
 The code above 
 compiles. If i uncomment the first try/ctach statement, the
application
 crashes.