Basic Customization > User Interface Customization > Presenting Information in the UI > Windchill Client Architecture Tree > Solution > Solution Elements > Implementing Tree Component using Asynchronous DataSource
  
Implementing Tree Component using Asynchronous DataSource
To implement a tree component using Asynchronous DataSource, TreeDataBuilderAsync interface needs to be implemented. It has a single method to be implemented by the concrete class:
void buildNodeData(Object node, ComponentResultProcessor resultProcessor) throws Exception
It Fetches children for each node.The first call to this method from infrastructure will always pass first argument as TreeNode.RootNode.This first call ensures that all rootNodes are fetched for subsequent calls. The subsequent calls will always pass a treeNode for which child nodes are required to be fetched.
E.g. The code should handle this case similar to following code snippet:
List nodes;
if (node == TreeNode.RootNode){
nodes = getRootNodes();
resultProcessor.addElements(nodes);
}else {
getNodes(node);
nodes = resultProcessor.addElements(nodes);
}