final LinkedHashSet<FastMSTreeItem> curSel = tree.getSelectedItems();
final HashMap<Integer, XObjectModel> nodeMap = new HashMap<Integer, XObjectModel>();
final LinkedHashSet<FastMSTreeItem> roots = new LinkedHashSet<FastMSTreeItem>();
XObjectModel selRoot = null;
if (curSel != null && curSel.size() >= 1) {
FastMSTreeItem selected = curSel.iterator().next();
selRoot = selected.getXObjectModel();
roots.add(selected);
}
// TreeStore <XObjectModel> store = treeBinder.getTreeStore();
final XObjectModel selectedRoot = selRoot;
DeferredCommand.addCommand(new IncrementalCommand() {
private int index = 0;
private final int size = nodes.size();
public boolean execute() {
TreeNode node = nodes.get(index);
XObjectModel parent = determineParent(nodeMap, node);
XObjectModel xObjModel = wrap(node.getXObject());
if (node.get("filterPath") != null) {
xObjModel.set("filterPath", node.get("filterPath"));
} else {
xObjModel.remove("filterPath");
}
FastMSTreeItem item = new FastMSTreeItem();
item.setVisible(true);
item.setXObjectModel(xObjModel);
if (node.getXObject() instanceof XElementNode) {
item.setHTML(getTreeItemText((XElementNode) node.getXObject()));
} else {
item.setText(node.getXObject().getName());
}
xObjModel.setItem(item);
if (parent == null) {
if (selectedRoot == null) {
tree.addItem(item);
DOM.scrollIntoView(item.getElement());
roots.add(item);
} else {
selectedRoot.getItem().addItem(item);
}
} else {