From 34f4814739c0cf2ced4b38b609b25e11756fad9b Mon Sep 17 00:00:00 2001 From: Jonatan Kronqvist Date: Thu, 22 Sep 2011 10:44:37 +0000 Subject: Applied patch to support implementation of #7358 svn changeset:21231/svn branch:6.7 --- .../vaadin/terminal/gwt/client/ui/VScrollTable.java | 19 ++++++++++--------- src/com/vaadin/ui/Table.java | 14 ++++++++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java index a94b7489c9..c09508dc58 100644 --- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java +++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java @@ -1091,11 +1091,11 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, // received 'surprising' firstvisible from server: scroll there firstRowInViewPort = firstvisible; scrollBodyPanel - .setScrollPosition(measureScrollPositionOfRow(firstvisible)); + .setScrollPosition(measureRowHeightOffset(firstvisible)); } } - protected int measureScrollPositionOfRow(int rowIx) { + protected int measureRowHeightOffset(int rowIx) { return (int) (rowIx * scrollBody.getRowHeight()); } @@ -1930,7 +1930,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, Scheduler.get().scheduleDeferred(new Command() { public void execute() { scrollBodyPanel - .setScrollPosition(measureScrollPositionOfRow(firstvisible)); + .setScrollPosition(measureRowHeightOffset(firstvisible)); firstRowInViewPort = firstvisible; } }); @@ -4192,17 +4192,18 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, */ private void setContainerHeight() { fixSpacers(); - DOM.setStyleAttribute(container, "height", totalRows - * getRowHeight() + "px"); + DOM.setStyleAttribute(container, "height", + measureRowHeightOffset(totalRows) + "px"); } private void fixSpacers() { - int prepx = (int) Math.round(getRowHeight() * firstRendered); + int prepx = measureRowHeightOffset(firstRendered); if (prepx < 0) { prepx = 0; } preSpacer.getStyle().setPropertyPx("height", prepx); - int postpx = (int) (getRowHeight() * (totalRows - 1 - lastRendered)); + int postpx = measureRowHeightOffset(totalRows - 1) + - measureRowHeightOffset(lastRendered); if (postpx < 0) { postpx = 0; } @@ -5869,7 +5870,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, Scheduler.get().scheduleDeferred(new Command() { public void execute() { scrollBodyPanel - .setScrollPosition(measureScrollPositionOfRow(firstRowInViewPort)); + .setScrollPosition(measureRowHeightOffset(firstRowInViewPort)); } }); } @@ -5907,7 +5908,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler, } if (!enabled) { scrollBodyPanel - .setScrollPosition(measureScrollPositionOfRow(firstRowInViewPort)); + .setScrollPosition(measureRowHeightOffset(firstRowInViewPort)); return; } diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java index db39825d79..45cd1bf9a3 100644 --- a/src/com/vaadin/ui/Table.java +++ b/src/com/vaadin/ui/Table.java @@ -1644,8 +1644,12 @@ public class Table extends AbstractSelect implements Action.Container, } if (isGeneratedRow) { - if (generatedRow.isSpanColumns() && j > 0) { - value = null; + if (generatedRow.isSpanColumns()) { + if (j > 0) { + value = null; + } else if (generatedRow.getValue() instanceof Component) { + value = generatedRow.getValue(); + } } else if (generatedRow.getText().length > j) { value = generatedRow.getText()[j]; } @@ -3122,6 +3126,8 @@ public class Table extends AbstractSelect implements Action.Container, if (generatedRow != null) { target.addAttribute("gen_html", generatedRow.isHtmlContentAllowed()); target.addAttribute("gen_span", generatedRow.isSpanColumns()); + target.addAttribute("gen_widget", + generatedRow.getValue() instanceof Component); } } @@ -4847,6 +4853,10 @@ public class Table extends AbstractSelect implements Action.Container, return text; } + protected Object getValue() { + return getText(); + } + protected boolean isHtmlContentAllowed() { return htmlContentAllowed; } -- cgit v1.2.3