use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method back.
protected void back(UserRequest ureq, HistoryPoint cstate) {
List<ContextEntry> entries = cstate.getEntries();
if (entries.isEmpty())
return;
entries = new ArrayList<ContextEntry>(entries);
ContextEntry state = entries.remove(0);
// no red screen for this
if (state == null)
return;
OLATResourceable ores = state.getOLATResourceable();
if (ores != null && "HomeSite".equals(ores.getResourceableTypeName())) {
activateSite(userTools, ureq, entries, false);
} else {
DTab dt = getDTab(ores);
if (dt != null) {
doActivateDTab(dt);
if (dt.getController() instanceof Activateable2) {
((Activateable2) dt.getController()).activate(ureq, entries, null);
}
updateBusinessPath(ureq, dt);
} else {
StateEntry s = state.getTransientState();
if (s instanceof StateSite && ((StateSite) s).getSite() != null && sites != null) {
SiteInstance site = ((StateSite) s).getSite();
for (SiteInstance savedSite : sites) {
if (savedSite != null && site.getClass().equals(savedSite.getClass())) {
activateSite(savedSite, ureq, entries, false);
}
}
}
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method activateSite.
/**
* Activate a site if not locked
*
* @param s
* @param ureq
* @param entries
* @param forceReload
*/
private void activateSite(SiteInstance s, UserRequest ureq, List<ContextEntry> entries, boolean forceReload) {
if (lockResource != null)
return;
BornSiteInstance bs = siteToBornSite.get(s);
GuiStack gs;
Controller resC;
// PB//WindowControl site_wControl;
if (bs != null && s != curSite) {
// single - click -> fetch guistack from cache
gs = bs.getGuiStackHandle();
resC = bs.getController();
} else if (bs != null && s == curSite && !forceReload) {
// via activate, don't force the reload
gs = bs.getGuiStackHandle();
resC = bs.getController();
} else {
// dispose old controller
if (bs != null) {
// already in cache -> dispose old
bs.getController().dispose();
}
// reset site and create new controller
s.reset();
resC = s.createController(ureq, getWindowControl());
gs = getWindowControl().getWindowBackOffice().createGuiStack(resC.getInitialComponent());
// PB//site_wControl = bwControl;
// PB//siteToBornSite.put(s, new BornSiteInstance(gs, resC, bwControl));
siteToBornSite.put(s, new BornSiteInstance(gs, resC));
}
doActivateSite(s, gs);
if (resC instanceof Activateable2) {
((Activateable2) resC).activate(ureq, entries, null);
}
// perhaps has activation changed the gui stack and it need to be updated
setGuiStack(gs);
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class UserAdminMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
GenericTreeModel tm = (GenericTreeModel) olatMenuTree.getTreeModel();
ContextEntry entry = entries.get(0);
String entryPoint = entry.getOLATResourceable().getResourceableTypeName();
if (entryPoint.startsWith("notifications") || entryPoint.startsWith("NewIdentityCreated")) {
TreeNode node = tm.findNodeByUserObject("created.newUsersNotification");
selectNode(ureq, node);
} else if (entryPoint.startsWith("AE")) {
TreeNode node = tm.findNodeByUserObject("menuqueries");
int pos = entries.get(0).getOLATResourceable().getResourceableId().intValue();
if (pos >= 0 && pos < node.getChildCount()) {
TreeNode childNode = (TreeNode) node.getChildAt(pos);
selectNode(ureq, childNode);
}
} else {
TreeNode node = tm.findNodeByUserObject(entryPoint);
if (node != null) {
selectNode(ureq, node);
entries = entries.subList(1, entries.size());
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
if (!entries.isEmpty() && userAdminCtr != null) {
userAdminCtr.activate(ureq, entries, null);
}
}
}
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class RunMainController method updateTreeAndContent.
private CourseNode updateTreeAndContent(UserRequest ureq, CourseNode calledCourseNode, String nodecmd, List<ContextEntry> entries, StateEntry state) {
// might be used in both controllers with the same ID (e.g. the course folder)
if (currentNodeController != null && !currentNodeController.isDisposed() && !navHandler.isListening(currentNodeController)) {
currentNodeController.dispose();
}
NodeClickedRef nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), calledCourseNode, this, nodecmd);
if (!nclr.isVisible()) {
// if not root -> fallback to root. e.g. when a direct node jump fails
if (calledCourseNode != null) {
nclr = navHandler.evaluateJumpToCourseNode(ureq, getWindowControl(), null, this, null);
}
if (!nclr.isVisible()) {
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.noaccess.title"), translate("course.noaccess.text"));
contentP.setContent(msgController.getInitialComponent());
luTree.setTreeModel(new GenericTreeModel());
return null;
}
}
treeModel = nclr.getTreeModel();
luTree.setTreeModel(treeModel);
String selNodeId = nclr.getSelectedNodeId();
luTree.setSelectedNodeId(selNodeId);
luTree.setOpenNodeIds(nclr.getOpenNodeIds());
// get new run controller.
currentNodeController = nclr.getRunController();
addToHistory(ureq, currentNodeController);
if (currentNodeController instanceof TitledWrapperController) {
Controller contentcontroller = ((TitledWrapperController) currentNodeController).getContentController();
addToHistory(ureq, contentcontroller);
if (contentcontroller instanceof Activateable2) {
((Activateable2) contentcontroller).activate(ureq, entries, state);
}
} else if (currentNodeController instanceof Activateable2) {
((Activateable2) currentNodeController).activate(ureq, entries, state);
}
if (currentNodeController != null) {
contentP.setContent(currentNodeController.getInitialComponent());
} else {
MessageController msgCtrl = MessageUIFactory.createWarnMessage(ureq, getWindowControl(), null, translate("msg.nodenotavailableanymore"));
listenTo(msgCtrl);
contentP.setContent(msgCtrl.getInitialComponent());
}
updateNextPrevious();
updateCourseDataAttributes(nclr.getCalledCourseNode());
updateLastUsage(nclr.getCalledCourseNode());
return nclr.getCalledCourseNode();
}
use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.
the class RunMainController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty()) {
if (currentNodeController != null) {
addToHistory(ureq, currentNodeController);
} else {
addToHistory(ureq, this);
}
return;
}
ContextEntry firstEntry = entries.get(0);
String type = firstEntry.getOLATResourceable().getResourceableTypeName();
if ("CourseNode".equalsIgnoreCase(type) || "Part".equalsIgnoreCase(type)) {
CourseNode cn = course.getRunStructure().getNode(firstEntry.getOLATResourceable().getResourceableId().toString());
if (currentCourseNode == null || !currentCourseNode.equals(cn)) {
getWindowControl().makeFlat();
// add logging information for case course gets started via jump-in
// link/search
addLoggingResourceable(LoggingResourceable.wrap(course));
if (cn != null) {
addLoggingResourceable(LoggingResourceable.wrap(cn));
}
// consume our entry
if (entries.size() > 1) {
entries = entries.subList(1, entries.size());
}
updateTreeAndContent(ureq, cn, null, entries, firstEntry.getTransientState());
} else if (currentCourseNode.equals(cn)) {
// consume our entry
if (entries.size() > 1) {
entries = entries.subList(1, entries.size());
}
// the node to be activated is the one that is already on the screen
if (currentNodeController instanceof Activateable2) {
Activateable2 activateable = (Activateable2) currentNodeController;
activateable.activate(ureq, entries, state);
}
}
}
}
Aggregations