use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class UserInfoMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
String type = entries.get(0).getOLATResourceable().getResourceableTypeName();
if (StringHelper.containsNonWhitespace(type)) {
Controller controller = createComponent(ureq, type);
if (controller != null) {
if (controller instanceof Activateable2) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
((Activateable2) controller).activate(ureq, subEntries, entries.get(0).getTransientState());
}
main.setContent(controller.getInitialComponent());
TreeNode selectedNode = TreeHelper.findNodeByUserObject(type, menuTree.getTreeModel().getRootNode());
if (selectedNode != null) {
menuTree.setSelectedNode(selectedNode);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class EPTOCController method doSelectTreeElement.
private void doSelectTreeElement(UserRequest ureq, TreeEvent te) {
TreeNode selectedNode = treeCtr.getTreeModel().getNodeById(te.getNodeId());
Object userObj = selectedNode.getUserObject();
if (userObj instanceof PortfolioStructure) {
// structure clicked
structureClicked = (PortfolioStructure) userObj;
refreshAddElements(ureq, structureClicked);
delButton.setVisible(true);
// send event to load this page
fireEvent(ureq, new EPStructureChangeEvent(EPStructureChangeEvent.SELECTED, structureClicked));
} else if (userObj instanceof AbstractArtefact) {
// artefact clicked
Object parentObj = ((TreeNode) selectedNode.getParent()).getUserObject();
if (parentObj instanceof PortfolioStructure) {
artefactClicked = (AbstractArtefact) userObj;
PortfolioStructure structure = (PortfolioStructure) parentObj;
refreshAddElements(ureq, null);
delButton.setVisible(true);
fireEvent(ureq, new EPArtefactClicked(ARTEFACT_NODE_CLICKED, structure));
}
} else {
// root tree node clicked, no add/delete link
delButton.setVisible(false);
refreshAddElements(ureq, null);
fireEvent(ureq, new Event(ARTEFACT_NODE_CLICKED));
}
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class AbstractCourseNodeWebService method updateCourseNode.
// fxdiff FXOLAT-122: course management
private CourseNodeVO updateCourseNode(String nodeId, String shortTitle, String longTitle, String learningObjectives, String visibilityExpertRules, String accessExpertRules, CustomConfigDelegate delegateConfig, CourseEditSession editSession) {
ICourse course = editSession.getCourse();
TreeNode updateEditorNode = course.getEditorTreeModel().getNodeById(nodeId);
CourseNode updatedNode = course.getEditorTreeModel().getCourseNode(nodeId);
if (StringHelper.containsNonWhitespace(shortTitle)) {
updatedNode.setShortTitle(shortTitle);
}
if (StringHelper.containsNonWhitespace(longTitle)) {
updatedNode.setLongTitle(longTitle);
}
if (StringHelper.containsNonWhitespace(learningObjectives)) {
updatedNode.setLearningObjectives(learningObjectives);
}
if (visibilityExpertRules != null) {
Condition cond = createExpertCondition(CONDITION_ID_VISIBILITY, visibilityExpertRules);
updatedNode.setPreConditionVisibility(cond);
}
if (StringHelper.containsNonWhitespace(accessExpertRules) && updatedNode instanceof AbstractAccessableCourseNode) {
Condition cond = createExpertCondition(CONDITION_ID_ACCESS, accessExpertRules);
((AbstractAccessableCourseNode) updatedNode).setPreConditionAccess(cond);
}
if (delegateConfig != null) {
ModuleConfiguration moduleConfig = updatedNode.getModuleConfiguration();
delegateConfig.configure(course, updatedNode, moduleConfig);
}
course.getEditorTreeModel().nodeConfigChanged(updateEditorNode);
CourseEditorTreeNode editorNode = course.getEditorTreeModel().getCourseEditorNodeContaining(updatedNode);
CourseNodeVO vo = get(updatedNode);
vo.setParentId(editorNode.getParent() == null ? null : editorNode.getParent().getIdent());
return vo;
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class AssessmentCourseTreeController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == menuTree) {
if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
TreeNode selectedTreeNode = menuTree.getSelectedNode();
Object uo = selectedTreeNode.getUserObject();
if (uo instanceof CourseNode) {
processSelectCourseNodeWithMemory(ureq, selectedTreeNode, (CourseNode) uo);
}
}
} else if (stackPanel == source) {
if (event instanceof PopEvent) {
PopEvent pe = (PopEvent) event;
if ("users".equals(pe.getUserObject())) {
fixHistory(ureq, "Users", "users");
} else if ("groups".equals(pe.getUserObject())) {
if (selectedNodeChanged != null) {
CourseNode cn = (CourseNode) selectedNodeChanged.getUserObject();
menuTree.setSelectedNode(selectedNodeChanged);
processSelectCourseNodeWithMemory(ureq, selectedNodeChanged, cn);
selectedNodeChanged = null;
} else {
fixHistory(ureq, "BusinessGroups", "groups");
}
}
}
}
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class AssessmentCourseTreeController method switchToBusinessGroupsView.
protected void switchToBusinessGroupsView(UserRequest ureq) {
view = View.groups;
TreeNode treeNode = menuTree.getSelectedNode();
CourseNode courseNode = (CourseNode) treeNode.getUserObject();
Controller ctrl = doSelectCourseNode(ureq, treeNode, courseNode);
if (ctrl instanceof Activateable2) {
((Activateable2) ctrl).activate(ureq, null, null);
}
}
Aggregations