use of org.olat.core.gui.control.navigation.BornSiteInstance in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method doDispose.
@Override
protected void doDispose() {
// deregister for chief global sticky messages events
GlobalStickyMessage.deregisterForGlobalStickyMessage(this);
if (dtabs != null) {
for (DTab tab : dtabs) {
tab.dispose();
}
for (BornSiteInstance bornSite : siteToBornSite.values()) {
bornSite.dispose();
}
dtabs = null;
dtabsControllers = null;
sites = null;
siteToBornSite = null;
siteToBusinessPath = null;
dtabToBusinessPath = null;
}
// clear the DTabs Service
WindowBackOffice wbackOffice = getWindowControl().getWindowBackOffice();
wbackOffice.getWindow().setDTabs(null);
wbackOffice.removeCycleListener(this);
if (jsServerC != null) {
jsServerC.dispose();
jsServerC = null;
}
if (debugC != null) {
debugC.dispose();
debugC = null;
}
if (inlineTranslationC != null) {
inlineTranslationC.dispose();
inlineTranslationC = null;
}
if (developmentC != null) {
developmentC.dispose();
developmentC = null;
}
// deregister for assessment mode
CoordinatorManager.getInstance().getCoordinator().getEventBus().deregisterFor(this, AssessmentModeNotificationEvent.ASSESSMENT_MODE_NOTIFICATION);
}
use of org.olat.core.gui.control.navigation.BornSiteInstance in project openolat by klemens.
the class BaseFullWebappController method popTheTabState.
private void popTheTabState(UserRequest ureq) {
if (siteAndTabs.isEmpty() && sites != null) {
SiteInstance firstSite = sites.get(0);
BornSiteInstance bs = siteToBornSite.get(firstSite);
if (bs == null) {
activateSite(firstSite, ureq, null, false);
} else {
doActivateSite(firstSite, bs.getGuiStackHandle());
}
} else if (!siteAndTabs.isEmpty()) {
TabState state = siteAndTabs.remove(siteAndTabs.size() - 1);
if (state.getSite() != null) {
// latest selected static tab
// activate previous chosen static site -> this site has already been
// constructed and is thus in the cache
SiteInstance si = state.getSite();
BornSiteInstance bs = siteToBornSite.get(si);
// bs != null since clicked previously
GuiStack gsh = bs.getGuiStackHandle();
doActivateSite(si, gsh);
if (siteToBusinessPath.containsValue(si)) {
ureq.getUserSession().addToHistory(ureq, siteToBusinessPath.get(si));
}
} else if (state.getDtab() != null && !state.getDtab().getController().isDisposed()) {
DTab tab = state.getDtab();
doActivateDTab(tab);
if (dtabToBusinessPath.containsKey(tab)) {
ureq.getUserSession().addToHistory(ureq, dtabToBusinessPath.get(tab));
}
} else {
popTheTabState(ureq);
}
}
}
use of org.olat.core.gui.control.navigation.BornSiteInstance in project openolat by klemens.
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.navigation.BornSiteInstance in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method doActivateSite.
private void doActivateSite(SiteInstance s, GuiStack gs) {
removeCurrentCustomCSSFromView();
// set curSite
setCurrent(s, null);
setGuiStack(gs);
NavElement navEl = s.getNavElement();
if (navEl != null) {
getWindow().setTitle(getTranslator(), navEl.getTitle());
setBodyDataResource("site", s.getClass().getSimpleName(), null);
}
// update marking of active site/tab
navSitesVc.setDirty(true);
navTabsVc.setDirty(true);
// add css for this site
BornSiteInstance bs = siteToBornSite.get(s);
if (bs != null) {
addCurrentCustomCSSToView(bs.getCustomCSS());
}
}
use of org.olat.core.gui.control.navigation.BornSiteInstance in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method popTheTabState.
private void popTheTabState(UserRequest ureq) {
if (siteAndTabs.isEmpty() && sites != null) {
SiteInstance firstSite = sites.get(0);
BornSiteInstance bs = siteToBornSite.get(firstSite);
if (bs == null) {
activateSite(firstSite, ureq, null, false);
} else {
doActivateSite(firstSite, bs.getGuiStackHandle());
}
} else if (!siteAndTabs.isEmpty()) {
TabState state = siteAndTabs.remove(siteAndTabs.size() - 1);
if (state.getSite() != null) {
// latest selected static tab
// activate previous chosen static site -> this site has already been
// constructed and is thus in the cache
SiteInstance si = state.getSite();
BornSiteInstance bs = siteToBornSite.get(si);
// bs != null since clicked previously
GuiStack gsh = bs.getGuiStackHandle();
doActivateSite(si, gsh);
if (siteToBusinessPath.containsValue(si)) {
ureq.getUserSession().addToHistory(ureq, siteToBusinessPath.get(si));
}
} else if (state.getDtab() != null && !state.getDtab().getController().isDisposed()) {
DTab tab = state.getDtab();
doActivateDTab(tab);
if (dtabToBusinessPath.containsKey(tab)) {
ureq.getUserSession().addToHistory(ureq, dtabToBusinessPath.get(tab));
}
} else {
popTheTabState(ureq);
}
}
}
Aggregations