CourseEditorTreeNode cnRoot = (CourseEditorTreeNode) cetm.getRootNode();
gtn.addChild(buildNode(cnRoot, false, false, false));
}
private GenericTreeNode buildNode(CourseEditorTreeNode cetn, boolean parentIsNew, boolean parentIsDeleted, boolean parentIsMoved) {
GenericTreeNode gtn = new GenericTreeNode();
gtn.setIdent(cetn.getIdent());
gtn.setTitle(cetn.getTitle());
gtn.setAltText(cetn.getAltText());
gtn.setIconCssClass(cetn.getIconCssClass());
if (parentIsNew || parentIsDeleted || parentIsMoved) gtn.setAccessible(false);
else {
gtn.setAccessible(cetn.hasPublishableChanges());
}
gtn.setCssClass(cetn.getCssClass());
int childcnt = cetn.getChildCount();
if (childcnt > 0) {
for (int i = 0; i < childcnt; i++) {
parentIsNew = parentIsNew || cetn.isNewnode();
parentIsDeleted = parentIsDeleted || cetn.isDeleted();
parentIsMoved = parentIsMoved || isMoved(cetn);
GenericTreeNode childNode = buildNode((CourseEditorTreeNode) cetn.getChildAt(i), parentIsNew, parentIsDeleted, parentIsMoved);
// if this is the first new node, enable it
if (!parentIsNew && cetn.isNewnode()) childNode.setAccessible(true);
// if this is the first deleted node, enable it
if (!parentIsDeleted && cetn.isDeleted()) childNode.setAccessible(true);
// if this is the first moved node, enable it
if (!parentIsMoved && isMoved(cetn)) childNode.setAccessible(true);
gtn.insert(childNode, i);
}
}
return gtn;
}