--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head profile="http://selenium-ide.openqa.org/profiles/test-case">
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link rel="selenium.base" href="" />
+<title>ViewPortCalculation</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ViewPortCalculation</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.ViewPortCalculation?restartApplication</td>
+ <td></td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[2]/domChild[0]</td>
+ <td>25,7</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]</td>
+ <td>v-table-focus</td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]/domChild[2]/domChild[0]</td>
+ <td>22,7</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[6]</td>
+ <td>v-table-focus</td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[2]/domChild[0]</td>
+ <td>15,9</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]</td>
+ <td>v-table-focus</td>
+</tr>
+<tr>
+ <td>doubleClickAt</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]/domChild[2]</td>
+ <td>23,7</td>
+</tr>
+<tr>
+ <td>assertCSSClass</td>
+ <td>vaadin=runcomvaadintestscomponentstableViewPortCalculation::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[9]</td>
+ <td>v-table-focus</td>
+</tr>
+</tbody></table>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+package com.vaadin.tests.components.table;
+
+import com.vaadin.data.Item;
+import com.vaadin.event.ItemClickEvent;
+import com.vaadin.event.ItemClickEvent.ItemClickListener;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.Table.CellStyleGenerator;
+
+public class ViewPortCalculation extends TestBase {
+
+ private Object lastDoubleClickedItemId;
+
+ @Override
+ protected void setup() {
+ getLayout().setSpacing(true);
+ addComponent(createTestTable(10));
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Table rows that are too far down (but still visible) don't get focus after refreshRowCache/select (double-click)."
+ + "<br> Double-clicking on the seventh (or any further) row of causes focus to jump to the first row.";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8298;
+ }
+
+ private Table createTestTable(int rows) {
+ final Table table = new Table();
+ table.setId("table");
+ table.setSelectable(true);
+ table.setPageLength(0);
+
+ table.addContainerProperty("col1", String.class, null);
+ table.addContainerProperty("col2", String.class, null);
+ table.addContainerProperty("col3", String.class, null);
+
+ for (int i = 1; i <= rows; ++i) {
+ testData(table.addItem("row" + i), i);
+ }
+
+ table.setCellStyleGenerator(new CellStyleGenerator() {
+ public String getStyle(Table source, Object itemId,
+ Object propertyId) {
+ if (itemId.equals(lastDoubleClickedItemId)) {
+ return "bold";
+ }
+ return null;
+ }
+ });
+
+ table.addItemClickListener(new ItemClickListener() {
+ public void itemClick(ItemClickEvent event) {
+ if (event.isDoubleClick()) {
+ lastDoubleClickedItemId = event.getItemId();
+ table.refreshRowCache();
+ table.select(event.getItemId());
+ }
+ }
+ });
+ return table;
+ }
+
+ private void testData(Item item, int i) {
+ item.getItemProperty("col1").setValue("test1-" + i);
+ item.getItemProperty("col2").setValue("test2-" + i);
+ item.getItemProperty("col3").setValue("test3-" + i);
+ }
+
+}