summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Alhroos <john.ahlroos@itmill.com>2011-09-29 07:42:32 +0000
committerJohn Alhroos <john.ahlroos@itmill.com>2011-09-29 07:42:32 +0000
commit635412e18f410d6d536cbb063dd8e4bb650eb92d (patch)
treec9e46347bdd7b80a2c748ee9ae87740dda2d9bdf
parent9941b36313558c41ef794b9ce9b6a8b4f5feeea0 (diff)
downloadvaadin-framework-635412e18f410d6d536cbb063dd8e4bb650eb92d.tar.gz
vaadin-framework-635412e18f410d6d536cbb063dd8e4bb650eb92d.zip
Fix for #6494
svn changeset:21428/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 5596a1fdfb..ce586cbcc5 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -5601,20 +5601,37 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
return;
}
- this.width = width;
if (width != null && !"".equals(width)) {
super.setWidth(width);
- int innerPixels = getOffsetWidth() - getBorderWidth();
+ int innerPixels = Util.getRequiredWidth(this) - getBorderWidth();
if (innerPixels < 0) {
- innerPixels = 0;
+ /*
+ * If innerPixels becomes negative it means that something has
+ * gone wrong with the width calculations (most likely a timing
+ * issue where offsetWidth is returning 0). Setting innerPixels
+ * to 0 here and hope for the best will cause issues like #6494.
+ * Instead we defer the width setting so we know that the
+ * offsetwidth return a sane value
+ */
+ final String deferredWidth = width;
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ public void execute() {
+ setWidth(deferredWidth);
+ }
+ });
+ return;
}
+
+ this.width = width;
setContentWidth(innerPixels);
// readjust undefined width columns
triggerLazyColumnAdjustment(false);
} else {
+
// Undefined width
+ this.width = width;
super.setWidth("");
// Readjust size of table
@@ -5777,6 +5794,9 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
* @param pixels
*/
private void setContentWidth(int pixels) {
+ if (pixels == 0) {
+ VConsole.error("Setting width " + pixels + "px");
+ }
tHead.setWidth(pixels + "px");
scrollBodyPanel.setWidth(pixels + "px");
tFoot.setWidth(pixels + "px");