private void doAddSolution(UserRequest ureq) { addSolutionCtrl = new EditSolutionController(ureq, getWindowControl(), solutionDir, solutionContainer); listenTo(addSolutionCtrl); String title = translate("add.solution"); cmc = new CloseableModalController( getWindowControl(), null, addSolutionCtrl.getInitialComponent(), true, title, false); listenTo(cmc); cmc.activate(); }
@Override protected void event(UserRequest ureq, Controller source, Event event) { if (addSolutionCtrl == source) { if (event == Event.DONE_EVENT) { Solution newSolution = addSolutionCtrl.getSolution(); solutions.getSolutions().add(newSolution); fireEvent(ureq, Event.DONE_EVENT); updateModel(); } cmc.deactivate(); cleanUp(); } else if (editSolutionCtrl == source) { if (event == Event.DONE_EVENT) { fireEvent(ureq, Event.DONE_EVENT); updateModel(); } cmc.deactivate(); cleanUp(); } else if (newSolutionCtrl == source) { Solution newSolution = newSolutionCtrl.getSolution(); cmc.deactivate(); cleanUp(); if (event == Event.DONE_EVENT) { solutions.getSolutions().add(newSolution); doCreateSolutionEditor(ureq, newSolution); updateModel(); } } else if (newSolutionEditorCtrl == source) { if (event == Event.DONE_EVENT) { updateModel(); fireEvent(ureq, Event.DONE_EVENT); } cmc.deactivate(); cleanUp(); } else if (editSolutionEditorCtrl == source) { cmc.deactivate(); cleanUp(); } else if (cmc == source) { cleanUp(); } super.event(ureq, source, event); }