From 4b8dd4897d5be355f6808a3687139fc400bacb8e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Risto=20Yrj=C3=A4n=C3=A4?= Date: Mon, 2 Feb 2009 11:28:01 +0000 Subject: [PATCH] Fixed dimension calculations and a bug with hideOnMouseOut svn changeset:6703/svn branch:trunk --- .../themes/default/popupview/popupview.css | 1 - WebContent/ITMILL/themes/default/styles.css | 1 - .../terminal/gwt/client/ui/IPopupView.java | 34 ++++++++++++++++--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/WebContent/ITMILL/themes/default/popupview/popupview.css b/WebContent/ITMILL/themes/default/popupview/popupview.css index 1a00d0d4ba..60e47503ae 100644 --- a/WebContent/ITMILL/themes/default/popupview/popupview.css +++ b/WebContent/ITMILL/themes/default/popupview/popupview.css @@ -4,7 +4,6 @@ background: #fff; overflow: auto; padding: 3px; - margin: 3px; } .i-popupview { diff --git a/WebContent/ITMILL/themes/default/styles.css b/WebContent/ITMILL/themes/default/styles.css index 1dd4971cb9..e84d50e61b 100644 --- a/WebContent/ITMILL/themes/default/styles.css +++ b/WebContent/ITMILL/themes/default/styles.css @@ -1203,7 +1203,6 @@ input.i-modified, background: #fff; overflow: auto; padding: 3px; - margin: 3px; } .i-popupview { diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java index 8b7d108386..efca0e114d 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java @@ -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; } -- 2.39.5