From a5eecfa4f802061110b9941237b65f8a84ba3edd Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Tue, 31 Mar 2009 09:10:43 +0000 Subject: Merged fix for #2747: Wrapping link-style Button text inside Table breaks the height calculation of Table http://dev.itmill.com/ticket/2747 svn changeset:7243/svn branch:6.0 --- .../terminal/gwt/client/ui/IScrollTable.java | 23 +++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/com/itmill/toolkit/terminal/gwt') 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 7470662828..bd832749fa 100644 --- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java +++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java @@ -574,7 +574,8 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { boolean verticalScrollbarVisible = (pageLength < totalRows); if (verticalScrollbarVisible) { - // There will be a vertical scrollbar and its width is not included in availW + // There will be a vertical scrollbar and its width is not included + // in availW availW -= Util.getNativeScrollbarSize(); } @@ -651,8 +652,17 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { * 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"); + if (pageLength == totalRows) { + /* + * We want to show all rows so the bodyHeight should be equal to + * the table height + */ + int bodyHeight = tBody.getTableHeight(); + bodyContainer.setHeight(bodyHeight + "px"); + } else { + int bodyHeight = (tBody.getRowHeight(true) * pageLength); + bodyContainer.setHeight(bodyHeight + "px"); + } } isNewBody = false; @@ -1935,8 +1945,7 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { return rowHeight; } else { if (DOM.getChildCount(tBody) > 0) { - rowHeight = tBody.getParentElement().getOffsetHeight() - / DOM.getChildCount(tBody); + rowHeight = getTableHeight() / DOM.getChildCount(tBody); } else { return DEFAULT_ROW_HEIGHT; } @@ -1945,6 +1954,10 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener { } } + public int getTableHeight() { + return table.getOffsetHeight(); + } + public int getColWidth(int i) { if (initDone) { final Element e = DOM.getChild(DOM.getChild(tBody, 0), i); -- cgit v1.2.3