Search in sources :

Example 56 with TreeNode

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

the class QuestionPoolMenuTreeModel method buildMarkedTreeNode.

private void buildMarkedTreeNode(TreeNode parentNode) {
    TreeNode node = new MarkedQuestionsTreeNode(stackPanel, securityCallback, translator.translate("menu.database.favorit"));
    parentNode.addChild(node);
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 57 with TreeNode

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

the class QuestionPoolMenuTreeModel method buildAdminSubTreeModel.

private void buildAdminSubTreeModel(TreeNode adminNode) {
    adminNode.removeAllChildren();
    if (securityCallback.canConfigReviewProcess()) {
        TreeNode node = new ReviewProcessAdminTreeNode(translator.translate("menu.admin.review.process"));
        adminNode.addChild(node);
    }
    if (securityCallback.canConfigTaxonomies()) {
        TreeNode node = new TaxonomyAdminTreeNode(translator.translate("menu.admin.studyfields"));
        adminNode.addChild(node);
    }
    if (securityCallback.canConfigPools()) {
        TreeNode node = new PoolsAdminTreeNode(translator.translate("menu.admin.pools"));
        adminNode.addChild(node);
    }
    if (securityCallback.canConfigItemTypes()) {
        TreeNode node = new QItemTypesAdminTreeNode(translator.translate("menu.admin.types"));
        adminNode.addChild(node);
    }
    if (securityCallback.canConfigEducationalContext()) {
        TreeNode node = new QEducationalContextsAdminTreeNode(translator.translate("menu.admin.levels"));
        adminNode.addChild(node);
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 58 with TreeNode

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

the class QuestionPoolMenuTreeModel method buildFinalSubTreeModel.

public void buildFinalSubTreeModel(TreeNode rootNode) {
    if (!securityCallback.canUseReviewProcess())
        return;
    qpoolTaxonomyTreeBuilder.loadTaxonomyLevelsFinal(identity);
    List<TaxonomyLevel> taxonomyLevels = qpoolTaxonomyTreeBuilder.getTreeTaxonomyLevels();
    if (!taxonomyLevels.isEmpty()) {
        finalNode = new GenericTreeNode(translator.translate("menu.final"));
        finalNode.setTitle(translator.translate("menu.final"));
        rootNode.addChild(finalNode);
        for (TaxonomyLevel taxonomyLevel : taxonomyLevels) {
            TreeNode node = new FinalTreeNode(stackPanel, securityCallback, taxonomyLevel);
            finalNode.addChild(node);
        }
        setFirstChildAsDelegate(finalNode);
    }
}
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) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel)

Example 59 with TreeNode

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

the class DeleteTaxonomyLevelController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    StringBuilder sb = new StringBuilder();
    if (levels.size() > 1) {
        Collections.sort(levels, new TaxonomyLevelDepthComparator());
    }
    TaxonomyLevel mergeTo = null;
    if (mergeToEl.isOneSelected() && !"-".equals(mergeToEl.getSelectedKey())) {
        String selectedNodeKey = mergeToEl.getSelectedKey();
        TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
        mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
    }
    for (TaxonomyLevel level : levels) {
        TaxonomyLevel taxonomyLevel = taxonomyService.getTaxonomyLevel(level);
        if (taxonomyService.deleteTaxonomyLevel(taxonomyLevel, mergeTo)) {
            if (sb.length() > 0)
                sb.append(", ");
            sb.append(StringHelper.escapeHtml(taxonomyLevel.getDisplayName()));
        }
    }
    // commit before sending event
    dbInstance.commit();
    fireEvent(ureq, new DeleteTaxonomyLevelEvent());
    showInfo("confirm.deleted.level", new String[] { sb.toString() });
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : TaxonomyLevelDepthComparator(org.olat.modules.taxonomy.ui.component.TaxonomyLevelDepthComparator) TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) DeleteTaxonomyLevelEvent(org.olat.modules.taxonomy.ui.events.DeleteTaxonomyLevelEvent)

Example 60 with TreeNode

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

the class MoveTaxonomyLevelController method loadModel.

private void loadModel() {
    new TaxonomyAllTreesBuilder().loadTreeModel(taxonomyModel, taxonomy);
    // remove children of the level to move
    for (TaxonomyLevel levelToMove : levelsToMove) {
        TreeNode nodeToMove = taxonomyModel.getNodeById(TaxonomyAllTreesBuilder.nodeKey(levelToMove));
        nodeToMove.removeAllChildren();
    }
    // remove the level with
    List<TreeNode> openedNodes = new ArrayList<>();
    filterByAllowedTypes(taxonomyModel.getRootNode(), openedNodes);
    taxonomyModel.sort(taxonomyModel.getRootNode());
    List<String> nodeIds = openedNodes.stream().map(node -> node.getIdent()).collect(Collectors.toList());
    taxonomyEl.setOpenNodeIds(nodeIds);
}
Also used : INode(org.olat.core.util.nodes.INode) Autowired(org.springframework.beans.factory.annotation.Autowired) HashMap(java.util.HashMap) TaxonomyModel(org.olat.modules.taxonomy.model.TaxonomyModel) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) Event(org.olat.core.gui.control.Event) FormBasicController(org.olat.core.gui.components.form.flexible.impl.FormBasicController) FormItemContainer(org.olat.core.gui.components.form.flexible.FormItemContainer) TaxonomyService(org.olat.modules.taxonomy.TaxonomyService) Map(java.util.Map) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TaxonomyLevelType(org.olat.modules.taxonomy.TaxonomyLevelType) Taxonomy(org.olat.modules.taxonomy.Taxonomy) MenuTreeItem(org.olat.core.gui.components.tree.MenuTreeItem) WindowControl(org.olat.core.gui.control.WindowControl) Set(java.util.Set) Collectors(java.util.stream.Collectors) Controller(org.olat.core.gui.control.Controller) TaxonomyLevelTypeToType(org.olat.modules.taxonomy.TaxonomyLevelTypeToType) List(java.util.List) TaxonomyAllTreesBuilder(org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder) TreeNode(org.olat.core.gui.components.tree.TreeNode) UserRequest(org.olat.core.gui.UserRequest) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) ArrayList(java.util.ArrayList) TaxonomyAllTreesBuilder(org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder)

Aggregations

TreeNode (org.olat.core.gui.components.tree.TreeNode)296 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)146 ArrayList (java.util.ArrayList)44 CourseNode (org.olat.course.nodes.CourseNode)38 TreeEvent (org.olat.core.gui.components.tree.TreeEvent)32 ContextEntry (org.olat.core.id.context.ContextEntry)30 Controller (org.olat.core.gui.control.Controller)28 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)24 AssessmentSection (uk.ac.ed.ph.jqtiplus.node.test.AssessmentSection)22 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)20 INode (org.olat.core.util.nodes.INode)20 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)20 AssessmentItemRef (uk.ac.ed.ph.jqtiplus.node.test.AssessmentItemRef)20 ICourse (org.olat.course.ICourse)18 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)16 OLATResourceable (org.olat.core.id.OLATResourceable)16 List (java.util.List)14 TreeModel (org.olat.core.gui.components.tree.TreeModel)14 WindowControl (org.olat.core.gui.control.WindowControl)14 AssertException (org.olat.core.logging.AssertException)14