@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); }
private void doDelete(UserRequest ureq, SolutionRow solution) { String documentName = solution.getSolution().getFilename(); VFSItem item = solutionContainer.resolve(documentName); if (item != null) { item.delete(); } solutions.getSolutions().remove(solution.getSolution()); fireEvent(ureq, Event.DONE_EVENT); updateModel(); }
private void updateModel() { List<Solution> solutionList = solutions.getSolutions(); List<SolutionRow> rows = new ArrayList<>(solutionList.size()); for (Solution solution : solutionList) { String filename = solution.getFilename(); String author = null; VFSItem item = solutionContainer.resolve(filename); if (item instanceof MetaTagged) { MetaInfo metaInfo = ((MetaTagged) item).getMetaInfo(); if (metaInfo != null && metaInfo.getAuthorIdentityKey() != null) { author = userManager.getUserDisplayName(metaInfo.getAuthorIdentityKey()); } } rows.add(new SolutionRow(solution, author)); } solutionModel.setObjects(rows); solutionTable.reset(); }