Search in sources :

Example 76 with GenericTreeNode

use of org.olat.core.gui.components.tree.GenericTreeNode in project OpenOLAT by OpenOLAT.

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;
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Example 77 with GenericTreeNode

use of org.olat.core.gui.components.tree.GenericTreeNode in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method buildRecursively.

private void buildRecursively(AssessmentTest test, GenericTreeNode rootTreeNode) {
    // list all test parts
    List<TestPart> parts = test.getTestParts();
    if (parts.size() == 1) {
        TreeNode firstItem = null;
        List<AssessmentSection> sections = test.getTestParts().get(0).getAssessmentSections();
        for (AssessmentSection section : sections) {
            TreeNode itemNode = buildRecursively(section, rootTreeNode);
            if (firstItem == null) {
                firstItem = itemNode;
            }
        }
    } else {
        int counter = 0;
        for (TestPart part : parts) {
            buildRecursively(part, ++counter, rootTreeNode);
        }
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) TestPart(uk.ac.ed.ph.jqtiplus.node.test.TestPart)

Example 78 with GenericTreeNode

use of org.olat.core.gui.components.tree.GenericTreeNode in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method getTreeModel.

/**
 * Return the tree model for a test learn resource.
 *
 * @return
 */
public TreeModel getTreeModel() {
    GenericTreeModel treeModel = new GenericTreeModel();
    GenericTreeNode rootTreeNode = new GenericTreeNode();
    treeModel.setRootNode(rootTreeNode);
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedDirRoot = frm.unzipFileResource(testEntry.getOlatResource());
    resolvedAssessmentTest = qtiService.loadAndResolveAssessmentTest(unzippedDirRoot, false, false);
    AssessmentTest test = resolvedAssessmentTest.getTestLookup().getRootNodeHolder().getRootNode();
    rootTreeNode.setTitle(test.getTitle());
    rootTreeNode.setUserObject(test);
    rootTreeNode.setIconCssClass("o_icon o_icon-lg o_qtiassessment_icon");
    buildRecursively(test, rootTreeNode);
    return treeModel;
}
Also used : ResolvedAssessmentTest(uk.ac.ed.ph.jqtiplus.resolution.ResolvedAssessmentTest) AssessmentTest(uk.ac.ed.ph.jqtiplus.node.test.AssessmentTest) FileResourceManager(org.olat.fileresource.FileResourceManager) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) File(java.io.File)

Example 79 with GenericTreeNode

use of org.olat.core.gui.components.tree.GenericTreeNode in project OpenOLAT by OpenOLAT.

the class QTI21StatisticResourceResult method buildRecursively.

private void buildRecursively(TestPart part, int pos, TreeNode parentNode) {
    GenericTreeNode partNode = new GenericTreeNode();
    partNode.setTitle(pos + ". Test part");
    partNode.setIconCssClass("o_icon o_qtiassessment_icon");
    partNode.setUserObject(part);
    parentNode.addChild(partNode);
    TreeNode firstItem = null;
    List<AssessmentSection> sections = part.getAssessmentSections();
    for (AssessmentSection section : sections) {
        TreeNode itemNode = buildRecursively(section, partNode);
        if (firstItem == null) {
            firstItem = itemNode;
        }
    }
    partNode.setDelegate(firstItem);
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)

Example 80 with GenericTreeNode

use of org.olat.core.gui.components.tree.GenericTreeNode in project OpenOLAT by OpenOLAT.

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);
        }
    }
}
Also used : SectionPart(uk.ac.ed.ph.jqtiplus.node.test.SectionPart) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) AssessmentSection(uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection) AssessmentItemRef(uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)

Aggregations

GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)124 TreeNode (org.olat.core.gui.components.tree.TreeNode)30 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)24 CourseNode (org.olat.course.nodes.CourseNode)10 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)10 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)10 HashMap (java.util.HashMap)8 INode (org.olat.core.util.nodes.INode)8 ArrayList (java.util.ArrayList)6 Element (org.dom4j.Element)6 XPath (org.dom4j.XPath)6 ExtManager (org.olat.core.extensions.ExtManager)6 Extension (org.olat.core.extensions.Extension)6 CatalogEntry (org.olat.repository.CatalogEntry)6 ActionExtension (org.olat.core.extensions.action.ActionExtension)4 GenericActionExtension (org.olat.core.extensions.action.GenericActionExtension)4 CourseNodeConfiguration (org.olat.course.nodes.CourseNodeConfiguration)4 QTI21QuestionType (org.olat.ims.qti21.model.QTI21QuestionType)4 Taxonomy (org.olat.modules.taxonomy.Taxonomy)4 AssessmentItem (uk.ac.ed.ph.jqtiplus.node.item.AssessmentItem)4