Quantcast
Channel: Adobe Community : Popular Discussions - LiveCycle Data Services
Viewing all articles
Browse latest Browse all 58696

Populating Tree from Java Remote Object

$
0
0
Hi,

I was wondering if there is a specific "type" of Java object(s) I need to create to pass a Java object as the data provider for a Tree.
My example is as follows : I have a Building, inside a building I have a room, inside a room I have a cubicle, inside a cubicle I have a desk.

Obviously each node can have many subnodes (i.e. One room can have many cubicles).

I tried representing this hierarchy in Java.
I have the following structure :

Building.java
public class Building {
String name;
Room room;
public Building(String name, Room room) {
this.name = name;
this.room = room;
}

Room.java
public class Room {
String name;
Cubicle cubcle;
public Room(String name, Cubicle cubicle) {
this.name = name;
this.cubicle = cubicle;
}

etc etc.

I also created ActionScripts for these correpsonding files.

package rpc.tree {
[Bindable]
[RemoteClass(alias="rpc.tree.Building")]
public class Building {
public var name:String;

public var room:Room;

}
}

etc etc


I have a Service class that has a method that returns a Building.

<mx:RemoteObject id="myTree" destination="MyTreeService">
<mx:method name="getMeATree" result="now(event.result as Building)"/>
</mx:RemoteObject>

However when I try to use the Buidling structure as a data structure it doesn't work.

<mx:Tree dataProvider="{aBuilding}" height="100" width="100%">
</mx:Tree>

Someone suggested that one way to represent Trees is as a Collection of Collections.
Is there anyway I can use a Java representation of a tree as a data provider without me having to manipulate it in mxml (or Action script).

I was able to pass a simple ArrayCollection (Java ArrayList) as a data provider for datagrid. Is there an equivalent for a tree ?

Thanks.

Viewing all articles
Browse latest Browse all 58696

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>