Michel,
the expandNode method is an example of what you can implement by your
own into your code to load a tree with a JSON string... You can
replace the getSelectedNode by a node in the following way (I'll
rewrite the method):
public void nodeLoader(TreeNode node, JSONArray array) {
for (int i = 0; i < array.size(); i++) {
String item =
((JSONString)array.get(i).isObject().get("description")).stringValue();
node.appendChild(new TreeNode(item));
}
node.expand();
}
Two considerations:
* You have to remember to set a root node to the tree panel:
TreeNode root = new TreeNode();
treePanel.setRootNode(root);
and append nodes to it (eg. nodeLoader(root, jsonArray); )
* With this method you're free of handle the json structure that you
want. If you have children in your json structure, you can use the
method above in recursion.
I hope to be clear, I'm not fluent in English... sorry :(
Regards,
Leo