documenting
[cdm-vaadin.git] / src / main / java / eu / etaxonomy / vaadin / mvp / AbstractEditorPresenter.java
index 61730af0625785a21ab61976271e39ad461f21fc..ff5f6d9b9764edc03b0acd39798c10c012961696 100644 (file)
@@ -18,6 +18,11 @@ import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
 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
@@ -50,27 +55,29 @@ public abstract class AbstractEditorPresenter<DTO extends Object, V extends Appl
 
     @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);
    }
 
     /**