Search in sources :

Example 1 with ErrorEditMessage

use of org.olat.modules.fo.ui.events.ErrorEditMessage in project openolat by klemens.

the class MessageListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == exportCtrl) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            if (event == Event.CHANGED_EVENT) {
                StepsRunContext runContext = exportCtrl.getRunContext();
                Message originTopMessage = (Message) runContext.get(SendMailStepForm.START_THREADTOP);
                originTopMessage = forumManager.loadMessage(originTopMessage.getKey());
                if (originTopMessage != null) {
                    // refresh origin thread
                    fireEvent(ureq, new SelectMessageEvent(SelectMessageEvent.SELECT_THREAD, originTopMessage.getKey()));
                } else {
                    fireEvent(ureq, Event.BACK_EVENT);
                }
            }
            getWindowControl().pop();
            removeAsListenerAndDispose(exportCtrl);
            exportCtrl = null;
        }
    } else if (source == confirmDeleteCtrl) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView deletedMessage = (MessageView) confirmDeleteCtrl.getUserObject();
            doDeleteMessage(ureq, deletedMessage);
        }
    } else if (editMessageCtrl == source) {
        // edit done -> save
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message message = editMessageCtrl.getMessage();
            if (message != null) {
                if (thread != null && thread.getKey().equals(message.getKey())) {
                    thread = message;
                }
                reloadModel(ureq, message);
            } else {
                showInfo("header.cannoteditmessage");
            }
        }
        cmc.deactivate();
    } else if (replyMessageCtrl == source) {
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message reply = replyMessageCtrl.getMessage();
            if (reply != null) {
                reloadModel(ureq, reply);
            } else {
                showInfo("header.cannotsavemessage");
            }
        }
        cmc.deactivate();
    } else if (messageTableCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doSelectTheOne(ureq, sme.getMessageKey());
        }
    } else if (moveCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doFinalizeMove(ureq, moveCtrl.getSelectView(), sme.getMessageKey());
            cmc.deactivate();
        }
    } else if (confirmSplitCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView splitedMessage = (MessageView) confirmSplitCtrl.getUserObject();
            doSplitThread(ureq, splitedMessage);
        }
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) SelectMessageEvent(org.olat.modules.fo.ui.events.SelectMessageEvent) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext)

Example 2 with ErrorEditMessage

use of org.olat.modules.fo.ui.events.ErrorEditMessage in project OpenOLAT by OpenOLAT.

the class MessageListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == exportCtrl) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            if (event == Event.CHANGED_EVENT) {
                StepsRunContext runContext = exportCtrl.getRunContext();
                Message originTopMessage = (Message) runContext.get(SendMailStepForm.START_THREADTOP);
                originTopMessage = forumManager.loadMessage(originTopMessage.getKey());
                if (originTopMessage != null) {
                    // refresh origin thread
                    fireEvent(ureq, new SelectMessageEvent(SelectMessageEvent.SELECT_THREAD, originTopMessage.getKey()));
                } else {
                    fireEvent(ureq, Event.BACK_EVENT);
                }
            }
            getWindowControl().pop();
            removeAsListenerAndDispose(exportCtrl);
            exportCtrl = null;
        }
    } else if (source == confirmDeleteCtrl) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView deletedMessage = (MessageView) confirmDeleteCtrl.getUserObject();
            doDeleteMessage(ureq, deletedMessage);
        }
    } else if (editMessageCtrl == source) {
        // edit done -> save
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message message = editMessageCtrl.getMessage();
            if (message != null) {
                if (thread != null && thread.getKey().equals(message.getKey())) {
                    thread = message;
                }
                reloadModel(ureq, message);
            } else {
                showInfo("header.cannoteditmessage");
            }
        }
        cmc.deactivate();
    } else if (replyMessageCtrl == source) {
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message reply = replyMessageCtrl.getMessage();
            if (reply != null) {
                reloadModel(ureq, reply);
            } else {
                showInfo("header.cannotsavemessage");
            }
        }
        cmc.deactivate();
    } else if (messageTableCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doSelectTheOne(ureq, sme.getMessageKey());
        }
    } else if (moveCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doFinalizeMove(ureq, moveCtrl.getSelectView(), sme.getMessageKey());
            cmc.deactivate();
        }
    } else if (confirmSplitCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView splitedMessage = (MessageView) confirmSplitCtrl.getUserObject();
            doSplitThread(ureq, splitedMessage);
        }
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) SelectMessageEvent(org.olat.modules.fo.ui.events.SelectMessageEvent) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext)

Aggregations

StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)2 Message (org.olat.modules.fo.Message)2 ErrorEditMessage (org.olat.modules.fo.ui.events.ErrorEditMessage)2 SelectMessageEvent (org.olat.modules.fo.ui.events.SelectMessageEvent)2