From 37362aa752f7edd7c2b37706090ebcd791230ad1 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 20 Mar 2009 15:41:45 +0000 Subject: Merged fix for #2747 - table height calculation issue svn changeset:7122/svn branch:6.0 --- .../terminal/gwt/client/ui/IScrollTable.java | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src/com/itmill/toolkit/terminal') diff --git a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java index 91623c29fb..7470662828 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java @@ -560,16 +560,6 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { tHead.disableBrowserIntelligence(); - // fix "natural" height if height not set - if (height == null || "".equals(height)) { - /* - * We must force an update of the row height as this point as it - * might have been (incorrectly) calculated earlier - */ - bodyContainer.setHeight((tBody.getRowHeight(true) * pageLength) - + "px"); - } - // fix "natural" width if width not set if (width == null || "".equals(width)) { int w = total; @@ -581,6 +571,13 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { // Hey IE, are you really sure about this? availW = tBody.getAvailableWidth(); + boolean verticalScrollbarVisible = (pageLength < totalRows); + + if (verticalScrollbarVisible) { + // There will be a vertical scrollbar and its width is not included in availW + availW -= Util.getNativeScrollbarSize(); + } + boolean needsReLayout = false; if (availW > total) { @@ -596,7 +593,9 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { */ int scrollbarWidth = getScrollbarWidth(); scrollbarWidth = Util.getNativeScrollbarSize(); - if (relativeWidth && totalWidthR >= scrollbarWidth) { + if (!verticalScrollbarVisible && relativeWidth + && totalWidthR >= scrollbarWidth) { + scrollbarWidthReserved = scrollbarWidth + 1; // int columnindex = tHead.getVisibleCellCount() - 1; widths[columnindex] += scrollbarWidthReserved; @@ -643,6 +642,19 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { tBody.reLayoutComponents(); } + /* + * Fix "natural" height if height is not set. This must be after width + * fixing so the components' widths have been adjusted. + */ + if (height == null || "".equals(height)) { + /* + * We must force an update of the row height as this point as it + * might have been (incorrectly) calculated earlier + */ + int bodyHeight = (tBody.getRowHeight(true) * pageLength); + bodyContainer.setHeight(bodyHeight + "px"); + } + isNewBody = false; if (firstvisible > 0) { -- cgit v1.2.3