Search in sources :

Example 61 with GenericTreeNode

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

the class TaxonomyAllTreesBuilder method loadTreeModel.

private void loadTreeModel(Map<Taxonomy, GenericTreeNode> rootNodesMap, Taxonomy taxonomy) {
    List<TaxonomyLevel> taxonomyLevels = taxonomyService.getTaxonomyLevels(taxonomy);
    Map<Long, GenericTreeNode> fieldKeyToNode = new HashMap<Long, GenericTreeNode>();
    for (TaxonomyLevel taxonomyLevel : taxonomyLevels) {
        Long key = taxonomyLevel.getKey();
        GenericTreeNode node = fieldKeyToNode.get(key);
        if (node == null) {
            node = new GenericTreeNode(nodeKey(taxonomyLevel));
            node.setTitle(taxonomyLevel.getDisplayName());
            node.setIconCssClass("o_icon_taxonomy_level");
            node.setUserObject(taxonomyLevel);
            fieldKeyToNode.put(key, node);
        }
        TaxonomyLevel parentLevel = taxonomyLevel.getParent();
        if (parentLevel == null) {
            // this is a root
            GenericTreeNode taxonomyNode = rootNodesMap.get(taxonomyLevel.getTaxonomy());
            taxonomyNode.addChild(node);
        } else {
            Long parentKey = parentLevel.getKey();
            GenericTreeNode parentNode = fieldKeyToNode.get(parentKey);
            if (parentNode == null) {
                parentNode = new GenericTreeNode("level-" + parentLevel.getKey());
                parentNode.setTitle(parentLevel.getDisplayName());
                parentNode.setIconCssClass("o_icon_taxonomy_level");
                parentNode.setUserObject(parentLevel);
                fieldKeyToNode.put(parentKey, parentNode);
            }
            parentNode.addChild(node);
        }
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) HashMap(java.util.HashMap) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel)

Example 62 with GenericTreeNode

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

the class WikiMainController method updateWikiMenu.

private void updateWikiMenu(Wiki wiki) {
    Collection<String> links = wiki.getListOfAllPageNames();
    if (wikiMenuNode != null) {
        wikiMenuNode.removeAllChildren();
        for (String link : links) {
            String ident = "w" + Encoder.md5hash(link);
            GenericTreeNode menuItemNode = new GenericTreeNode(ident, link, link);
            wikiMenuNode.addChild(menuItemNode);
        }
    }
    wikiMenuDropdown.removeAllComponents();
    for (String link : links) {
        Link menuLink = LinkFactory.createToolLink(link, "select-page", link, this);
        wikiMenuDropdown.addComponent(menuLink);
    }
    if (editMenuButton != null) {
        wikiMenuDropdown.addComponent(new Spacer("wiki-spacer"));
        wikiMenuDropdown.addComponent(editMenuButton);
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) Spacer(org.olat.core.gui.components.dropdown.Dropdown.Spacer) Link(org.olat.core.gui.components.link.Link)

Example 63 with GenericTreeNode

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

the class EPTOCController method reloadTreeModel.

private void reloadTreeModel(PortfolioStructure struct) {
    EPTOCTreeModel model = (EPTOCTreeModel) treeCtr.getTreeModel();
    if (struct != null) {
        GenericTreeNode node = (GenericTreeNode) TreeHelper.findNodeByUserObject(struct, model.getRootNode());
        if (node != null) {
            node.setTitle(struct.getTitle());
            node.setUserObject(struct);
            model.loadChildNode(struct, node);
        }
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Example 64 with GenericTreeNode

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

the class EPTOCTreeModel method loadNode.

private GenericTreeNode loadNode(PortfolioStructure structure, TreeNode parentNode) {
    String ident = structure.getKey().toString();
    GenericTreeNode structureNode = new GenericTreeNode(ident, structure.getTitle(), structure);
    structureNode.setIconCssClass(structure.getIcon());
    parentNode.addChild(structureNode);
    loadChildNode(structure, structureNode);
    return structureNode;
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode)

Example 65 with GenericTreeNode

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

the class CatalogTreeModel method buildNode.

/**
 * Build a tree node from the given category entry
 * @param catEntry
 * @return
 */
private GenericTreeNode buildNode(CatalogEntry catEntry) {
    GenericTreeNode node = new GenericTreeNode();
    node.setAccessible(false);
    node.setIdent(catEntry.getKey().toString());
    node.setTitle(catEntry.getName());
    node.setUserObject(catEntry);
    entryMap.put(catEntry.getKey(), node);
    return node;
}
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