use of org.olat.core.gui.control.generic.dtabs.DTab in project openolat by klemens.
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 klemens.
the class BaseFullWebappController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (source instanceof Link) {
Link link = (Link) source;
String mC = link.getCommand().substring(0, 1);
if (mC.equals("t")) {
// activate normal tab
SiteInstance s = (SiteInstance) link.getUserObject();
// fix the state of the last tab/site
updateBusinessPath(ureq);
HistoryPoint point = null;
if (siteToBusinessPath.containsKey(s)) {
point = siteToBusinessPath.get(s);
}
activateSite(s, ureq, null, true);
if (point != null) {
BusinessControlFactory.getInstance().addToHistory(ureq, point);
}
updateBusinessPath(ureq, s);
} else if (mC.equals("a")) {
// activate dyntab
DTab dt = (DTab) link.getUserObject();
// fix the state of the last tab/site
updateBusinessPath(ureq);
HistoryPoint point = null;
if (dtabToBusinessPath.containsKey(dt)) {
point = dtabToBusinessPath.get(dt);
}
doActivateDTab(dt);
if (dt.getController() instanceof Activateable2) {
((Activateable2) dt.getController()).activate(ureq, null, new ReloadEvent());
}
if (point != null) {
BusinessControlFactory.getInstance().addToHistory(ureq, point);
}
} else if (mC.equals("c")) {
// close dyntab
DTab dt = (DTab) link.getUserObject();
requestCloseTab(ureq, dt);
}
} else if (source == getWindowControl().getWindowBackOffice().getWindow()) {
if (event == Window.OLDTIMESTAMPCALL) {
getLogger().info("RELOAD");
HistoryPoint point = ureq.getUserSession().popLastHistoryEntry();
if (point != null) {
back(ureq, point);
}
}
}
}
use of org.olat.core.gui.control.generic.dtabs.DTab in project openolat by klemens.
the class BaseFullWebappController method addDTab.
@Override
public boolean addDTab(UserRequest ureq, DTab dt) {
if (isDisposed()) {
return false;
}
DTab old = getDTab(dt.getOLATResourceable());
if (old != null) {
return true;
}
// add to tabs list
synchronized (dtabs) {
// make dtabs and dtabsControllers access synchronized
dtabs.add(dt);
dtabsLinkNames.add(dtabCreateCounter);
Link link = LinkFactory.createCustomLink("a" + dtabCreateCounter, "a" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
link.setCustomDisplayText(StringHelper.escapeHtml(dt.getNavElement().getTitle()));
link.setIconLeftCSS("o_icon o_icon-fw " + dt.getNavElement().getIconCSSClass());
link.setTitle(dt.getTitle());
link.setUserObject(dt);
// Set accessibility access key using the 's' key. You can loop through all opened tabs by
// pressing s repetitively (works only in IE/FF which is normally used by blind people)
link.setAccessKey("s");
// add close links
Link calink = LinkFactory.createCustomLink("c" + dtabCreateCounter, "c" + dtabCreateCounter, "", Link.NONTRANSLATED, navTabsVc, this);
calink.setCustomEnabledLinkCSS("o_navbar_tab_close");
calink.setIconLeftCSS("o_icon o_icon_close_tab");
calink.setTitle(translate("close"));
calink.setUserObject(dt);
Controller dtabCtr = dt.getController();
dtabCtr.addControllerListener(this);
updateBusinessPath(ureq, dt);
// add to tabs controller lookup table for later event dispatching
dtabsControllers.add(dtabCtr);
// increase DTab added counter.
dtabCreateCounter++;
}
return true;
}
use of org.olat.core.gui.control.generic.dtabs.DTab in project openolat by klemens.
the class BaseFullWebappController method lockGUI.
private void lockGUI() {
if (topnavCtr != null) {
topnavCtr.lock();
}
if (footerCtr != null) {
footerCtr.lock();
}
if (userToolsMenuCtrl != null) {
userToolsMenuCtrl.lock();
}
if (dtabsControllers != null) {
for (int i = dtabsControllers.size(); i-- > 0; ) {
DTab tab = dtabs.get(i);
if (lockResource == null || !lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId())) {
removeDTab(null, tab);
} else if (lockResource != null && lockResource.getResourceableId().equals(tab.getOLATResourceable().getResourceableId()) && lockStatus != LockStatus.locked) {
removeDTab(null, tab);
}
}
}
navSitesVc.contextPut("visible", Boolean.FALSE);
navSitesVc.setDirty(true);
navTabsVc.setDirty(true);
main.setContent(new Panel("empty-mode"));
}
use of org.olat.core.gui.control.generic.dtabs.DTab 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);
}
}
}
Aggregations