@Override public void apply() { controller.getView().setEnabled(true); controller.getView().getToolbarView().setDisplayMode(ViewMode.EDIT); getViewModel().getCurrentRealizer().saveToMemento(); }
@Override public ControllerState view(Data data) { Person realizer = (Person) data; assert realizer.getType().equals(IRealizersService.PERSON_TYPE) : "The person must of type Actor"; if (Managers.getManager(IViewManager.class) .askI18nUserForConfirmation( "realizer.dialogs.confirmSave", "realizer.dialogs.confirmSave.title")) { controller.save(); } else { getViewModel().getCurrentRealizer().restoreMemento(); } getViewModel().setCurrentRealizer(realizer); return controller.getViewState(); }
@Override public ControllerState save(FormBean bean) { IPersonFormBean infos = (IPersonFormBean) bean; String oldTitle = getViewModel().getCurrentRealizer().getDisplayableText(); Person realizer = getViewModel().getCurrentRealizer(); infos.fillPerson(realizer); realizersService.save(getViewModel().getCurrentRealizer()); if (!oldTitle.equals(getViewModel().getCurrentRealizer().getDisplayableText())) { controller.getView().resort(); controller.getView().select(getViewModel().getCurrentRealizer()); } return controller.getViewState(); }
@Override public ControllerState cancel() { getViewModel().getCurrentRealizer().restoreMemento(); return controller.getViewState(); }
/** * Return the model of the view. * * @return The model of the view. */ private IRealizersModel getViewModel() { return controller.getViewModel(); }