import eu.etaxonomy.vaadin.mvp.event.EditorViewEvent;
/**
+ * Presenters of this type are usually be used in conjunction with a {@link AbstractPopupEditor}.
+ * The presenter automatically handles save and delete operations. The methods {@link #saveBean(Object)} and
+ * {@link AbstractEditorPresenter#deleteBean(Object)} are executed internally in turn of an
+ * {@link EditorSaveEvent} or {@link EditorDeleteEvent} which are send by the {@link AbstractPopupEditor#save()}
+ * or {@link AbstractPopupEditor#delete()} method.
*
* @author a.kohlbecker
* @since Apr 5, 2017
@EventBusListenerMethod
public void onEditorPreSaveEvent(EditorPreSaveEvent<DTO> preSaveEvent){
+ if(!isFromOwnView(preSaveEvent)){
+ return;
+ }
}
@EventBusListenerMethod
public void onEditorSaveEvent(EditorSaveEvent<DTO> saveEvent){
-
+ if(!isFromOwnView(saveEvent)){
+ return;
+ }
DTO bean = saveEvent.getBean();
saveBean(bean);
}
/**
- * Regarding changing the Flush mode see see also {@link ViewScopeConversationHolder}
- *
* @param saveEvent
*/
@EventBusListenerMethod
public void onEditorDeleteEvent(EditorDeleteEvent<DTO> deleteEvent){
-
- FlushMode previousFlushMode = getSession().getFlushMode();
- getSession().setFlushMode(FlushMode.AUTO);
+ if(!isFromOwnView(deleteEvent)){
+ return;
+ }
deleteBean(deleteEvent.getBean());
- getSession().setFlushMode(previousFlushMode);
}
/**