Search in sources :

Example 56 with GenericTreeNode

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

the class QuestionPoolMenuTreeModel method setFirstChildAsDelegate.

private void setFirstChildAsDelegate(INode node) {
    if (node.getChildCount() > 0) {
        INode childNode = node.getChildAt(0);
        if (node instanceof GenericTreeNode && childNode instanceof TreeNode) {
            GenericTreeNode parent = (GenericTreeNode) node;
            TreeNode child = (TreeNode) childNode;
            parent.setDelegate(child);
        }
    }
}
Also used : INode(org.olat.core.util.nodes.INode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 57 with GenericTreeNode

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

the class MoveTaxonomyLevelController method filterByAllowedTypes.

private boolean filterByAllowedTypes(TreeNode node, List<TreeNode> openedNodes) {
    ((GenericTreeNode) node).setIconCssClass(null);
    for (int i = node.getChildCount(); i-- > 0; ) {
        boolean ok = filterByAllowedTypes((TreeNode) node.getChildAt(i), openedNodes);
        if (!ok) {
            node.remove(node.getChildAt(i));
        }
    }
    boolean ok = false;
    Object uobject = node.getUserObject();
    if (uobject instanceof TaxonomyLevel) {
        TaxonomyLevel level = (TaxonomyLevel) uobject;
        TaxonomyLevelType type = level.getType();
        if (type == null || allowedTypes.contains(type)) {
            openedNodes.add(node);
            ((GenericTreeNode) node).setIconCssClass("o_icon_node_under o_icon-rotate-180");
            targetableNodes.add(node);
            ok = true;
        } else if (node.getChildCount() > 0) {
            openedNodes.add(node);
            ok = true;
        }
    } else {
        targetableNodes.add(node);
        openedNodes.add(node);
        ok = true;
    }
    return ok;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType)

Example 58 with GenericTreeNode

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

the class ScormAPIandDisplayController method switchToPage.

/**
 * @param te is an Event fired by clicking a node in a tree
 */
public void switchToPage(TreeEvent te) {
    // switch to the new page
    String nodeId = te.getNodeId();
    GenericTreeNode tn = (GenericTreeNode) treeModel.getNodeById(nodeId);
    if (te.getCommand().equals(MenuTree.COMMAND_TREENODE_EXPANDED)) {
        iframectr.getInitialComponent().setVisible(false);
        // update the view
        myContent.setDirty(true);
    } else {
        iframectr.getInitialComponent().setVisible(true);
        String scormId = String.valueOf(treeModel.lookupScormNodeId(tn));
        updateNextPreviousButtons(scormId);
        displayMessages(scormId, (String) tn.getUserObject());
    }
    updateMenuTreeIconsAndMessages();
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Example 59 with GenericTreeNode

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

the class TaxonomyAllTreesBuilder method loadTreeModel.

public void loadTreeModel(GenericTreeModel taxonomyTreesModel) {
    List<Taxonomy> taxonomyList = taxonomyService.getTaxonomyList();
    GenericTreeNode rootNode = new GenericTreeNode("Root", ROOT);
    taxonomyTreesModel.setRootNode(rootNode);
    Map<Taxonomy, GenericTreeNode> rootNodesMap = new HashMap<>();
    for (Taxonomy taxonomy : taxonomyList) {
        GenericTreeNode node = new GenericTreeNode("taxonomy-" + taxonomy.getKey());
        node.setTitle(taxonomy.getDisplayName());
        node.setIconCssClass("o_icon_taxonomy");
        node.setUserObject(taxonomy);
        rootNode.addChild(node);
        rootNodesMap.put(taxonomy, node);
    }
    loadTreeModel(rootNodesMap, null);
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HashMap(java.util.HashMap)

Example 60 with GenericTreeNode

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

the class TaxonomyAllTreesBuilder method loadTreeModel.

public void loadTreeModel(GenericTreeModel taxonomyTreesModel, Taxonomy taxonomy) {
    Map<Taxonomy, GenericTreeNode> rootNodesMap = new HashMap<>();
    GenericTreeNode rootNode = new GenericTreeNode("taxonomy-" + taxonomy.getKey());
    rootNode.setTitle(taxonomy.getDisplayName());
    rootNode.setIconCssClass("o_icon_taxonomy");
    rootNode.setUserObject(taxonomy);
    taxonomyTreesModel.setRootNode(rootNode);
    rootNodesMap.put(taxonomy, rootNode);
    loadTreeModel(rootNodesMap, taxonomy);
}
Also used : Taxonomy(org.olat.modules.taxonomy.Taxonomy) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HashMap(java.util.HashMap)

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