private void selectAndExpandRootNode(DataArrivedEvent event) {
   // first event contains parent node that is root node of TreeGrid
   //  and it is a synthetic node without attributes
   TreeNode parentNode = event.getParentNode();
   Tree tree = treeSelector.getTree();
   TreeNode[] children = tree.getChildren(parentNode);
   if (children.length > 0 && children[0].getAttribute(RelationDataSource.FIELD_PARENT) == null) {
     // select real root node and expand it
     TreeNode realRootNode = children[0];
     treeSelector.selectRecord(realRootNode);
     tree.openFolder(realRootNode);
   }
 }
  /**
   * Processes a treeNode (add it to the TreeGrid)
   *
   * @param treeNode The treeNode to process
   * @param nodeRoot The root node to which the treeNode has te be added
   * @param tree The tree to which the node has to be added
   * @param mapModel map model
   * @param refresh True if the tree is refreshed (causing it to keep its expanded state)
   */
  private void processNode(
      final ClientLayerTreeNodeInfo treeNode,
      final TreeNode nodeRoot,
      final Tree tree,
      final MapModel mapModel,
      final boolean refresh) {
    if (null != treeNode) {
      String treeNodeLabel = treeNode.getLabel();
      final TreeNode node = new TreeNode(treeNodeLabel);

      tree.add(node, nodeRoot);

      // (final leafs)
      for (ClientLayerInfo info : treeNode.getLayers()) {
        Layer<?> layer = mapModel.getLayer(info.getId());
        tree.add(new LayerTreeTreeNode(this.tree, layer), node);
      }

      // treeNodes
      List<ClientLayerTreeNodeInfo> children = treeNode.getTreeNodes();
      for (ClientLayerTreeNodeInfo newNode : children) {
        processNode(newNode, node, tree, mapModel, refresh);
      }

      // expand tree nodes
      // when not refreshing expand them like configured
      // when refreshing expand them as before the refresh
      boolean isTreeNodeExpanded = treeNode.isExpanded();
      if (!refresh) {
        if (isTreeNodeExpanded) {
          tree.openFolder(node);
        }
      } else {
        // TODO close previously opened tree nodes, close others
      }
    }
  }