Search in sources :

Example 16 with DTab

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);
    }
}
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 17 with DTab

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);
        }
    }
}
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)

Example 18 with DTab

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

Example 19 with DTab

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);
                    }
                }
            }
        }
    }
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) StateEntry(org.olat.core.id.context.StateEntry) BornSiteInstance(org.olat.core.gui.control.navigation.BornSiteInstance) SiteInstance(org.olat.core.gui.control.navigation.SiteInstance) Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) OLATResourceable(org.olat.core.id.OLATResourceable) StateSite(org.olat.core.id.context.StateSite) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 20 with DTab

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();
        }
    }
}
Also used : DTab(org.olat.core.gui.control.generic.dtabs.DTab) MessageController(org.olat.core.gui.control.generic.messages.MessageController) OLATResourceable(org.olat.core.id.OLATResourceable) DTabs(org.olat.core.gui.control.generic.dtabs.DTabs) BusinessControl(org.olat.core.id.context.BusinessControl) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint)

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