diff options
author | Leif Åstrand <leif@vaadin.com> | 2012-04-03 15:53:56 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2012-04-03 15:53:56 +0300 |
commit | 3cdd918f35d7923576699c524d0f964b08913e4f (patch) | |
tree | fb2b37fb7478d2c9bf62a6e7ed89e2a5d71f1332 /src | |
parent | 07cae6ec40a3967248cd57fa2833949c05735c8d (diff) | |
download | vaadin-framework-3cdd918f35d7923576699c524d0f964b08913e4f.tar.gz vaadin-framework-3cdd918f35d7923576699c524d0f964b08913e4f.zip |
Make AbsoluteLayout report relative child sizes to LayoutManager
Diffstat (limited to 'src')
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java b/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java index f0942066f2..e2d92d99e6 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java +++ b/src/com/vaadin/terminal/gwt/client/ui/AbsoluteLayoutConnector.java @@ -121,6 +121,11 @@ public class AbsoluteLayoutConnector extends - wrapper.getElement().getOffsetTop(); } wrapperStyle.setHeight(h, Unit.PX); + float percentSize = parsePercent(paintable.getState() + .getHeight()); + int effectiveHeight = Math.round(h * (percentSize / 100)); + getLayoutManager() + .reportOuterHeight(paintable, effectiveHeight); } else { wrapperStyle.clearHeight(); } @@ -129,6 +134,10 @@ public class AbsoluteLayoutConnector extends } } + private static float parsePercent(String size) { + return Float.parseFloat(size.substring(0, size.length() - 1)); + } + public void layoutHorizontally() { VAbsoluteLayout layout = getWidget(); for (ComponentConnector paintable : getChildren()) { @@ -153,6 +162,10 @@ public class AbsoluteLayoutConnector extends - wrapper.getElement().getOffsetLeft(); } wrapperStyle.setWidth(w, Unit.PX); + float percentSize = parsePercent(paintable.getState() + .getWidth()); + int effectiveWidth = Math.round(w * (percentSize / 100)); + getLayoutManager().reportOuterWidth(paintable, effectiveWidth); } else { wrapperStyle.clearWidth(); } |