Hi All,

  I have a simple code where the Tree Elements are being added using
the ArrayCollection as the dataProvider.

  I don't see any Errors but i don't see the Tree as well !!

  I am using BlazeDS and Java Code on the sever side..

  Here is my Code..(init() is being called in createComplete)
[CODE]
  <mx:VBox width="40%" height="100%">
                        <mx:Tree id="collectionTree"
                         labelFunction="treeLabel"
                         dataProvider="{domainArrayCollection}"
                         selectionColor="#ffff33"
                         showRoot="true"
                         backgroundColor="#ffffff"
                         width="100%" height="100%"
                         change="getNodeInfo(event)"
                         textSelectedColor="#ff3333">
                        </mx:Tree>
  </mx:VBox>

private function init():void{
 trace("Here in init()");
 modelNavigator = new RemoteObject("MyCollectionNavigatorFacade");
 getCollections();
 trace("Here after getCollections()");
this.addEventListener(FocusViewEvent.EVENT_FOCUS_WINDOW,this.onFocusWindow);
trace("After adding the Event Listener 1");
MyEventDispatcher.getInstance().addEventListener(FocusViewEvent.EVENT_FOCUS_WINDOW,this.onFocusWindow);
                                        trace("After adding the Event Listener 
2");
}

public function getCollections():void{
 trace("Here in getCollections()");
 if(modelNavigator!=null){
 var at:AsyncToken=modelNavigator.getCollectionNodes();
 at.addResponder(new ItemResponder(displayCollectoions, faultHandler));
 }
 else{
  Alert.show("Unable to communicate with the modelNavigator @@@@");
 }
}

private function displayCollectoions(resultObj:Object,
token:Object=null):void {
        
 this.domainArrayCollection = new ArrayCollection();
 this.collectionsList = resultObj.result as ArrayCollection;
 if(collectionsList!=null && collectionsList.length>0){
    for(var j:int=0;j<collectionsList.length;j++){
        var obj:Object = this.collectionsList.getItemAt(j);
        trace(" Object Type ="+obj);
        var modelNode:Node = Node (obj);
        domainArrayCollection.addItem(modelNode);
    }
    trace("No.of Elements in the domainArrayCollection
="+domainArrayCollection.length);
  }
  else{
     Alert.show("No Collections Exists!!!!");
  }
}

public function treeLabel( item:Object ) : String
{
         var node:Node = null;
         node = Node(item);
         //trace(" Here in treeLabel and Node ="+node.className);
         return node.nodeLabel;
}
[/CODE]
Here is my trace output
[OUTPUT]
Here in init()
Here in getCollections()
Here after getCollections()
After adding the Event Listener 1
After adding the Event Listener 2
Here in displayCollectoions & resultObj.result =[object Node],[object
Node]
 Object Type =[object Node]
 Element Type =[object Node]
 Node =1234 childElements =2
 Object Type =[object Node]
 Element Type =[object Node]
 Node =2234 childElements =2
No.of Elements in the domainArrayCollection =2
[/OUTPUT]

I am not sure why the tree is not showing up..

Reply via email to