use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class AssessmentTestComposerController method doConfirmDelete.
private void doConfirmDelete(UserRequest ureq) {
if (confirmDeleteCtrl != null)
return;
TreeNode selectedNode = menuTree.getSelectedNode();
if (selectedNode == null) {
showWarning("warning.atleastone");
return;
}
Object uobject = selectedNode.getUserObject();
if (uobject instanceof AssessmentTest) {
showWarning("error.cannot.delete");
} else if (uobject instanceof TestPart) {
TestPart testPart = (TestPart) uobject;
if (testPart.getParent().getTestParts().size() == 1) {
showWarning("error.cannot.delete");
}
String msg = translate("delete.testPart");
confirmDeleteCtrl = activateYesNoDialog(ureq, translate("tools.change.delete"), msg, confirmDeleteCtrl);
confirmDeleteCtrl.setUserObject(selectedNode);
} else {
String msg;
if (uobject instanceof AssessmentSection) {
AssessmentSection section = (AssessmentSection) uobject;
if (checkAtLeastOneSection(section)) {
msg = translate("delete.section", selectedNode.getTitle());
} else {
showWarning("warning.atleastonesection");
return;
}
} else if (uobject instanceof AssessmentItemRef) {
msg = translate("delete.item", selectedNode.getTitle());
} else {
showError("error.cannot.delete");
return;
}
confirmDeleteCtrl = activateYesNoDialog(ureq, translate("tools.change.delete"), msg, confirmDeleteCtrl);
confirmDeleteCtrl.setUserObject(selectedNode);
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class AssessmentTestEditorAndComposerTreeModel method buildRecursively.
private void buildRecursively(AssessmentSection section, TreeNode parentNode) {
GenericTreeNode sectionNode = new GenericTreeNode(section.getIdentifier().toString());
sectionNode.setTitle(section.getTitle());
sectionNode.setIconCssClass("o_icon o_mi_qtisection");
sectionNode.setUserObject(section);
parentNode.addChild(sectionNode);
for (SectionPart part : section.getSectionParts()) {
if (part instanceof AssessmentItemRef) {
buildRecursively((AssessmentItemRef) part, sectionNode);
} else if (part instanceof AssessmentSection) {
buildRecursively((AssessmentSection) part, sectionNode);
}
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class QTI21PrintController method appendNodes.
private void appendNodes(UserRequest ureq, TreeNode node, QTI21StatisticResourceResult resourceResult, List<String> pageNames) {
if (node.getUserObject() instanceof AssessmentItemRef) {
Controller itemCtrl = resourceResult.getController(ureq, getWindowControl(), null, node, true);
if (itemCtrl != null) {
String itemPageName = "page" + count++;
mainVC.put(itemPageName, itemCtrl.getInitialComponent());
pageNames.add(itemPageName);
}
}
for (int i = 0; i < node.getChildCount(); i++) {
appendNodes(ureq, (TreeNode) node.getChildAt(i), resourceResult, pageNames);
}
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class QTI21StatisticResourceResult method buildRecursively.
private TreeNode buildRecursively(AssessmentSection section, TreeNode parentNode) {
GenericTreeNode sectionNode = new GenericTreeNode();
sectionNode.setTitle(section.getTitle());
sectionNode.setIconCssClass("o_icon o_mi_qtisection");
sectionNode.setUserObject(section);
parentNode.addChild(sectionNode);
TreeNode firstItem = null;
for (SectionPart part : section.getSectionParts()) {
TreeNode itemNode = null;
if (part instanceof AssessmentItemRef) {
itemNode = buildRecursively((AssessmentItemRef) part, sectionNode);
} else if (part instanceof AssessmentSection) {
itemNode = buildRecursively((AssessmentSection) part, sectionNode);
}
if (firstItem == null) {
firstItem = itemNode;
}
}
sectionNode.setDelegate(firstItem);
return firstItem;
}
use of uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef in project openolat by klemens.
the class QTI21StatisticResourceResult method getAssessmentItems.
public List<AssessmentItem> getAssessmentItems() {
List<AssessmentItemRef> itemRefs = resolvedAssessmentTest.getAssessmentItemRefs();
List<AssessmentItem> items = new ArrayList<>(itemRefs.size());
for (AssessmentItemRef itemRef : itemRefs) {
AssessmentItem item = resolvedAssessmentTest.getResolvedAssessmentItem(itemRef).getRootNodeLookup().extractIfSuccessful();
items.add(item);
}
return items;
}
Aggregations