diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-03-20 15:41:45 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-03-20 15:41:45 +0000 |
commit | 37362aa752f7edd7c2b37706090ebcd791230ad1 (patch) | |
tree | 48373e1a1136b46bd1066f7748d3f3cb16219d76 /src/com/itmill/toolkit/terminal | |
parent | 9b549761439c275fb5949833d97da289315e36c3 (diff) | |
download | vaadin-framework-37362aa752f7edd7c2b37706090ebcd791230ad1.tar.gz vaadin-framework-37362aa752f7edd7c2b37706090ebcd791230ad1.zip |
Merged fix for #2747 - table height calculation issue
svn changeset:7122/svn branch:6.0
Diffstat (limited to 'src/com/itmill/toolkit/terminal')
-rw-r--r-- | src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java | 34 |
1 files changed, 23 insertions, 11 deletions
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) { |