Search in sources :

Example 36 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class BinderListController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (newBinderDropdown == source) {
        doNewBinderCallout(ureq);
    } else if (newBinderFromCourseButton == source) {
        doNewBinderFromCourse(ureq);
    } else if (tableEl == source) {
        if (event instanceof SelectionEvent) {
            SelectionEvent se = (SelectionEvent) event;
            String cmd = se.getCommand();
            if ("select".equals(cmd)) {
                BinderRow row = model.getObject(se.getIndex());
                Activateable2 activateable = doOpenBinder(ureq, row);
                if (activateable != null) {
                    activateable.activate(ureq, null, null);
                }
            }
        }
    } else if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if ("open".equals(cmd)) {
            BinderRow row = (BinderRow) link.getUserObject();
            Activateable2 activateable = doOpenBinder(ureq, row);
            if (activateable != null) {
                activateable.activate(ureq, null, null);
            }
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BinderRow(org.olat.modules.portfolio.ui.model.BinderRow) SelectionEvent(org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 37 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class BinderListController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty())
        return;
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Binder".equalsIgnoreCase(resName)) {
        Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
        Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
        if (activateable != null) {
            List<ContextEntry> subEntries = entries.subList(1, entries.size());
            activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) BinderRefImpl(org.olat.modules.portfolio.model.BinderRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 38 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class TableOfContentController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (entries == null || entries.isEmpty()) {
        return;
    }
    String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
    if ("Page".equalsIgnoreCase(resName) || "Entry".equalsIgnoreCase(resName)) {
        Long pageKey = entries.get(0).getOLATResourceable().getResourceableId();
        Page page = portfolioService.getPageByKey(pageKey);
        if (page != null && page.getSection() != null && binder.equals(page.getSection().getBinder())) {
            Activateable2 activateable = doOpenPage(ureq, page);
            if (activateable != null) {
                List<ContextEntry> subEntries = entries.subList(1, entries.size());
                activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
            }
        }
    } else if ("Section".equalsIgnoreCase(resName)) {
        Long sectionKey = entries.get(0).getOLATResourceable().getResourceableId();
        Section section = portfolioService.getSection(new SectionRefImpl(sectionKey));
        if (section != null && binder.equals(section.getBinder())) {
            doOpenSection(ureq, section);
        }
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) Page(org.olat.modules.portfolio.Page) AssessmentSection(org.olat.modules.portfolio.AssessmentSection) Section(org.olat.modules.portfolio.Section) SectionRefImpl(org.olat.modules.portfolio.model.SectionRefImpl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 39 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method activate.

/**
 * Activating a tab is like focusing a new window - we need to adjust the
 * guipath since e.g. the button triggering the activation is not
 * part of the guipath, but rather the new tab in its initial state.
 * in all other cases the "focus of interest" (where the calculation of the
 * guipath is started) matches the controller which listens to the
 * event caused by a user interaction.
 * this is the starting point.
 */
@Override
public void activate(UserRequest ureq, DTab dTab, List<ContextEntry> entries) {
    UserSession usess = ureq.getUserSession();
    if ((lockStatus != null || usess.isInAssessmentModeProcess()) && !usess.matchLockResource(dTab.getOLATResourceable())) {
        return;
    }
    // update window settings if needed
    setWindowSettings(getWindowControl().getWindowBackOffice().getWindowSettings());
    // jump here via external link or just open a new tab from e.g. repository
    if (dTab == null && contentCtrl instanceof Activateable2) {
        ((Activateable2) contentCtrl).activate(ureq, entries, null);
    } else {
        DTabImpl dtabi = (DTabImpl) dTab;
        Controller c = dtabi.getController();
        if (c == null) {
            throw new AssertException("no controller set yet! " + dTab);
        }
        doActivateDTab(dtabi);
        if (c instanceof Activateable2) {
            final Activateable2 activateable = ((Activateable2) c);
            activateable.activate(ureq, entries, null);
        }
        updateBusinessPath(ureq, dtabi);
        // update the panels after activation
        setGuiStack(dtabi.getGuiStackHandle());
    }
}
Also used : Activateable2(org.olat.core.gui.control.generic.dtabs.Activateable2) AssertException(org.olat.core.logging.AssertException) UserSession(org.olat.core.util.UserSession) DTabImpl(org.olat.core.gui.control.generic.dtabs.DTabImpl) 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 40 with Activateable2

use of org.olat.core.gui.control.generic.dtabs.Activateable2 in project OpenOLAT by OpenOLAT.

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)

Aggregations

Activateable2 (org.olat.core.gui.control.generic.dtabs.Activateable2)78 ContextEntry (org.olat.core.id.context.ContextEntry)44 Controller (org.olat.core.gui.control.Controller)28 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)22 TreeNode (org.olat.core.gui.components.tree.TreeNode)16 WindowControl (org.olat.core.gui.control.WindowControl)16 BasicController (org.olat.core.gui.control.controller.BasicController)14 CourseNode (org.olat.course.nodes.CourseNode)12 CollaborationTools (org.olat.collaboration.CollaborationTools)10 SelectionEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent)10 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)10 AssessableCourseNode (org.olat.course.nodes.AssessableCourseNode)10 GTACourseNode (org.olat.course.nodes.GTACourseNode)10 FlexiTableSearchEvent (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableSearchEvent)8 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)8 FormLink (org.olat.core.gui.components.form.flexible.elements.FormLink)6 ChiefController (org.olat.core.gui.control.ChiefController)6 VetoableCloseController (org.olat.core.gui.control.VetoableCloseController)6 BornSiteInstance (org.olat.core.gui.control.navigation.BornSiteInstance)6 OLATResourceable (org.olat.core.id.OLATResourceable)5