diff options
author | John Alhroos <john.ahlroos@itmill.com> | 2011-08-19 11:29:53 +0000 |
---|---|---|
committer | John Alhroos <john.ahlroos@itmill.com> | 2011-08-19 11:29:53 +0000 |
commit | 5c52721648f617bc26f6353255abb351dbc591e5 (patch) | |
tree | 0f9c3f65e0ca6b6c2cfa6ec1bb49a264e068e62a | |
parent | 12bb89d64b3ba975701600aefdcec06dc4530086 (diff) | |
download | vaadin-framework-5c52721648f617bc26f6353255abb351dbc591e5.tar.gz vaadin-framework-5c52721648f617bc26f6353255abb351dbc591e5.zip |
Fixes pageLength=0 in TreeTable #7292
svn changeset:20506/svn branch:6.7
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java | 20 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java | 22 |
2 files changed, 27 insertions, 15 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index f0db3e55b2..a96ad3cb4e 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -884,7 +884,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, updateBody(rowData, uidl.getIntAttribute("firstrow"), uidl.getIntAttribute("rows")); if (headerChangedDuringUpdate) { - lazyAdjustColumnWidths.schedule(1); + triggerLazyColumnAdjustment(true); } else { // webkits may still bug with their disturbing scrollbar // bug, see #3457 @@ -1075,7 +1075,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } } - private void updatePageLength(UIDL uidl) { + protected void updatePageLength(UIDL uidl) { int oldPageLength = pageLength; if (uidl.hasAttribute("pagelength")) { pageLength = uidl.getIntAttribute("pagelength"); @@ -3030,7 +3030,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } else { tHead.removeCell(colKey); collapsedColumns.add(colKey); - lazyAdjustColumnWidths.schedule(1); + triggerLazyColumnAdjustment(true); } // update variable to server @@ -5488,8 +5488,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, setContentWidth(innerPixels); // readjust undefined width columns - lazyAdjustColumnWidths.cancel(); - lazyAdjustColumnWidths.schedule(LAZY_COLUMN_ADJUST_TIMEOUT); + triggerLazyColumnAdjustment(false); } else { // Undefined width @@ -5499,8 +5498,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, sizeInit(); // readjust undefined width columns - lazyAdjustColumnWidths.cancel(); - lazyAdjustColumnWidths.schedule(LAZY_COLUMN_ADJUST_TIMEOUT); + triggerLazyColumnAdjustment(false); } /* @@ -6607,4 +6605,12 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, return function(){ return false; }; }-*/; + protected void triggerLazyColumnAdjustment(boolean now) { + lazyAdjustColumnWidths.cancel(); + if (now) { + lazyAdjustColumnWidths.run(); + } else { + lazyAdjustColumnWidths.schedule(LAZY_COLUMN_ADJUST_TIMEOUT); + } + } } diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java b/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java index b21a5dfdce..aa2ebed23d 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VTreeTable.java @@ -26,7 +26,6 @@ import com.vaadin.terminal.gwt.client.BrowserInfo; import com.vaadin.terminal.gwt.client.ComputedStyle; import com.vaadin.terminal.gwt.client.RenderSpace; import com.vaadin.terminal.gwt.client.UIDL; -import com.vaadin.terminal.gwt.client.VConsole; import com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow; import com.vaadin.terminal.gwt.client.ui.VTreeTable.VTreeTableScrollBody.VTreeTableRow; @@ -64,10 +63,21 @@ public class VTreeTable extends VScrollTable { int scrollPosition2 = widget.getScrollPosition(); if (scrollPosition != scrollPosition2) { - VConsole.log("TT scrollpos from " + scrollPosition + " to " - + scrollPosition2); widget.setScrollPosition(scrollPosition); } + + /* + * Triggers row calculations, removes cached rows etc. Basically + * cleans up state. Be careful if touching this, you will brake + * pageLength=0 if you remove this. + */ + onScroll(null); + + /* + * Ensure that possibly removed/added scrollbars are considered. + */ + triggerLazyColumnAdjustment(true); + collapseRequest = false; } if (uidl.hasAttribute("focusedRow")) { @@ -765,10 +775,6 @@ public class VTreeTable extends VScrollTable { // Make sure that initializedAndAttached & al are not reset when the // totalrows are updated on expand/collapse requests. int newTotalRows = uidl.getIntAttribute("totalrows"); - if (collapseRequest) { - setTotalRows(newTotalRows); - } else { - super.setTotalRows(newTotalRows); - } + setTotalRows(newTotalRows); } } |