commit fcf1cf0623ea8dd2cb97e43ba79254ef0f24181a
Author: Andreas Kohlbecker <a.kohlbecker@bgbm.org>
Date:   Mon Apr 23 13:50:07 2018 +0200

    pulling functionality from AbstractCdmPopupEditor up into AbstractPopupEditor

diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java
index 0854ef10..668528c8 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java
@@ -8,18 +8,9 @@
 */
 package eu.etaxonomy.vaadin.mvp;
 
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.EnumSet;
-import java.util.List;
 
-import com.vaadin.server.FontAwesome;
-import com.vaadin.shared.ui.MarginInfo;
-import com.vaadin.ui.Button;
-import com.vaadin.ui.Component;
 import com.vaadin.ui.Layout;
-import com.vaadin.ui.Layout.MarginHandler;
-import com.vaadin.ui.themes.ValoTheme;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
@@ -33,65 +24,15 @@ import eu.etaxonomy.cdm.vaadin.view.PerEntityAuthorityGrantingEditor;
 public abstract class AbstractCdmPopupEditor<DTO extends CdmBase, P extends AbstractCdmEditorPresenter<DTO, ? extends ApplicationView>>
     extends AbstractPopupEditor<DTO, P> implements PerEntityAuthorityGrantingEditor {
 
-    private static final long serialVersionUID = -5025937489746256070L;
-
-    private boolean isAdvancedMode = false;
-
-    private List<Component> advancedModeComponents = new ArrayList<>();
-
-    private Button advancedModeButton;
-
     /**
-     * The supplied layout will be set to full size, to avoid problems with
-     * automatic resizing of the inner content.
-     *
-     *
      * @param layout
      * @param dtoType
      */
     public AbstractCdmPopupEditor(Layout layout, Class<DTO> dtoType) {
         super(layout, dtoType);
-        if(MarginHandler.class.isAssignableFrom(getFieldLayout().getClass())){
-            ((MarginHandler)getFieldLayout()).setMargin(new MarginInfo(false, true, true, true));
-        }
-    }
-
-    /**
-     * @return the isAdvancedMode
-     */
-    public boolean isAdvancedMode() {
-        return isAdvancedMode;
-    }
-
-    /**
-     * @param isAdvancedMode the isAdvancedMode to set
-     */
-    public void setAdvancedMode(boolean isAdvancedMode) {
-        this.isAdvancedMode = isAdvancedMode;
-        advancedModeComponents.forEach(c -> c.setVisible(isAdvancedMode));
-    }
-
-    public void setAdvancedModeEnabled(boolean activate){
-        if(activate && advancedModeButton == null){
-            advancedModeButton = new Button(FontAwesome.WRENCH); // FontAwesome.FLASK
-            advancedModeButton.setIconAlternateText("Advanced mode");
-            advancedModeButton.addStyleName(ValoTheme.BUTTON_TINY);
-            toolBarButtonGroupAdd(advancedModeButton);
-            advancedModeButton.addClickListener(e -> {
-                setAdvancedMode(!isAdvancedMode);
-                }
-            );
-
-        } else if(advancedModeButton != null) {
-            toolBarButtonGroupRemove(advancedModeButton);
-            advancedModeButton = null;
-        }
-    }
-
-    public void registerAdvancedModeComponents(Component ... c){
-        advancedModeComponents.addAll(Arrays.asList(c));
     }
 
+    private static final long serialVersionUID = -5025937489746256070L;
 
     @Override
     public void grantToCurrentUser(EnumSet<CRUD> crud){
diff --git a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
index eff6a8ce..49238334 100644
--- a/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
+++ b/src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
@@ -8,6 +8,9 @@
 */
 package eu.etaxonomy.vaadin.mvp;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 import java.util.Stack;
 
@@ -40,6 +43,7 @@ import com.vaadin.ui.GridLayout.OutOfBoundsException;
 import com.vaadin.ui.GridLayout.OverlapsException;
 import com.vaadin.ui.HorizontalLayout;
 import com.vaadin.ui.Layout;
+import com.vaadin.ui.Layout.MarginHandler;
 import com.vaadin.ui.Notification;
 import com.vaadin.ui.Notification.Type;
 import com.vaadin.ui.PopupDateField;
@@ -98,6 +102,12 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
 
     private boolean isContextUpdated;
 
+    private boolean isAdvancedMode = false;
+
+    private List<Component> advancedModeComponents = new ArrayList<>();
+
+    private Button advancedModeButton;
+
     public AbstractPopupEditor(Layout layout, Class<DTO> dtoType) {
 
         mainLayout = new VerticalLayout();
@@ -105,6 +115,7 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         // popup window may have problems with automatic resizing of its
         // content.
         mainLayout.setSizeFull();
+
         setCompositionRoot(mainLayout);
 
         fieldGroup = new BeanFieldGroup<>(dtoType);
@@ -122,6 +133,9 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         if(fieldLayout instanceof AbstractOrderedLayout){
             ((AbstractOrderedLayout)fieldLayout).setSpacing(true);
         }
+        if(MarginHandler.class.isAssignableFrom(fieldLayout.getClass())){
+            ((MarginHandler)fieldLayout).setMargin(new MarginInfo(false, true, true, true));
+        }
 
         buttonLayout = new HorizontalLayout();
         buttonLayout.setStyleName(ValoTheme.WINDOW_BOTTOM_TOOLBAR);
@@ -255,6 +269,41 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
         toolBar.setVisible(true);
     }
 
+    /**
+     * @return the isAdvancedMode
+     */
+    public boolean isAdvancedMode() {
+        return isAdvancedMode;
+    }
+
+    /**
+     * @param isAdvancedMode the isAdvancedMode to set
+     */
+    public void setAdvancedMode(boolean isAdvancedMode) {
+        this.isAdvancedMode = isAdvancedMode;
+        advancedModeComponents.forEach(c -> c.setVisible(isAdvancedMode));
+    }
+
+    public void setAdvancedModeEnabled(boolean activate){
+        if(activate && advancedModeButton == null){
+            advancedModeButton = new Button(FontAwesome.WRENCH); // FontAwesome.FLASK
+            advancedModeButton.setIconAlternateText("Advanced mode");
+            advancedModeButton.addStyleName(ValoTheme.BUTTON_TINY);
+            toolBarButtonGroupAdd(advancedModeButton);
+            advancedModeButton.addClickListener(e -> {
+                setAdvancedMode(!isAdvancedMode);
+                }
+            );
+
+        } else if(advancedModeButton != null) {
+            toolBarButtonGroupRemove(advancedModeButton);
+            advancedModeButton = null;
+        }
+    }
+
+    public void registerAdvancedModeComponents(Component ... c){
+        advancedModeComponents.addAll(Arrays.asList(c));
+    }
 
 
     // ------------------------ event handler ------------------------ //
