private int index = 0;
private int size = kids.size();
public boolean execute() {
if (index >= size) {
LoadEvent le = new LoadEvent(null, parentNode);
// ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
tree.loaded(le);
return false;
}
TreeNode tn = kids.get(index);
XObject xObj = tn.getXObject();
String name;
String image = "";
if (xObj instanceof XElementNode) {
int count = ((XElementNode) xObj)
.getChildCount();
image = "<img paddingTop=\"2px\" width=\"16\" height=\"14\" src=\"icons/element_";
XElementType xElemType =
((XElementNode) xObj).getElement().getElementType();
if (XElementType.CONSOLIDATED.equals(xElemType)) {
image += "con2.png\"> ";
} else if (XElementType.NUMERIC.equals(xElemType)) {
image += "num2.png\"> ";
} else if (XElementType.STRING.equals(xElemType)) {
image += "str2.png\"> ";
} else {
image = "";
}
name = count == 0 ? xObj.getName() : xObj
.getName()
+ " <i><font color=\"gray\">("
+ count + ")</i></font>";
} else {
name = xObj.getName();
}
SelectingFastMSTreeItem item = new SelectingFastMSTreeItem(image + name, tree);
if (tn.hasChildren()) {
item.becomeInteriorNode();
parents.put(tn, item);
}
item.setModel(tn);
HasFastMSTreeItems parentItem = tree;
if (tn.getParent() != null) {
FastMSTreeItem pItem = parents.get(tn.getParent());
if (pItem != null) {
parentItem = pItem;
}
}
parentItem.fastAddItem(item);
index++;
if (index >= size) {
LoadEvent le = new LoadEvent(null, parentNode);
// ((Workbench) Registry.get(Workbench.ID)).hideWaitCursor();
tree.loaded(le);
}
return index < size;
}