use of org.olat.core.gui.control.generic.dtabs.DTab in project OpenOLAT by OpenOLAT.
the class BaseFullWebappController method requestCloseTab.
/**
* @param dt
*/
private void requestCloseTab(UserRequest ureq, DTab delt) {
Controller c = delt.getController();
if (c instanceof VetoableCloseController) {
VetoableCloseController vcc = (VetoableCloseController) c;
// rembember current dtab, and swap to the temporary one
DTab reTab = curDTab;
doActivateDTab(delt);
boolean immediateClose = vcc.requestForClose(ureq);
if (!immediateClose) {
return;
} else {
if (reTab != null) {
doActivateDTab(reTab);
}
removeDTab(ureq, delt);
}
} else {
removeDTab(ureq, delt);
}
}
use of org.olat.core.gui.control.generic.dtabs.DTab 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);
}
}
}
use of org.olat.core.gui.control.generic.dtabs.DTab in project openolat by klemens.
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.generic.dtabs.DTab in project openolat by klemens.
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.DTab in project openolat by klemens.
the class DisposedCourseRestartController method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component,
* org.olat.core.gui.control.Event)
*/
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source == restartLink) {
OLATResourceable ores = OLATResourceManager.getInstance().findResourceable(courseRepositoryEntry.getOlatResource().getResourceableId(), courseRepositoryEntry.getOlatResource().getResourceableTypeName());
if (ores == null) {
// course was deleted!
MessageController msgController = MessageUIFactory.createInfoMessage(ureq, getWindowControl(), translate("course.deleted.title"), translate("course.deleted.text"));
panel.setContent(msgController.getInitialComponent());
} else {
OLATResourceable reOres = OresHelper.clone(courseRepositoryEntry);
DTabs dtabs = getWindowControl().getWindowBackOffice().getWindow().getDTabs();
if (dtabs != null) {
DTab dt = dtabs.getDTab(reOres);
if (dt != null) {
dtabs.removeDTab(ureq, dt);
}
}
List<ContextEntry> entries = null;
List<HistoryPoint> stacks = ureq.getUserSession().getHistoryStack();
for (int i = stacks.size(); i-- > 0; ) {
HistoryPoint point = stacks.get(i);
if (point != null && point.getEntries() != null && point.getEntries().size() > 0) {
ContextEntry entry = point.getEntries().get(0);
if (reOres.equals(entry.getOLATResourceable())) {
entries = point.getEntries();
break;
}
}
}
WindowControl bwControl;
if (entries == null) {
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(getWindowControl(), reOres);
} else {
BusinessControl bc = BusinessControlFactory.getInstance().createFromContextEntries(entries);
bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(bc, getWindowControl());
}
NewControllerFactory.getInstance().launch(ureq, bwControl);
dispose();
}
}
}
Aggregations