commit 538800b4f2368ffa91c458c26f59d08e2e7705d7
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Thu Jun 1 16:54:49 2017 +0200

    ref #6169 first implementation of delete operations

diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java
index 4662e142..683fb0ad 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferenceEditorPresenter.java
@@ -18,8 +18,7 @@ import org.vaadin.viritin.fields.CaptionGenerator;
 import org.vaadin.viritin.fields.LazyComboBox.FilterableCountProvider;
 import org.vaadin.viritin.fields.LazyComboBox.FilterablePagingProvider;
 
-import com.vaadin.ui.ListSelect;
-
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.pager.Pager;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
@@ -139,14 +138,22 @@ public class ReferenceEditorPresenter extends AbstractCdmEditorPresenter<Referen
        if(event.getPopup().equals(inReferencePopup)){
            if(event.getReason().equals(Reason.SAVE)){
                Reference bean = inReferencePopup.getBean();
-               // TODO update items from db instead of just adding the new item
-               ListSelect localInReferenceSelectSelect = getView().getInReferenceSelect().getSelect();
-               localInReferenceSelectSelect.addItem(bean);
-               localInReferenceSelectSelect.select(bean);
+               getView().getInReferenceCombobox().selectNewItem(bean);
+           }
+           if(event.getReason().equals(Reason.DELETE)){
+               getView().getInReferenceCombobox().selectNewItem(null);
            }
            inReferencePopup = null;
        }
 
    }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected DeleteResult executeServiceDeleteOperation(Reference bean) {
+        return getRepo().getReferenceService().delete(bean);
+    }
+
 }
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java
index 6db4aa28..e9015841 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditor.java
@@ -27,7 +27,6 @@ import eu.etaxonomy.cdm.vaadin.event.ReferenceEditorAction;
 import eu.etaxonomy.cdm.vaadin.security.AccessRestrictedView;
 import eu.etaxonomy.vaadin.component.SwitchableTextField;
 import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
-import eu.etaxonomy.vaadin.component.ToOneRelatedEntityListSelect;
 import eu.etaxonomy.vaadin.mvp.AbstractCdmPopupEditor;
 
 /**
@@ -47,8 +46,6 @@ public class ReferencePopupEditor extends AbstractCdmPopupEditor<Reference, Refe
 
     private ListSelect typeSelect;
 
-    private ToOneRelatedEntityListSelect<Reference> inReferenceSelect;
-
     private ToOneRelatedEntityCombobox<Reference> inReferenceCombobox;
 
     /**
@@ -119,31 +116,20 @@ public class ReferencePopupEditor extends AbstractCdmPopupEditor<Reference, Refe
         addTextField("Pages", "pages", 2, row);
         addTextField("Editor", "editor", 3, row).setWidth(100, Unit.PERCENTAGE);
         row++;
-        /*
-        inReferenceSelect = new ToOneRelatedEntityListSelect<Reference>("In-reference", Reference.class, new BeanItemContainer<>(Reference.class));
-        inReferenceSelect.setWidth(100, Unit.PERCENTAGE);
-        inReferenceSelect.getSelect().setRows(1);
-        inReferenceSelect.addClickListenerAddEntity(e -> getEventBus().publishEvent(
-                new ReferenceEditorAction(AbstractEditorAction.Action.ADD, null, inReferenceSelect, this)
-                ));
-        inReferenceSelect.addClickListenerEditEntity(e -> {
-            if(inReferenceSelect.getSelect().getValue() != null){
-                getEventBus().publishEvent(
-                    new ReferenceEditorAction(AbstractEditorAction.Action.EDIT, ((Reference)inReferenceSelect.getSelect().getValue()).getId(), inReferenceSelect, this)
-                );
-            }
-            });
-        addField(inReferenceSelect, "inReference", 0, row, 3, row);
-        */
+
         inReferenceCombobox = new ToOneRelatedEntityCombobox<Reference>("In-reference", Reference.class);
         inReferenceCombobox.setWidth(100, Unit.PERCENTAGE);
         inReferenceCombobox.addClickListenerAddEntity(e -> getEventBus().publishEvent(
-                new ReferenceEditorAction(AbstractEditorAction.Action.ADD, null, inReferenceSelect, this)
+                new ReferenceEditorAction(AbstractEditorAction.Action.ADD, null, inReferenceCombobox, this)
                 ));
         inReferenceCombobox.addClickListenerEditEntity(e -> {
             if(inReferenceCombobox.getSelect().getValue() != null){
                 getEventBus().publishEvent(
-                    new ReferenceEditorAction(AbstractEditorAction.Action.EDIT, ((Reference)inReferenceSelect.getSelect().getValue()).getId(), inReferenceSelect, this)
+                    new ReferenceEditorAction(
+                            AbstractEditorAction.Action.EDIT,
+                            inReferenceCombobox.getValue().getId(),
+                            inReferenceCombobox,
+                            this)
                 );
             }
             });
@@ -242,11 +228,6 @@ public class ReferencePopupEditor extends AbstractCdmPopupEditor<Reference, Refe
         return typeSelect;
     }
 
-    @Override
-    public ToOneRelatedEntityListSelect<Reference> getInReferenceSelect() {
-        return inReferenceSelect;
-    }
-
     /**
      * {@inheritDoc}
      */
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditorView.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditorView.java
index 7bfb2e5b..556399dc 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditorView.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/reference/ReferencePopupEditorView.java
@@ -12,7 +12,6 @@ import com.vaadin.ui.ListSelect;
 
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox;
-import eu.etaxonomy.vaadin.component.ToOneRelatedEntityListSelect;
 import eu.etaxonomy.vaadin.mvp.ApplicationView;
 
 /**
@@ -24,8 +23,6 @@ public interface ReferencePopupEditorView extends ApplicationView<ReferenceEdito
 
     public ListSelect getTypeSelect();
 
-    public ToOneRelatedEntityListSelect<Reference> getInReferenceSelect();
-
     public ToOneRelatedEntityCombobox<Reference> getInReferenceCombobox();
 
 
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java
index b330cbf4..87b21ee1 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/registration/RegistrationEditorPresenter.java
@@ -8,6 +8,7 @@
 */
 package eu.etaxonomy.cdm.vaadin.view.registration;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.model.name.Registration;
 import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
 
@@ -20,5 +21,13 @@ public class RegistrationEditorPresenter extends AbstractCdmEditorPresenter<Regi
 
     private static final long serialVersionUID = 6930557602995331944L;
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected DeleteResult executeServiceDeleteOperation(Registration bean) {
+        return getRepo().getRegistrationService().delete(bean);
+    }
+
 
 }
diff --git a/src/main/java/eu/etaxonomy/cdm/vaadin/view/taxon/TaxonNameEditorPresenter.java b/src/main/java/eu/etaxonomy/cdm/vaadin/view/taxon/TaxonNameEditorPresenter.java
index cb202741..bc0cb4b2 100644
--- a/src/main/java/eu/etaxonomy/cdm/vaadin/view/taxon/TaxonNameEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/cdm/vaadin/view/taxon/TaxonNameEditorPresenter.java
@@ -8,6 +8,8 @@
 */
 package eu.etaxonomy.cdm.vaadin.view.taxon;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
+import eu.etaxonomy.cdm.api.service.config.NameDeletionConfigurator;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
 
@@ -20,5 +22,14 @@ public class TaxonNameEditorPresenter extends AbstractCdmEditorPresenter<TaxonNa
 
     private static final long serialVersionUID = -3538980627079389221L;
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected DeleteResult executeServiceDeleteOperation(TaxonNameBase bean) {
+        NameDeletionConfigurator config = new NameDeletionConfigurator();
+        return getRepo().getNameService().delete(bean.getUuid(), config);
+    }
+
 
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityCombobox.java b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityCombobox.java
index b9776af1..4ddf0a09 100644
--- a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityCombobox.java
+++ b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityCombobox.java
@@ -25,7 +25,7 @@ import com.vaadin.ui.themes.ValoTheme;
  * @since May 24, 2017
  *
  */
-public class ToOneRelatedEntityCombobox<V extends Object> extends CompositeCustomField<V> implements ToOneRelatedEntityField {
+public class ToOneRelatedEntityCombobox<V extends Object> extends CompositeCustomField<V> implements ToOneRelatedEntityField<V> {
 
     private static final long serialVersionUID = 6277565876657520311L;
 
@@ -42,9 +42,14 @@ public class ToOneRelatedEntityCombobox<V extends Object> extends CompositeCusto
 
     public ToOneRelatedEntityCombobox(String caption, Class<V> type){
         this.type = type;
+        setCaption(caption);
         lazySelect = new LazyComboBox<V>(type);
         addStyledComponents(lazySelect, addButton, editButton);
         addSizedComponents(lazySelect, container);
+        lazySelect.addValueChangeListener(e -> {
+            // update the itemContainer immediately so that the edit button acts on the chosen item
+            lazySelect.commit();
+        });
     }
 
 
@@ -114,4 +119,11 @@ public class ToOneRelatedEntityCombobox<V extends Object> extends CompositeCusto
         editButton.addClickListener(listener);
     }
 
+    @Override
+    public void selectNewItem(V bean){
+        lazySelect.refresh();
+        lazySelect.setValue(bean);
+        lazySelect.markAsDirty();
+    }
+
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityField.java b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityField.java
index 90e02244..3ef823bd 100644
--- a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityField.java
+++ b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityField.java
@@ -15,7 +15,7 @@ import com.vaadin.ui.Button.ClickListener;
  * @since May 25, 2017
  *
  */
-public interface ToOneRelatedEntityField {
+public interface ToOneRelatedEntityField<V extends Object> {
 
     /**
      * Adds the click listener to the add-entity-button.
@@ -33,4 +33,6 @@ public interface ToOneRelatedEntityField {
      */
     public void addClickListenerEditEntity(ClickListener listener);
 
+    public void selectNewItem(V bean);
+
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityListSelect.java b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityListSelect.java
index 77618c25..b316b74a 100644
--- a/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityListSelect.java
+++ b/src/main/java/eu/etaxonomy/vaadin/component/ToOneRelatedEntityListSelect.java
@@ -24,7 +24,7 @@ import com.vaadin.ui.themes.ValoTheme;
  * @since May 24, 2017
  *
  */
-public class ToOneRelatedEntityListSelect<V extends Object> extends CompositeCustomField<V> implements ToOneRelatedEntityField {
+public class ToOneRelatedEntityListSelect<V extends Object> extends CompositeCustomField<V> implements ToOneRelatedEntityField<V> {
 
     private static final long serialVersionUID = 6277565876657520311L;
 
@@ -42,6 +42,7 @@ public class ToOneRelatedEntityListSelect<V extends Object> extends CompositeCus
 
     public ToOneRelatedEntityListSelect(String caption, Class<V> type, Container dataSource){
         this.type = type;
+        setCaption(caption);
         select = new ListSelect(caption, dataSource);
         addStyledComponents(select, addButton, editButton);
         addSizedComponent(select);
@@ -91,8 +92,6 @@ public class ToOneRelatedEntityListSelect<V extends Object> extends CompositeCus
         return select;
     }
 
-
-
     /**
      * {@inheritDoc}
      */
@@ -122,5 +121,15 @@ public class ToOneRelatedEntityListSelect<V extends Object> extends CompositeCus
         editButton.addClickListener(listener);
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void selectNewItem(V bean) {
+
+      select.addItem(bean);
+      select.select(bean);
+    }
+
 
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
index 56e302a8..4f84c7ca 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmEditorPresenter.java
@@ -14,11 +14,12 @@ import org.hibernate.engine.spi.SessionImplementor;
 import org.springframework.context.event.EventListener;
 import org.springframework.transaction.TransactionStatus;
 
-import com.vaadin.data.fieldgroup.BeanFieldGroup;
-import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent;
-import com.vaadin.data.util.BeanItem;
+import com.vaadin.ui.Notification;
+import com.vaadin.ui.UI;
 
+import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent;
 import eu.etaxonomy.cdm.vaadin.event.EntityChangeEvent.Type;
 import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
@@ -46,10 +47,23 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
 
     @Override
     @EventListener
-    public void onEditorPreSaveEvent(EditorPreSaveEvent preSaveEvent){
+    public void onEditorPreSaveEvent(EditorPreSaveEvent<DTO> preSaveEvent){
         if(!isFromOwnView(preSaveEvent)){
             return;
         }
+        startTransaction();
+        // merge the bean and update the fieldGroup with the merged bean, so that updating
+        // of field values in turn of the commit are can not cause LazyInitializationExeptions
+        // the bean still has the original values at this point
+        logger.trace(this._toString() + ".onEditorPreSaveEvent - merging bean into session");
+        mergedBean(preSaveEvent.getBean());
+
+    }
+
+    /**
+     *
+     */
+    protected void startTransaction() {
         if(tx != null){
             // @formatter:off
             // holding the TransactionStatus as state is not good design. we should change the save operation
@@ -64,12 +78,6 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
 
         logger.trace(this._toString() + ".onEditorPreSaveEvent - starting transaction");
         tx = getRepo().startTransaction(true);
-        // merge the bean and update the fieldGroup with the merged bean, so that updating
-        // of field values in turn of the commit are can not cause LazyInitializationExeptions
-        // the bean still has the original values at this point
-        logger.trace(this._toString() + ".onEditorPreSaveEvent - merging bean into session");
-        mergedBean(preSaveEvent.getCommitEvent());
-
     }
 
     @Override
@@ -81,7 +89,7 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
         // the bean is now updated with the changes made by the user
         // merge the bean into the session, ...
         logger.trace(this._toString() + ".onEditorSaveEvent - merging bean into session");
-        DTO bean = mergedBean(saveEvent.getCommitEvent());
+        DTO bean = mergedBean((DTO) saveEvent.getBean());
 
         Type changeEventType;
         if(bean.getId() > 1){
@@ -106,12 +114,9 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
      * @param CommitEvent
      * @return The bean merged to the session or original bean in case a merge was not necessary.
      */
-    private DTO mergedBean(CommitEvent commitEvent) {
+    private DTO mergedBean(DTO bean) {
         // using just some service to get hold of the session
         Session session = getSession();
-        @SuppressWarnings("unchecked")
-        BeanItem<DTO> itemDataSource = ((BeanFieldGroup<DTO>)commitEvent.getFieldBinder()).getItemDataSource();
-        DTO bean = itemDataSource.getBean();
         if(session.contains(bean)){
 
             if(session.isOpen()){
@@ -123,7 +128,7 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
             @SuppressWarnings("unchecked")
             DTO mergedBean = (DTO) session.merge(bean);
             logger.trace(this._toString() + ".mergedBean() - bean after merge " + bean.toString());
-            itemDataSource.setBean(mergedBean);
+            ((AbstractPopupEditor<DTO, AbstractCdmEditorPresenter<DTO, V>>)getView()).showInEditor(mergedBean);
             return mergedBean;
         }
         return bean;
@@ -144,6 +149,63 @@ public abstract class AbstractCdmEditorPresenter<DTO extends CdmBase, V extends
         // blank implementation, since this is not needed in this or any sub class
     }
 
+    @Override
+    protected final void deleteBean(DTO bean){
+        startTransaction();
+        logger.trace(this._toString() + ".deleteBean - deleting" + bean.toString());
+        DeleteResult result = executeServiceDeleteOperation(bean);
+        if(result.isOk()){
+            getSession().flush();
+            logger.trace(this._toString() + ".deleteBean - session flushed");
+            getRepo().commitTransaction(tx);
+            tx = null;
+            logger.trace(this._toString() + ".deleteBean - transaction comitted");
+            eventBus.publishEvent(new EntityChangeEvent(bean.getClass(), bean.getId(), Type.REMOVED));
+        } else {
+            String notificationTitle;
+            StringBuffer messageBody = new StringBuffer();
+            if(result.isAbort()){
+                notificationTitle = "The delete operation as abborded by the system.";
+            } else {
+                notificationTitle = "An error occured during the delete operation.";
+            }
+            if(!result.getExceptions().isEmpty()){
+                messageBody.append("<h3>").append("Exceptions:").append("</h3>").append("<ul>");
+                result.getExceptions().forEach(e -> messageBody.append("<li>").append(e.getMessage()).append("</li>"));
+                messageBody.append("</ul>");
+            }
+            if(!result.getRelatedObjects().isEmpty()){
+                messageBody.append("<h3>").append("Related objects exist:").append("</h3>").append("<ul>");
+                result.getRelatedObjects().forEach(e -> {
+                    messageBody.append("<li>");
+                    if(IdentifiableEntity.class.isAssignableFrom(e.getClass())){
+                        messageBody.append(((IdentifiableEntity)e).getTitleCache());
+                    } else {
+                        messageBody.append(e.toString());
+                    }
+                    messageBody.append("</li>");
+                }
+                );
+
+                messageBody.append("</ul>");
+            }
+
+            Notification notification = new Notification(
+                   notificationTitle,
+                   messageBody.toString(),
+                   com.vaadin.ui.Notification.Type.ERROR_MESSAGE,
+                   true);
+            notification.show(UI.getCurrent().getPage());
+        }
+    }
+
+    /**
+     * Implementations will execute the {@link
+     *
+     * @return
+     */
+    protected abstract DeleteResult executeServiceDeleteOperation(DTO bean);
+
     private String _toString(){
         return this.getClass().getSimpleName() + "@" + this.hashCode();
     }
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
index 1524c766..ad6b264c 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractEditorPresenter.java
@@ -12,9 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.ApplicationEventPublisher;
 import org.springframework.context.event.EventListener;
 
-import com.vaadin.data.fieldgroup.BeanFieldGroup;
-
 import eu.etaxonomy.cdm.vaadin.event.AbstractEditorAction;
+import eu.etaxonomy.vaadin.mvp.event.EditorDeleteEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorViewEvent;
@@ -33,7 +32,7 @@ public abstract class AbstractEditorPresenter<DTO extends Object, V extends Appl
     protected ApplicationEventPublisher eventBus;
 
     @EventListener
-    public void onEditorPreSaveEvent(EditorPreSaveEvent preSaveEvent){
+    public void onEditorPreSaveEvent(EditorPreSaveEvent<DTO> preSaveEvent){
         if(!isFromOwnView(preSaveEvent)){
             return;
         }
@@ -44,14 +43,27 @@ public abstract class AbstractEditorPresenter<DTO extends Object, V extends Appl
      * @param saveEvent
      */
     @EventListener
-    public void onEditorSaveEvent(EditorSaveEvent saveEvent){
+    public void onEditorSaveEvent(EditorSaveEvent<DTO> saveEvent){
         if(!isFromOwnView(saveEvent)){
             return;
         }
-        DTO bean = ((BeanFieldGroup<DTO>)saveEvent.getCommitEvent().getFieldBinder()).getItemDataSource().getBean();
+        DTO bean = saveEvent.getBean();
         saveBean(bean);
     }
 
+    // EditorDeleteEvent
+    /**
+    *
+    * @param saveEvent
+    */
+   @EventListener
+   public void onEditorDeleteEvent(EditorDeleteEvent<DTO> deleteEvent){
+       if(!isFromOwnView(deleteEvent)){
+           return;
+       }
+       deleteBean(deleteEvent.getBean());
+   }
+
     /**
      * @param saveEvent
      * @return
@@ -70,4 +82,9 @@ public abstract class AbstractEditorPresenter<DTO extends Object, V extends Appl
 
     protected abstract void saveBean(DTO bean);
 
+    /**
+     * @param bean
+     */
+    protected abstract void deleteBean(DTO bean);
+
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
index 6491ff08..50239588 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
@@ -46,6 +46,7 @@ import com.vaadin.ui.themes.ValoTheme;
 import eu.etaxonomy.cdm.database.PermissionDeniedException;
 import eu.etaxonomy.vaadin.component.NestedFieldGroup;
 import eu.etaxonomy.vaadin.component.SwitchableTextField;
+import eu.etaxonomy.vaadin.mvp.event.EditorDeleteEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorPreSaveEvent;
 import eu.etaxonomy.vaadin.mvp.event.EditorSaveEvent;
 import eu.etaxonomy.vaadin.ui.view.DoneWithPopupEvent;
@@ -71,6 +72,8 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
 
     private Button cancel;
 
+    private Button delete;
+
     private CssLayout toolBar = new CssLayout();
 
     private CssLayout toolBarButtonGroup = new CssLayout();
@@ -114,8 +117,13 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         cancel = new Button("Cancel", FontAwesome.TRASH);
         cancel.addClickListener(e -> cancel());
 
-        buttonLayout.addComponents(save, cancel);
-        buttonLayout.setExpandRatio(save, 1);
+        delete = new Button("Delete", FontAwesome.REMOVE);
+        delete.setStyleName(ValoTheme.BUTTON_DANGER);
+        delete.addClickListener(e -> delete());
+
+        buttonLayout.addComponents(delete, save, cancel);
+        buttonLayout.setExpandRatio(delete, 1);
+        buttonLayout.setComponentAlignment(delete, Alignment.TOP_RIGHT);
         buttonLayout.setComponentAlignment(save, Alignment.TOP_RIGHT);
         buttonLayout.setComponentAlignment(cancel, Alignment.TOP_RIGHT);
 
@@ -216,14 +224,14 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         public void preCommit(CommitEvent commitEvent) throws CommitException {
             logger.debug("preCommit");
             // notify the presenter to start a transaction
-            eventBus.publishEvent(new EditorPreSaveEvent(commitEvent, AbstractPopupEditor.this));
+            eventBus.publishEvent(new EditorPreSaveEvent<DTO>(AbstractPopupEditor.this, fieldGroup.getItemDataSource().getBean()));
         }
 
         @Override
         public void postCommit(CommitEvent commitEvent) throws CommitException {
             try {
                 // notify the presenter to persist the bean and to commit the transaction
-                eventBus.publishEvent(new EditorSaveEvent(commitEvent, AbstractPopupEditor.this));
+                eventBus.publishEvent(new EditorSaveEvent<DTO>(AbstractPopupEditor.this, fieldGroup.getItemDataSource().getBean()));
 
                 // notify the NavigationManagerBean to close the window and to dispose the view
                 eventBus.publishEvent(new DoneWithPopupEvent(AbstractPopupEditor.this, Reason.SAVE));
@@ -247,6 +255,14 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         eventBus.publishEvent(new DoneWithPopupEvent(this, Reason.CANCEL));
     }
 
+    /**
+     * @return
+     */
+    private void delete() {
+        eventBus.publishEvent(new EditorDeleteEvent(this, fieldGroup.getItemDataSource().getBean()));
+        eventBus.publishEvent(new DoneWithPopupEvent(this, Reason.DELETE));
+    }
+
     /**
      * Save the changes made in the editor.
      */
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorBeanEvent.java b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorBeanEvent.java
new file mode 100644
index 00000000..42c8a1c8
--- /dev/null
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorBeanEvent.java
@@ -0,0 +1,20 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.vaadin.mvp.event;
+
+/**
+ * @author a.kohlbecker
+ * @since Jun 1, 2017
+ *
+ */
+public interface EditorBeanEvent<DTO extends Object> {
+
+    public DTO getBean();
+
+}
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorDeleteEvent.java b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorDeleteEvent.java
new file mode 100644
index 00000000..2059e03a
--- /dev/null
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorDeleteEvent.java
@@ -0,0 +1,46 @@
+/**
+* Copyright (C) 2017 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.vaadin.mvp.event;
+
+import eu.etaxonomy.vaadin.mvp.AbstractView;
+
+/**
+ * @author a.kohlbecker
+ * @since Jun 1, 2017
+ *
+ */
+public class EditorDeleteEvent<DTO extends Object> implements EditorViewEvent, EditorBeanEvent<DTO> {
+
+    // FIXME this is only a iterim solution for the problem described in https://dev.e-taxonomy.eu/redmine/issues/6562
+    private AbstractView<?> view;
+
+    private DTO bean;
+
+    public EditorDeleteEvent(AbstractView<?> view, DTO bean){
+        this.view = view;
+        this.bean = bean;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public AbstractView<?> getView() {
+        return view;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DTO getBean() {
+        return bean;
+    }
+
+}
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorPreSaveEvent.java b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorPreSaveEvent.java
index 77fd2fcc..396c8880 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorPreSaveEvent.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorPreSaveEvent.java
@@ -8,8 +8,6 @@
 */
 package eu.etaxonomy.vaadin.mvp.event;
 
-import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent;
-
 import eu.etaxonomy.vaadin.mvp.AbstractView;
 
 /**
@@ -20,31 +18,37 @@ import eu.etaxonomy.vaadin.mvp.AbstractView;
  * @since Apr 5, 2017
  *
  */
-public class EditorPreSaveEvent implements EditorViewEvent{
-
-    private CommitEvent commitEvent;
+public class EditorPreSaveEvent<DTO extends Object> implements EditorViewEvent, EditorBeanEvent<DTO>{
 
     // FIXME this is only a iterim solution for the problem described in https://dev.e-taxonomy.eu/redmine/issues/6562
-    private AbstractView view;
+    private AbstractView<?> view;
+
+    private DTO bean;
 
     /**
      * @param commitEvent
      */
-    public EditorPreSaveEvent(CommitEvent commitEvent, AbstractView view) {
-        this.commitEvent = commitEvent;
+    public EditorPreSaveEvent(AbstractView<?> view, DTO bean) {
+        this.bean = bean;
         this.view = view;
     }
 
-    public CommitEvent getCommitEvent(){
-        return commitEvent;
-    }
 
     /**
      * @return the view
      */
     @Override
-    public AbstractView getView() {
+    public AbstractView<?> getView() {
         return view;
     }
 
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DTO getBean() {
+        return bean;
+    }
+
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorSaveEvent.java b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorSaveEvent.java
index 61cee18e..05739453 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorSaveEvent.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorSaveEvent.java
@@ -8,8 +8,6 @@
 */
 package eu.etaxonomy.vaadin.mvp.event;
 
-import com.vaadin.data.fieldgroup.FieldGroup.CommitEvent;
-
 import eu.etaxonomy.vaadin.mvp.AbstractView;
 
 /**
@@ -20,32 +18,34 @@ import eu.etaxonomy.vaadin.mvp.AbstractView;
  * @since Apr 5, 2017
  *
  */
-public class EditorSaveEvent implements EditorViewEvent {
-
-    private CommitEvent commitEvent;
+public class EditorSaveEvent<DTO extends Object> implements EditorViewEvent, EditorBeanEvent<DTO> {
 
     // FIXME this is only a iterim solution for the problem described in https://dev.e-taxonomy.eu/redmine/issues/6562
-    private AbstractView view;
+    private AbstractView<?> view;
+
 
+    private DTO bean;
 
     /**
-     * @param commitEvent
      */
-    public EditorSaveEvent(CommitEvent commitEvent, AbstractView view) {
-        this.commitEvent = commitEvent;
+    public EditorSaveEvent(AbstractView<?> view, DTO bean) {
+        this.bean = bean;
         this.view = view;
     }
 
-    public CommitEvent getCommitEvent(){
-        return commitEvent;
-    }
-
     /**
      * @return the view
      */
     @Override
-    public AbstractView getView() {
+    public AbstractView<?> getView() {
         return view;
     }
 
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public DTO getBean() {
+        return bean;
+    }
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorViewEvent.java b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorViewEvent.java
index 7142d7d4..f0696eb7 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorViewEvent.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/event/EditorViewEvent.java
@@ -17,6 +17,6 @@ import eu.etaxonomy.vaadin.mvp.AbstractView;
  */
 public interface EditorViewEvent {
 
-    public AbstractView getView();
+    public AbstractView<?> getView();
 
 }
diff --git a/src/main/java/eu/etaxonomy/vaadin/ui/view/DoneWithPopupEvent.java b/src/main/java/eu/etaxonomy/vaadin/ui/view/DoneWithPopupEvent.java
index d5a4c471..e3e0a755 100644
--- a/src/main/java/eu/etaxonomy/vaadin/ui/view/DoneWithPopupEvent.java
+++ b/src/main/java/eu/etaxonomy/vaadin/ui/view/DoneWithPopupEvent.java
@@ -3,7 +3,7 @@ package eu.etaxonomy.vaadin.ui.view;
 public class DoneWithPopupEvent {
 
 	public enum Reason {
-		CANCEL, SAVE;
+		CANCEL, SAVE, DELETE;
 	}
 
 	private final Reason reason;
