From ae843b6612af88f9a4aa18b17cef79ef064b4cfb Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 21 Oct 2008 12:14:59 +0000 Subject: [PATCH] Fixed Panel border detection svn changeset:5684/svn branch:trunk --- .../terminal/gwt/client/ui/IPanel.java | 37 ++++++++----------- 1 file changed, 15 insertions(+), 22 deletions(-) diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java index 546d481ec5..7302724899 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IPanel.java @@ -453,32 +453,19 @@ public class IPanel extends SimplePanel implements Container, // TODO } - private RenderSpace contentNodeSize; - public RenderSpace getAllocatedSpace(Widget child) { - if (contentNodeSize == null) { - contentNodeSize = new RenderSpace(-1, -1) { - - @Override - public int getHeight() { - return contentNode.getOffsetHeight() - - getContainerBorderHeight(); - } + int w = 0; + int h = 0; - @Override - public int getWidth() { - return contentNode.getOffsetWidth() - - getContainerBorderWidth(); - } - - @Override - public int getScrollbarSize() { - return Util.getNativeScrollbarSize(); - } + if (width != null && !width.equals("")) { + w = getOffsetWidth() - getContainerBorderWidth(); + } - }; + if (height != null && !height.equals("")) { + w = getOffsetHeight() - getContainerBorderHeight(); } - return contentNodeSize; + + return new RenderSpace(w, h); } public boolean requestLayout(Set child) { @@ -497,4 +484,10 @@ public class IPanel extends SimplePanel implements Container, // NOP: layouts caption, errors etc not rendered in Panel } + @Override + protected void onAttach() { + super.onAttach(); + detectContainerBorders(); + } + } -- 2.39.5