use of org.olat.core.gui.components.tree.GenericTreeNode in project openolat by klemens.
the class AssessmentHelper method assessmentTreeModel.
/**
* @param course
* @return
*/
public static TreeModel assessmentTreeModel(ICourse course) {
CourseNode rootNode = course.getRunStructure().getRootNode();
GenericTreeModel gtm = new GenericTreeModel();
GenericTreeNode node = new GenericTreeNode();
node.setTitle(rootNode.getShortTitle());
node.setUserObject(rootNode);
node.setIconCssClass(CourseNodeFactory.getInstance().getCourseNodeConfiguration(rootNode.getType()).getIconCSSClass());
gtm.setRootNode(node);
List<GenericTreeNode> children = addAssessableNodesToList(rootNode);
children.forEach((child) -> node.addChild(child));
return gtm;
}
use of org.olat.core.gui.components.tree.GenericTreeNode in project openolat by klemens.
the class AssessmentHelper method addAssessableNodesToList.
private static List<GenericTreeNode> addAssessableNodesToList(CourseNode parentCourseNode) {
List<GenericTreeNode> result = new ArrayList<>();
for (int i = 0; i < parentCourseNode.getChildCount(); i++) {
CourseNode courseNode = (CourseNode) parentCourseNode.getChildAt(i);
List<GenericTreeNode> assessableChildren = addAssessableNodesToList(courseNode);
if (assessableChildren.size() > 0 || isAssessable(courseNode)) {
GenericTreeNode node = new GenericTreeNode();
node.setTitle(courseNode.getShortTitle());
node.setUserObject(courseNode);
CourseNodeConfiguration nodeconfig = CourseNodeFactory.getInstance().getCourseNodeConfigurationEvenForDisabledBB(courseNode.getType());
node.setIconCssClass(nodeconfig.getIconCSSClass());
result.add(node);
assessableChildren.forEach((child) -> node.addChild(child));
}
}
return result;
}
use of org.olat.core.gui.components.tree.GenericTreeNode in project openolat by klemens.
the class AssessmentTestEditorAndComposerTreeModel method buildRecursively.
private void buildRecursively(TestPart part, int pos, TreeNode parentNode) {
GenericTreeNode partNode = new GenericTreeNode(part.getIdentifier().toString());
partNode.setTitle(pos + ". Test part");
partNode.setIconCssClass("o_icon o_qtiassessment_icon");
partNode.setUserObject(part);
parentNode.addChild(partNode);
List<AssessmentSection> sections = part.getAssessmentSections();
for (AssessmentSection section : sections) {
buildRecursively(section, partNode);
}
}
use of org.olat.core.gui.components.tree.GenericTreeNode in project openolat by klemens.
the class CPTreeDataModel method update.
public void update() {
String realNodeId = getIdentifierForNodeID(rootNodeId);
DefaultElement el = cp.getElementByIdentifier(realNodeId);
if (el instanceof CPOrganization) {
CPOrganization item = (CPOrganization) el;
String rootTitle = cp.getFirstOrganizationInManifest().getTitle();
GenericTreeNode rootNode = new GenericTreeNode(rootNodeId, rootTitle, item);
rootNode.setIconCssClass("o_cp_org");
List<TreeNode> children = getChildrenFor(rootNodeId);
for (TreeNode child : children) {
rootNode.addChild(child);
buildTreeModel(child);
}
setRootNode(rootNode);
}
}
use of org.olat.core.gui.components.tree.GenericTreeNode in project openolat by klemens.
the class CPTreeDataModel method addItem.
private void addItem(List<TreeNode> nodeList, CPItem item) throws JSONException {
String nId = putIdentifierForNodeID(item.getIdentifier());
GenericTreeNode child = new GenericTreeNode(nId, item.getTitle(), item);
child.setIconCssClass("o_cp_item");
nodeList.add(child);
}
Aggregations