diff options
author | Risto Yrjänä <risto.yrjana@itmill.com> | 2009-02-02 11:28:01 +0000 |
---|---|---|
committer | Risto Yrjänä <risto.yrjana@itmill.com> | 2009-02-02 11:28:01 +0000 |
commit | 4b8dd4897d5be355f6808a3687139fc400bacb8e (patch) | |
tree | 952005ada24a179e458545b5767084379a75f583 /src | |
parent | fcc83423484a5679251819809ce373bc9261c443 (diff) | |
download | vaadin-framework-4b8dd4897d5be355f6808a3687139fc400bacb8e.tar.gz vaadin-framework-4b8dd4897d5be355f6808a3687139fc400bacb8e.zip |
Fixed dimension calculations and a bug with hideOnMouseOut
svn changeset:6703/svn branch:trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ui/IPopupView.java | 34 |
1 files changed, 29 insertions, 5 deletions
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; } |