Search in sources :

Example 46 with GenericTreeNode

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;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeModel(org.olat.core.gui.components.tree.GenericTreeModel) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode)

Example 47 with GenericTreeNode

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;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) ArrayList(java.util.ArrayList) AssessableCourseNode(org.olat.course.nodes.AssessableCourseNode) CourseNode(org.olat.course.nodes.CourseNode) ProjectBrokerCourseNode(org.olat.course.nodes.ProjectBrokerCourseNode) STCourseNode(org.olat.course.nodes.STCourseNode) ScormCourseNode(org.olat.course.nodes.ScormCourseNode) CourseNodeConfiguration(org.olat.course.nodes.CourseNodeConfiguration)

Example 48 with GenericTreeNode

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

Example 49 with GenericTreeNode

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);
    }
}
Also used : DefaultElement(org.dom4j.tree.DefaultElement) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) CPOrganization(org.olat.ims.cp.objects.CPOrganization)

Example 50 with GenericTreeNode

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);
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

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