Search in sources :

Example 1 with TaxonomyAllTreesBuilder

use of org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder in project OpenOLAT by OpenOLAT.

the class EditTaxonomyLevelController method buildPathKeysAndValues.

private void buildPathKeysAndValues(List<String> pathKeyList, List<String> pathValueList) {
    pathKeyList.add("-");
    pathValueList.add("");
    List<TreeNode> nodeList = new TaxonomyAllTreesBuilder().getFlattedModel(taxonomy, false);
    for (TreeNode node : nodeList) {
        TaxonomyLevel taxonomyLevel = (TaxonomyLevel) node.getUserObject();
        pathKeyList.add(taxonomyLevel.getKey().toString());
        pathValueList.add(taxonomyLevel.getMaterializedPathIdentifiers());
    }
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyAllTreesBuilder(org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder)

Example 2 with TaxonomyAllTreesBuilder

use of org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder 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)

Example 3 with TaxonomyAllTreesBuilder

use of org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder in project openolat by klemens.

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)

Example 4 with TaxonomyAllTreesBuilder

use of org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder in project openolat by klemens.

the class EditTaxonomyLevelController method buildPathKeysAndValues.

private void buildPathKeysAndValues(List<String> pathKeyList, List<String> pathValueList) {
    pathKeyList.add("-");
    pathValueList.add("");
    List<TreeNode> nodeList = new TaxonomyAllTreesBuilder().getFlattedModel(taxonomy, false);
    for (TreeNode node : nodeList) {
        TaxonomyLevel taxonomyLevel = (TaxonomyLevel) node.getUserObject();
        pathKeyList.add(taxonomyLevel.getKey().toString());
        pathValueList.add(taxonomyLevel.getMaterializedPathIdentifiers());
    }
}
Also used : TreeNode(org.olat.core.gui.components.tree.TreeNode) TaxonomyLevel(org.olat.modules.taxonomy.TaxonomyLevel) TaxonomyAllTreesBuilder(org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder)

Aggregations

TreeNode (org.olat.core.gui.components.tree.TreeNode)4 TaxonomyLevel (org.olat.modules.taxonomy.TaxonomyLevel)4 TaxonomyAllTreesBuilder (org.olat.modules.taxonomy.manager.TaxonomyAllTreesBuilder)4 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Map (java.util.Map)2 Set (java.util.Set)2 Collectors (java.util.stream.Collectors)2 UserRequest (org.olat.core.gui.UserRequest)2 FormItemContainer (org.olat.core.gui.components.form.flexible.FormItemContainer)2 FormBasicController (org.olat.core.gui.components.form.flexible.impl.FormBasicController)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 MenuTreeItem (org.olat.core.gui.components.tree.MenuTreeItem)2 Controller (org.olat.core.gui.control.Controller)2 Event (org.olat.core.gui.control.Event)2 WindowControl (org.olat.core.gui.control.WindowControl)2 INode (org.olat.core.util.nodes.INode)2 Taxonomy (org.olat.modules.taxonomy.Taxonomy)2