summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2009-04-23 21:02:21 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2009-04-23 21:02:21 +0000
commitafdcec2164e0ab73d125427373bed6e12b4ea47a (patch)
tree9a5d19a207098735cd77f26544bc333e4df61380
parent25c279f2c112a2aa010e6c04d57373c700af634d (diff)
downloadvaadin-framework-afdcec2164e0ab73d125427373bed6e12b4ea47a.tar.gz
vaadin-framework-afdcec2164e0ab73d125427373bed6e12b4ea47a.zip
fixed minor regression with undefined width tables with height defined. Added sanity check when destroying row (fixes #2862, regression).
svn changeset:7517/svn branch:6.0
-rw-r--r--src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java44
1 files changed, 31 insertions, 13 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 9b8766c68c..2f88424374 100644
--- a/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
+++ b/src/com/itmill/toolkit/terminal/gwt/client/ui/IScrollTable.java
@@ -578,11 +578,27 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
tHead.disableBrowserIntelligence();
+ boolean willHaveScrollbarz = false;
+ if (!(height != null && !height.equals(""))) {
+ if (pageLength < totalRows) {
+ willHaveScrollbarz = true;
+ }
+ } else {
+ int fakeheight = tBody.getRowHeight() * totalRows;
+ int availableHeight = bodyContainer.getElement().getPropertyInt(
+ "clientHeight");
+ if (fakeheight > availableHeight) {
+ willHaveScrollbarz = true;
+ }
+ }
+
// fix "natural" width if width not set
if (width == null || "".equals(width)) {
int w = total;
w += tBody.getCellExtraWidth() * visibleColOrder.length;
- w += getScrollbarWidth();
+ if (willHaveScrollbarz) {
+ w += Util.getNativeScrollbarSize();
+ }
setContentWidth(w);
}
@@ -591,10 +607,8 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
availW = tBody.getAvailableWidth();
availW -= tBody.getCellExtraWidth() * visibleColOrder.length;
- if (!(height != null && !height.equals(""))) {
- if (pageLength < totalRows) {
- availW -= Util.getNativeScrollbarSize();
- }
+ if (willHaveScrollbarz) {
+ availW -= Util.getNativeScrollbarSize();
}
boolean needsReLayout = false;
@@ -2000,14 +2014,18 @@ public class IScrollTable extends FlowPanel implements Table, ScrollListener {
index = renderedRows.size() - 1;
lastRendered--;
}
- final IScrollTableRow toBeRemoved = (IScrollTableRow) renderedRows
- .get(index);
- lazyUnregistryBag.add(toBeRemoved);
- tBodyElement.removeChild(toBeRemoved.getElement());
- orphan(toBeRemoved);
- renderedRows.remove(index);
- fixSpacers();
- return true;
+ if (index >= 0) {
+ final IScrollTableRow toBeRemoved = (IScrollTableRow) renderedRows
+ .get(index);
+ lazyUnregistryBag.add(toBeRemoved);
+ tBodyElement.removeChild(toBeRemoved.getElement());
+ orphan(toBeRemoved);
+ renderedRows.remove(index);
+ fixSpacers();
+ return true;
+ } else {
+ return false;
+ }
}
@Override