fix #6843 avoiding oversized windows by setting a defined height
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Fri, 21 Jul 2017 18:48:54 +0000 (20:48 +0200)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Fri, 21 Jul 2017 18:48:54 +0000 (20:48 +0200)
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractCdmPopupEditor.java
src/main/java/eu/etaxonomy/vaadin/mvp/AbstractPopupEditor.java
src/main/java/eu/etaxonomy/vaadin/ui/navigation/NavigationManagerBean.java

index 77ff02cc64e53f0fb160b0116a536985b33a634f..04b2d617ce3e49576307b15cad5311d17a7ca984 100644 (file)
@@ -48,10 +48,6 @@ public abstract class AbstractCdmPopupEditor<DTO extends CdmBase, P extends Abst
      */
     public AbstractCdmPopupEditor(Layout layout, Class<DTO> dtoType) {
         super(layout, dtoType);
-        // IMPORTANT: the layout must be set to full size otherwise the
-        // popup window may have problems with automatic resizing of its
-        // content.
-        layout.setSizeFull();
         if(MarginHandler.class.isAssignableFrom(getFieldLayout().getClass())){
             ((MarginHandler)getFieldLayout()).setMargin(new MarginInfo(false, true, true, true));
         }
index fe6e725522a23c4b75d5f8b3e97cd098c890852e..6e0c453b344b2e17031e931eb88ca2a4dd9c875c 100644 (file)
@@ -87,19 +87,16 @@ public abstract class AbstractPopupEditor<DTO extends Object, P extends Abstract
 
     public AbstractPopupEditor(Layout layout, Class<DTO> dtoType) {
 
-        setWidthUndefined();
-
         mainLayout = new VerticalLayout();
         // IMPORTANT: mainLayout must be set to full size otherwise the
         // popup window may have problems with automatic resizing of its
         // content.
         mainLayout.setSizeFull();
+        setCompositionRoot(mainLayout);
 
         fieldGroup = new BeanFieldGroup<>(dtoType);
         fieldGroup.addCommitHandler(new SaveHandler());
 
-        setCompositionRoot(mainLayout);
-
         toolBar.addStyleName(ValoTheme.WINDOW_TOP_TOOLBAR);
         toolBar.setWidth(100, Unit.PERCENTAGE);
         toolBarButtonGroup.addStyleName(ValoTheme.LAYOUT_COMPONENT_GROUP);
index 5490e02c9387b2380f5d8582c2494839f7fdc7e2..ae5490c8af50a39c150b1aed6211da540fa1e204 100644 (file)
@@ -130,6 +130,12 @@ public class NavigationManagerBean extends SpringNavigator implements Navigation
                window.setModal(true);
                window.setCaptionAsHtml(popupView.isWindowCaptionAsHtml());
                window.setWidth(popupView.getWindowPixelWidth(), Unit.PIXELS);
+               // setting 100% as default height. If the height
+               // would be undefined the window, will fit the size of
+               // the content and will sometimes exceed the height of the
+               // main window and will not get a scroll bar in this situation.
+               // see #6843
+               window.setHeight("100%");
                window.setContent(popupView.asComponent());
                // window.addCloseListener(e -> popupView.cancel());
                UI.getCurrent().addWindow(window);