summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-20 09:52:26 +0000
committerJonatan Kronqvist <jonatan.kronqvist@itmill.com>2011-09-20 09:52:26 +0000
commitbffa5bfe21b4aaecb8be6a621f08ba9a61bde6ba (patch)
tree440fbfee2169927aa366d9bfbafc3a400f75e86f
parent77d38f8206e05830e986cf5210d11487ae195619 (diff)
downloadvaadin-framework-bffa5bfe21b4aaecb8be6a621f08ba9a61bde6ba.tar.gz
vaadin-framework-bffa5bfe21b4aaecb8be6a621f08ba9a61bde6ba.zip
Added possibility to support variable height rows in a subclass of VScrollTable (#7358)
svn changeset:21177/svn branch:6.7
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index 1ac3cb2393..20b0f0133f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -1090,11 +1090,15 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
// received 'surprising' firstvisible from server: scroll there
firstRowInViewPort = firstvisible;
- scrollBodyPanel.setScrollPosition((int) (firstvisible * scrollBody
- .getRowHeight()));
+ scrollBodyPanel
+ .setScrollPosition(measureScrollPositionOfRow(firstvisible));
}
}
+ protected int measureScrollPositionOfRow(int rowIx) {
+ return (int) (rowIx * scrollBody.getRowHeight());
+ }
+
private void updatePageLength(UIDL uidl) {
int oldPageLength = pageLength;
if (uidl.hasAttribute("pagelength")) {
@@ -1926,8 +1930,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
scrollBodyPanel
- .setScrollPosition((int) (firstvisible * scrollBody
- .getRowHeight()));
+ .setScrollPosition(measureScrollPositionOfRow(firstvisible));
firstRowInViewPort = firstvisible;
}
});
@@ -5864,8 +5867,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
Scheduler.get().scheduleDeferred(new Command() {
public void execute() {
scrollBodyPanel
- .setScrollPosition((int) (firstRowInViewPort * scrollBody
- .getRowHeight()));
+ .setScrollPosition(measureScrollPositionOfRow(firstRowInViewPort));
}
});
}
@@ -5903,8 +5905,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
if (!enabled) {
scrollBodyPanel
- .setScrollPosition((int) (firstRowInViewPort * scrollBody
- .getRowHeight()));
+ .setScrollPosition(measureScrollPositionOfRow(firstRowInViewPort));
return;
}
@@ -5929,8 +5930,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
// fix footers horizontal scrolling
tFoot.setHorizontalScrollPosition(scrollLeft);
- firstRowInViewPort = (int) Math.ceil(scrollTop
- / scrollBody.getRowHeight());
+ firstRowInViewPort = calcFirstRowInViewPort();
if (firstRowInViewPort > totalRows - pageLength) {
firstRowInViewPort = totalRows - pageLength;
}
@@ -5992,6 +5992,10 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
}
+ protected int calcFirstRowInViewPort() {
+ return (int) Math.ceil(scrollTop / scrollBody.getRowHeight());
+ }
+
public VScrollTableDropHandler getDropHandler() {
return dropHandler;
}
@@ -6456,8 +6460,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
}
private void scrollByPagelenght(int i) {
- int pixels = i
- * (int) (getFullyVisibleRowCount() * scrollBody.getRowHeight());
+ int pixels = i * scrollBodyPanel.getOffsetHeight();
int newPixels = scrollBodyPanel.getScrollPosition() + pixels;
if (newPixels < 0) {
newPixels = 0;