Search in sources :

Example 6 with DTab

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);
    }
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) ResumeSessionController(org.olat.core.commons.controllers.resume.ResumeSessionController) AssessmentModeGuardController(org.olat.course.assessment.ui.mode.AssessmentModeGuardController) BasicController(org.olat.core.gui.control.controller.BasicController) ChiefController(org.olat.core.gui.control.ChiefController) BaseChiefController(org.olat.core.commons.chiefcontrollers.BaseChiefController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) Controller(org.olat.core.gui.control.Controller) UserToolsMenuController(org.olat.gui.control.UserToolsMenuController)

Example 7 with DTab

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);
            }
        }
    }
}
Also used : BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) DTab(org.olat.core.gui.control.generic.dtabs.DTab) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) Link(org.olat.core.gui.components.link.Link) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 8 with DTab

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;
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) ResumeSessionController(org.olat.core.commons.controllers.resume.ResumeSessionController) AssessmentModeGuardController(org.olat.course.assessment.ui.mode.AssessmentModeGuardController) BasicController(org.olat.core.gui.control.controller.BasicController) ChiefController(org.olat.core.gui.control.ChiefController) BaseChiefController(org.olat.core.commons.chiefcontrollers.BaseChiefController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) Controller(org.olat.core.gui.control.Controller) UserToolsMenuController(org.olat.gui.control.UserToolsMenuController) Link(org.olat.core.gui.components.link.Link)

Example 9 with DTab

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"));
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) OncePanel(org.olat.core.gui.components.panel.OncePanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 10 with DTab

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);
        }
    }
}
Also used : BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) DTab(org.olat.core.gui.control.generic.dtabs.DTab) BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) GuiStack(org.olat.core.gui.control.guistack.GuiStack)

Aggregations

DTab (org.olat.core.gui.control.generic.dtabs.DTab)20 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)8 ContextEntry (org.olat.core.id.context.ContextEntry)8 BaseChiefController (org.olat.core.commons.chiefcontrollers.BaseChiefController)6 Controller (org.olat.core.gui.control.Controller)6 WindowControl (org.olat.core.gui.control.WindowControl)6 DTabs (org.olat.core.gui.control.generic.dtabs.DTabs)6 SiteInstance (org.olat.core.gui.control.navigation.SiteInstance)6 OLATResourceable (org.olat.core.id.OLATResourceable)6 HistoryPoint (org.olat.core.id.context.HistoryPoint)6 ResumeSessionController (org.olat.core.commons.controllers.resume.ResumeSessionController)4 Link (org.olat.core.gui.components.link.Link)4 ChiefController (org.olat.core.gui.control.ChiefController)4 VetoableCloseController (org.olat.core.gui.control.VetoableCloseController)4 BasicController (org.olat.core.gui.control.controller.BasicController)4 Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)4 BusinessControl (org.olat.core.id.context.BusinessControl)4 AssessmentModeGuardController (org.olat.course.assessment.ui.mode.AssessmentModeGuardController)4 UserToolsMenuController (org.olat.gui.control.UserToolsMenuController)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4