]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixed dimension calculations and a bug with hideOnMouseOut
authorRisto Yrjänä <risto.yrjana@itmill.com>
Mon, 2 Feb 2009 11:28:01 +0000 (11:28 +0000)
committerRisto Yrjänä <risto.yrjana@itmill.com>
Mon, 2 Feb 2009 11:28:01 +0000 (11:28 +0000)
svn changeset:6703/svn branch:trunk

WebContent/ITMILL/themes/default/popupview/popupview.css
WebContent/ITMILL/themes/default/styles.css
src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java

index 1a00d0d4ba2a5396f6b0e2420936cf14cd31510b..60e47503ae41f662601c69805e9a4592bb8f6817 100644 (file)
@@ -4,7 +4,6 @@
        background: #fff;
        overflow: auto;
        padding: 3px;
-       margin: 3px;
 }
 
 .i-popupview {
index 1dd4971cb995c262028b4ec6ea8ce752794c28e2..e84d50e61b81eb07eb1cb2eee6f234a888d29617 100644 (file)
@@ -1203,7 +1203,6 @@ input.i-modified,
        background: #fff;
        overflow: auto;
        padding: 3px;
-       margin: 3px;
 }
 
 .i-popupview {
index 8b7d108386a31d8158c0e2f32e8a2b1582a9078a..efca0e114d1a334eedaf01e256149a9ff9118c10 100644 (file)
@@ -21,6 +21,8 @@ import com.itmill.toolkit.terminal.gwt.client.ICaptionWrapper;
 import com.itmill.toolkit.terminal.gwt.client.Paintable;
 import com.itmill.toolkit.terminal.gwt.client.RenderSpace;
 import com.itmill.toolkit.terminal.gwt.client.UIDL;
+import com.itmill.toolkit.terminal.gwt.client.Util;
+import com.itmill.toolkit.terminal.gwt.client.RenderInformation.Size;
 
 public class IPopupView extends HTML implements Container {
 
@@ -221,7 +223,7 @@ public class IPopupView extends HTML implements Container {
         }
 
         @Override
-        public void hide() {
+        public void hide(boolean autoClosed) {
             hiding = true;
             syncChildren();
             unregisterPaintables();
@@ -229,7 +231,7 @@ public class IPopupView extends HTML implements Container {
                 remove(popupComponentWidget);
             }
             hasHadMouseOver = false;
-            super.hide();
+            super.hide(autoClosed);
         }
 
         @Override
@@ -321,13 +323,36 @@ public class IPopupView extends HTML implements Container {
             hiding = false;
         }
 
+        public Element getContainerElement() {
+            return super.getContainerElement();
+        }
+
     }// class CustomPopup
 
     // Container methods
 
     public RenderSpace getAllocatedSpace(Widget child) {
-        return new RenderSpace(RootPanel.get().getOffsetWidth(), RootPanel
-                .get().getOffsetHeight());
+        Size popupExtra = calculatePopupExtra();
+
+        return new RenderSpace(RootPanel.get().getOffsetWidth()
+                - popupExtra.getWidth(), RootPanel.get().getOffsetHeight()
+                - popupExtra.getHeight());
+    }
+
+    /**
+     * Calculate extra space taken by the popup decorations
+     * 
+     * @return
+     */
+    protected Size calculatePopupExtra() {
+        Element pe = popup.getElement();
+        Element ipe = popup.getContainerElement();
+
+        // border + padding
+        int width = Util.getRequiredWidth(pe) - Util.getRequiredWidth(ipe);
+        int height = Util.getRequiredHeight(pe) - Util.getRequiredHeight(ipe);
+
+        return new Size(width, height);
     }
 
     public boolean hasChildComponent(Widget component) {
@@ -339,7 +364,6 @@ public class IPopupView extends HTML implements Container {
     }
 
     public void replaceChildComponent(Widget oldComponent, Widget newComponent) {
-
         popup.setWidget(newComponent);
         popup.popupComponentWidget = newComponent;
     }