Search in sources :

Example 1 with VetoableCloseController

use of org.olat.core.gui.control.VetoableCloseController 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 2 with VetoableCloseController

use of org.olat.core.gui.control.VetoableCloseController in project OpenOLAT by OpenOLAT.

the class BreadcrumbedStackedPanel method dispatchEvent.

@Override
public void dispatchEvent(UserRequest ureq, Component source, Event event) {
    boolean closeEvent = source.equals(closeLink);
    boolean backEvent = source.equals(backLink);
    if (backEvent || closeEvent) {
        if (stack.size() > 1) {
            // back means to one level down, change source to the stack item one below current
            source = stack.get(stack.size() - 2);
        // now continue as if user manually pressed a stack item in the list
        } else {
            // notify listeners that back or link beyond breadcrumb has been called
            fireEvent(ureq, Event.CLOSE_EVENT);
        }
    }
    if (stack.contains(source)) {
        Controller controllerToPop = getControllerToPop(source);
        // part of a hack for QTI editor
        if (controllerToPop instanceof VetoableCloseController && !((VetoableCloseController) controllerToPop).requestForClose(ureq)) {
            // not my problem anymore, I have done what I can
            fireEvent(ureq, new VetoPopEvent());
            return;
        }
        BreadCrumb popedCrumb = popController(source);
        if (popedCrumb != null) {
            Controller last = getLastController();
            if (last != null) {
                addToHistory(ureq, last);
            }
            if (popedCrumb.getController() != null) {
                fireEvent(ureq, new PopEvent(popedCrumb.getController(), popedCrumb.getUserObject(), closeEvent));
            } else if (popedCrumb.getUserObject() != null) {
                fireEvent(ureq, new PopEvent(popedCrumb.getUserObject(), closeEvent));
            }
        } else if (stack.indexOf(source) == 0) {
            fireEvent(ureq, new RootEvent());
        }
    }
}
Also used : VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) Controller(org.olat.core.gui.control.Controller)

Example 3 with VetoableCloseController

use of org.olat.core.gui.control.VetoableCloseController 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 4 with VetoableCloseController

use of org.olat.core.gui.control.VetoableCloseController in project openolat by klemens.

the class BreadcrumbedStackedPanel method dispatchEvent.

@Override
public void dispatchEvent(UserRequest ureq, Component source, Event event) {
    boolean closeEvent = source.equals(closeLink);
    boolean backEvent = source.equals(backLink);
    if (backEvent || closeEvent) {
        if (stack.size() > 1) {
            // back means to one level down, change source to the stack item one below current
            source = stack.get(stack.size() - 2);
        // now continue as if user manually pressed a stack item in the list
        } else {
            // notify listeners that back or link beyond breadcrumb has been called
            fireEvent(ureq, Event.CLOSE_EVENT);
        }
    }
    if (stack.contains(source)) {
        Controller controllerToPop = getControllerToPop(source);
        // part of a hack for QTI editor
        if (controllerToPop instanceof VetoableCloseController && !((VetoableCloseController) controllerToPop).requestForClose(ureq)) {
            // not my problem anymore, I have done what I can
            fireEvent(ureq, new VetoPopEvent());
            return;
        }
        BreadCrumb popedCrumb = popController(source);
        if (popedCrumb != null) {
            Controller last = getLastController();
            if (last != null) {
                addToHistory(ureq, last);
            }
            if (popedCrumb.getController() != null) {
                fireEvent(ureq, new PopEvent(popedCrumb.getController(), popedCrumb.getUserObject(), closeEvent));
            } else if (popedCrumb.getUserObject() != null) {
                fireEvent(ureq, new PopEvent(popedCrumb.getUserObject(), closeEvent));
            }
        } else if (stack.indexOf(source) == 0) {
            fireEvent(ureq, new RootEvent());
        }
    }
}
Also used : VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) VetoableCloseController(org.olat.core.gui.control.VetoableCloseController) Controller(org.olat.core.gui.control.Controller)

Aggregations

Controller (org.olat.core.gui.control.Controller)4 VetoableCloseController (org.olat.core.gui.control.VetoableCloseController)4 BaseChiefController (org.olat.core.commons.chiefcontrollers.BaseChiefController)2 ResumeSessionController (org.olat.core.commons.controllers.resume.ResumeSessionController)2 ChiefController (org.olat.core.gui.control.ChiefController)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 DTab (org.olat.core.gui.control.generic.dtabs.DTab)2 AssessmentModeGuardController (org.olat.course.assessment.ui.mode.AssessmentModeGuardController)2 UserToolsMenuController (org.olat.gui.control.UserToolsMenuController)2