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