Search in sources :

Example 81 with TreeNode

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

the class QuestionPoolMenuTreeModel method buildMyTaxonomyNodes.

private void buildMyTaxonomyNodes(TreeNode parentNode) {
    if (!securityCallback.canUseReviewProcess())
        return;
    qpoolTaxonomyTreeBuilder.loadTaxonomyLevelsMy(identity);
    List<TaxonomyLevel> taxonomyLevels = qpoolTaxonomyTreeBuilder.getTreeTaxonomyLevels();
    for (TaxonomyLevel taxonomyLevel : taxonomyLevels) {
        TreeNode node = new MyTaxonomyLevelTreeNode(stackPanel, securityCallback, taxonomyLevel);
        parentNode.addChild(node);
    }
}
Also used : GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel)

Example 82 with TreeNode

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

the class QuestionPoolMenuTreeModel method buildBusinessGroupTreeNodes.

private void buildBusinessGroupTreeNodes(TreeNode parentNode) {
    if (!securityCallback.canUseGroups())
        return;
    List<BusinessGroup> groups = qpoolService.getResourcesWithSharedItems(identity).stream().sorted(Comparator.comparing(BusinessGroup::getName)).collect(Collectors.toList());
    for (BusinessGroup group : groups) {
        TreeNode node = new BusinessGroupTreeNode(stackPanel, securityCallback, group);
        parentNode.addChild(node);
    }
}
Also used : BusinessGroup(org.olat.group.BusinessGroup) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 83 with TreeNode

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

the class MergeTaxonomyLevelController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (levels.size() > 1) {
        Collections.sort(levels, new TaxonomyLevelDepthComparator());
    }
    String selectedNodeKey = mergeToEl.getSelectedKey();
    TreeNode selectedNode = treeModel.getNodeById(selectedNodeKey);
    TaxonomyLevel mergeTo = (TaxonomyLevel) selectedNode.getUserObject();
    StringBuilder sb = new StringBuilder();
    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.merge.level", new String[] { sb.toString() });
}
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 84 with TreeNode

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

the class MergeTaxonomyLevelController method buildMergeToSelection.

private void buildMergeToSelection(TreeNode node, String identation, List<String> keys, List<String> values) {
    String childIndentation = identation + "&nbsp;&nbsp;";
    int numOfChildren = node.getChildCount();
    for (int i = 0; i < numOfChildren; i++) {
        TreeNode child = (TreeNode) node.getChildAt(i);
        if (!selectedNodeIds.contains(child.getIdent())) {
            keys.add(child.getIdent());
            values.add(identation + StringHelper.escapeHtml(child.getTitle()));
            buildMergeToSelection(child, childIndentation, keys, values);
        }
    }
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode)

Example 85 with TreeNode

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

the class MoveTaxonomyLevelController method isParent.

private boolean isParent(TaxonomyLevel levelToMove) {
    TreeNode nodeToMove = taxonomyModel.getNodeById(TaxonomyAllTreesBuilder.nodeKey(levelToMove));
    TreeNode selectedNode = taxonomyEl.getSelectedNode();
    if (selectedNode == taxonomyModel.getRootNode()) {
        // can move to root
        return false;
    }
    for (INode node = nodeToMove; node != null; node = node.getParent()) {
        if (selectedNode == node) {
            return true;
        }
    }
    return false;
}
Also used : INode(org.olat.core.util.nodes.INode) GenericTreeNode(org.olat.core.gui.components.tree.GenericTreeNode) TreeNode(org.olat.core.gui.components.tree.TreeNode)

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