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);
}
}
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);
}
}
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() });
}
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 + " ";
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);
}
}
}
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;
}
Aggregations