Parent data calculated from children fields in hierarchical data structure?

We do this by following this pattern: Create the method for calculating the value on the parent class, and make it bindable with an event In the parent, add an event listener for when the child collection changes. To do this, the child collection should be an ArrayCollection or similar When intercepting the change event, raise (or conditionally raise) the event attached to the Bindable metadata for the method mentioned in step 1 This should cause any UI that's watching the aggregate property of the parent to be updated whenever a child is updated Here's an example: public class Parent { private var children:ArrayCollection = new ArrayCollection(); public function Parent() { children. AddEventListener( CollectionEvent.

COLLECTION_CHANGE, function(evt:CollectionEvent):void { if (...) { dispatchEvent(new Event("warningStateChanged")); } } ); } Bindable("warningStateChanged") public function containsWarnings():Boolean { for each (var child:Child in children) { if (child. HasWarning) { return true; } } return false; } }.

We do this by following this pattern: Create the method for calculating the value on the parent class, and make it bindable with an event. In the parent, add an event listener for when the child collection changes. To do this, the child collection should be an ArrayCollection or similar.

When intercepting the change event, raise (or conditionally raise) the event attached to the Bindable metadata for the method mentioned in step 1. This should cause any UI that's watching the aggregate property of the parent to be updated whenever a child is updated. Here's an example: public class Parent { private var children:ArrayCollection = new ArrayCollection(); public function Parent() { children.

AddEventListener( CollectionEvent. COLLECTION_CHANGE, function(evt:CollectionEvent):void { if (...) { dispatchEvent(new Event("warningStateChanged")); } } ); } Bindable("warningStateChanged") public function containsWarnings():Boolean { for each (var child:Child in children) { if (child. HasWarning) { return true; } } return false; } }.

Really thanks. I also come to the solution creating a custom node type with listener on children's collection change event is needed. – user202492 Jun 18 '09 at 10:46.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions