use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.
the class GroupInfoMainController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == menuTree) {
if (event.getCommand().equals(MenuTree.COMMAND_TREENODE_CLICKED)) {
TreeNode selectedNode = menuTree.getSelectedNode();
String command = (String) selectedNode.getUserObject();
if (command == null) {
// use the delegate if available
selectedNode = menuTree.getSelectedNode().getDelegate();
if (selectedNode != null) {
menuTree.setSelectedNode(selectedNode);
command = (String) selectedNode.getUserObject();
}
if (command == null) {
// fallback
command = COMMAND_MENU_GROUPINFO;
}
}
if (command.equals(COMMAND_MENU_GROUPINFO)) {
getInfosController(ureq);
} else if (command.equals(COMMAND_MENU_GROUPMEMBERS)) {
getMembersController(ureq);
} else if (command.equals(COMMAND_MENU_GROUPCONTACT)) {
getContactController(ureq);
} else if (command.equals(COMMAND_MENU_GROUPCALENDAR)) {
getCalendarController(ureq);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.
the class GroupInfoMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
addToHistory(ureq);
return;
}
ContextEntry entry = entries.get(0);
String menuItem = entry.getOLATResourceable().getResourceableTypeName();
Object nodeUserObject = null;
Controller selectedController = null;
if ("Infos".equals(menuItem)) {
selectedController = getInfosController(ureq);
nodeUserObject = COMMAND_MENU_GROUPINFO;
} else if ("Contact".equals(menuItem)) {
selectedController = getContactController(ureq);
nodeUserObject = COMMAND_MENU_GROUPCONTACT;
} else if ("Members".equals(menuItem)) {
selectedController = getMembersController(ureq);
nodeUserObject = COMMAND_MENU_GROUPMEMBERS;
}
if (selectedController != null) {
TreeNode node = TreeHelper.findNodeByUserObject(nodeUserObject, menuTree.getTreeModel().getRootNode());
if (node != null) {
menuTree.setSelectedNode(node);
}
addToHistory(ureq, selectedController);
}
}
use of org.olat.core.gui.components.tree.TreeNode in project OpenOLAT by OpenOLAT.
the class QTI21RuntimeStatisticsController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (courseTree == source) {
if (event instanceof TreeEvent) {
TreeEvent te = (TreeEvent) event;
if (MenuTree.COMMAND_TREENODE_CLICKED.equals(te.getCommand())) {
String ident = te.getNodeId();
TreeNode selectedNode = courseTree.getTreeModel().getNodeById(ident);
doSelectNode(ureq, selectedNode);
}
}
}
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class GenericMainController method activate.
protected void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
TreeNode selectedNode = getMenuTree().getSelectedNode();
String node = entry.getOLATResourceable().getResourceableTypeName();
if (node != null && node.startsWith(GMCMT)) {
activate(ureq, node + ":" + entries.get(0).getOLATResourceable().getResourceableId());
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
} else {
// maybe the node is a GAE-NavigationKey ?
GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(className, node);
if (gAE != null) {
// if the controller is already selected, only activate it, don't reinstanciate it
if (selectedNode != null && selectedNode.getUserObject() != gAE) {
activateTreeNodeByActionExtension(ureq, gAE);
}
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
}
}
}
use of org.olat.core.gui.components.tree.TreeNode in project openolat by klemens.
the class GenericMainController method init.
/**
* use after optional addChildNodeToAppend() or addChildNodeToPrepend() calls
* to initialize MainController and set Panel
*
* @param ureq
*/
public void init(UserRequest ureq) {
olatMenuTree = new MenuTree("olatMenuTree");
TreeModel tm = buildTreeModel(ureq);
olatMenuTree.setTreeModel(tm);
content = new Panel("content");
TreeNode firstNode = tm.getRootNode();
TreeNode nodeToSelect = getLastDelegate(firstNode);
olatMenuTree.setSelectedNodeId(nodeToSelect.getIdent());
olatMenuTree.addListener(this);
// default is to not display the root element and to let user open/close sub elements
olatMenuTree.setRootVisible(false);
olatMenuTree.setExpandSelectedNode(false);
Object uobject = nodeToSelect.getUserObject();
contentCtr = getContentCtr(uobject, ureq);
// auto dispose later
listenTo(contentCtr);
Component resComp = contentCtr.getInitialComponent();
content.setContent(resComp);
columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), olatMenuTree, content, className);
// auto dispose later
listenTo(columnLayoutCtr);
// create the stack
stackVC = new BreadcrumbedStackedPanel("genericStack", getTranslator(), this);
stackVC.pushController("content", columnLayoutCtr);
putInitialPanel(stackVC);
}
Aggregations