diff options
author | Henrik Paul <henrik@vaadin.com> | 2013-11-13 09:25:08 +0200 |
---|---|---|
committer | Henrik Paul <henrik@vaadin.com> | 2013-11-13 09:38:41 +0200 |
commit | fd95c4845dd3a50da779b73f176cf9f281e57ddd (patch) | |
tree | 2e68095ebf984b9749b63425ebfd2a5e095897c5 /uitest | |
parent | fe33fb6316a84b809ebc4cde6aef4a744e489972 (diff) | |
download | vaadin-framework-fd95c4845dd3a50da779b73f176cf9f281e57ddd.tar.gz vaadin-framework-fd95c4845dd3a50da779b73f176cf9f281e57ddd.zip |
Convert CellRenderer to revised EscalatorUpdater (#12645)
Change-Id: I046c53e775cdeaf4cfb02c47b3f2ca35231e4045
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/BasicEscalator.html | 176 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/BasicEscalator.java (renamed from uitest/src/com/vaadin/tests/components/grid/GridTest.java) | 16 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/components/grid/GridTest.html | 176 | ||||
-rw-r--r-- | uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java | 108 |
4 files changed, 253 insertions, 223 deletions
diff --git a/uitest/src/com/vaadin/tests/components/grid/BasicEscalator.html b/uitest/src/com/vaadin/tests/components/grid/BasicEscalator.html new file mode 100644 index 0000000000..70aa0fe195 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/grid/BasicEscalator.html @@ -0,0 +1,176 @@ +<?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="http://localhost:8888/" /> +<title>BasicEscalator</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">BasicEscalator</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/com.vaadin.tests.components.grid.BasicEscalator?restartApplication</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>Row 0: 0,0 (0)</td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[17]/domChild[9]</td> + <td>Cell: 9,17 (179)</td> +</tr> +<tr> + <td>verifyTextNotPresent</td> + <td>Cell: 0,100</td> + <td></td> +</tr> +<tr> + <td>verifyTextNotPresent</td> + <td>Cell: 0,101</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> + <td>0</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> + <td>1</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[18]/domChild[0]</td> + <td>Row 0: 0,100 (190)</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> + <td>11</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[17]/domChild[0]</td> + <td>Row 11: 0,101 (200)</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> + <td>0</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> + <td>100</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[16]/domChild[0]</td> + <td>Row 0: 0,102 (210)</td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> + <td>Row 16: 0,118 (370)</td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[0]</td> + <td>1109</td> +</tr> +<tr> + <td>verifyTextPresent</td> + <td>Row 56: 0,158</td> + <td></td> +</tr> +<tr> + <td>verifyTextPresent</td> + <td>Row 72: 0,174</td> + <td></td> +</tr> +<tr> + <td>scroll</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[0]</td> + <td>3690</td> +</tr> +<tr> + <td>verifyTextPresent</td> + <td>Row 201: 0,99</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> + <td>201</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> + <td>1</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> + <td>Row 200: 0,98 (960)</td> +</tr> +<tr> + <td>verifyTextNotPresent</td> + <td>Row 201:</td> + <td></td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> + <td>0</td> +</tr> +<tr> + <td>type</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> + <td>2</td> +</tr> +<tr> + <td>click</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[2]/VButton[0]</td> + <td></td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[16]/domChild[0]</td> + <td>Row 184: 10,82 (974)</td> +</tr> +<tr> + <td>verifyText</td> + <td>vaadin=runcomvaadintestscomponentsgridBasicEscalator::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> + <td>Row 200: 10,98 (1006)</td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/grid/GridTest.java b/uitest/src/com/vaadin/tests/components/grid/BasicEscalator.java index 27b1d6387d..c8a35b702f 100644 --- a/uitest/src/com/vaadin/tests/components/grid/GridTest.java +++ b/uitest/src/com/vaadin/tests/components/grid/BasicEscalator.java @@ -33,16 +33,24 @@ import com.vaadin.ui.TextField; * @author Vaadin Ltd */ @Widgetset(TestingWidgetSet.NAME) -public class GridTest extends AbstractTestUI { +public class BasicEscalator extends AbstractTestUI { + public static final String ESCALATOR = "escalator"; + public static final String INSERT_ROWS_OFFSET = "iro"; + public static final String INSERT_ROWS_AMOUNT = "ira"; + public static final String INSERT_ROWS_BUTTON = "irb"; + @Override protected void setup(final VaadinRequest request) { final TestGrid grid = new TestGrid(); + grid.setId(ESCALATOR); addComponent(grid); final Layout insertRowsLayout = new HorizontalLayout(); final TextField insertRowsOffset = new TextField(); + insertRowsOffset.setId(INSERT_ROWS_OFFSET); insertRowsLayout.addComponent(insertRowsOffset); final TextField insertRowsAmount = new TextField(); + insertRowsAmount.setId(INSERT_ROWS_AMOUNT); insertRowsLayout.addComponent(insertRowsAmount); insertRowsLayout.addComponent(new Button("insert rows", new Button.ClickListener() { @@ -55,7 +63,11 @@ public class GridTest extends AbstractTestUI { .getValue()); grid.insertRows(offset, amount); } - })); + }) { + { + setId(INSERT_ROWS_BUTTON); + } + }); addComponent(insertRowsLayout); final Layout removeRowsLayout = new HorizontalLayout(); diff --git a/uitest/src/com/vaadin/tests/components/grid/GridTest.html b/uitest/src/com/vaadin/tests/components/grid/GridTest.html deleted file mode 100644 index 33dda17471..0000000000 --- a/uitest/src/com/vaadin/tests/components/grid/GridTest.html +++ /dev/null @@ -1,176 +0,0 @@ -<?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="http://localhost:8888/" /> -<title>GridTest</title> -</head> -<body> -<table cellpadding="1" cellspacing="1" border="1"> -<thead> -<tr><td rowspan="1" colspan="3">GridTest</td></tr> -</thead><tbody> -<tr> - <td>open</td> - <td>/run/com.vaadin.tests.components.grid.GridTest?restartApplication</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> - <td>Row 0: 0,0 (0)</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[17]/domChild[9]</td> - <td>Cell: 9,17 (179)</td> -</tr> -<tr> - <td>verifyTextNotPresent</td> - <td>Cell: 0,100</td> - <td></td> -</tr> -<tr> - <td>verifyTextNotPresent</td> - <td>Cell: 0,101</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> - <td>0</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[18]/domChild[0]</td> - <td>Row 0: 0,100 (190)</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> - <td>11</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[17]/domChild[0]</td> - <td>Row 11: 0,101 (200)</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> - <td>0</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> - <td>100</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[1]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[16]/domChild[0]</td> - <td>Row 0: 0,102 (210)</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> - <td>Row 16: 0,118 (370)</td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[0]</td> - <td>1109</td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>Row 56: 0,158</td> - <td></td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>Row 72: 0,174</td> - <td></td> -</tr> -<tr> - <td>scroll</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[0]</td> - <td>3690</td> -</tr> -<tr> - <td>verifyTextPresent</td> - <td>Row 201: 0,99</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> - <td>201</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> - <td>1</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[2]/VHorizontalLayout[0]/Slot[2]/VButton[0]/domChild[0]/domChild[0]</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> - <td>Row 200: 0,98 (960)</td> -</tr> -<tr> - <td>verifyTextNotPresent</td> - <td>Row 201:</td> - <td></td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[0]/VTextField[0]</td> - <td>0</td> -</tr> -<tr> - <td>type</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[1]/VTextField[0]</td> - <td>2</td> -</tr> -<tr> - <td>click</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[3]/VHorizontalLayout[0]/Slot[2]/VButton[0]</td> - <td></td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[16]/domChild[0]</td> - <td>Row 184: 10,82 (974)</td> -</tr> -<tr> - <td>verifyText</td> - <td>vaadin=runcomvaadintestscomponentsgridGridTest::/VVerticalLayout[0]/Slot[1]/VVerticalLayout[0]/Slot[0]/VTestGrid[0]/domChild[1]/domChild[0]/domChild[1]/domChild[1]/domChild[0]</td> - <td>Row 200: 10,98 (1006)</td> -</tr> -</tbody></table> -</body> -</html> diff --git a/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java b/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java index 154b1d2bc9..5edc2ab0a0 100644 --- a/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java +++ b/uitest/src/com/vaadin/tests/widgetset/client/grid/VTestGrid.java @@ -5,9 +5,10 @@ import java.util.List; import com.google.gwt.user.client.ui.Composite; import com.vaadin.client.ui.grid.Cell; -import com.vaadin.client.ui.grid.CellRenderer; import com.vaadin.client.ui.grid.ColumnConfiguration; import com.vaadin.client.ui.grid.Escalator; +import com.vaadin.client.ui.grid.EscalatorUpdater; +import com.vaadin.client.ui.grid.Row; import com.vaadin.client.ui.grid.RowContainer; import com.vaadin.client.ui.grid.ScrollDestination; @@ -19,52 +20,61 @@ public class VTestGrid extends Composite { private final List<Integer> columns = new ArrayList<Integer>(); private final List<Integer> rows = new ArrayList<Integer>(); - public void insertRows(int offset, int amount) { - List<Integer> newRows = new ArrayList<Integer>(); + @SuppressWarnings("boxing") + public void insertRows(final int offset, final int amount) { + final List<Integer> newRows = new ArrayList<Integer>(); for (int i = 0; i < amount; i++) { newRows.add(rowCounter++); } rows.addAll(offset, newRows); } - public void insertColumns(int offset, int amount) { - List<Integer> newColumns = new ArrayList<Integer>(); + @SuppressWarnings("boxing") + public void insertColumns(final int offset, final int amount) { + final List<Integer> newColumns = new ArrayList<Integer>(); for (int i = 0; i < amount; i++) { newColumns.add(columnCounter++); } columns.addAll(offset, newColumns); } - public CellRenderer createHeaderRenderer() { - return new CellRenderer() { + public EscalatorUpdater createHeaderUpdater() { + return new EscalatorUpdater() { @Override - public void renderCell(Cell cell) { - int columnName = columns.get(cell.getColumn()); - cell.getElement().setInnerText("Header " + columnName); + public void updateCells(final Row row, + final List<Cell> cellsToUpdate) { + for (final Cell cell : cellsToUpdate) { + final Integer columnName = columns + .get(cell.getColumn()); + cell.getElement().setInnerText("Header " + columnName); + } } }; } - public CellRenderer createFooterRenderer() { - return new CellRenderer() { + public EscalatorUpdater createFooterUpdater() { + return new EscalatorUpdater() { @Override - public void renderCell(Cell cell) { - int columnName = columns.get(cell.getColumn()); - cell.getElement().setInnerText("Footer " + columnName); + public void updateCells(final Row row, + final List<Cell> cellsToUpdate) { + for (final Cell cell : cellsToUpdate) { + final Integer columnName = columns + .get(cell.getColumn()); + cell.getElement().setInnerText("Footer " + columnName); + } } }; } - public CellRenderer createBodyRenderer() { - return new CellRenderer() { - int i = 0; + public EscalatorUpdater createBodyUpdater() { + return new EscalatorUpdater() { + private int i = 0; - @Override - public void renderCell(Cell cell) { - int columnName = columns.get(cell.getColumn()); - int rowName = rows.get(cell.getRow()); - String cellInfo = columnName + "," + rowName + " (" + i - + ")"; + public void renderCell(final Cell cell) { + final Integer columnName = columns.get(cell.getColumn()); + final Integer rowName = rows.get(cell.getRow()); + final String cellInfo = columnName + "," + rowName + " (" + + i + ")"; if (cell.getColumn() > 0) { cell.getElement().setInnerText("Cell: " + cellInfo); @@ -73,10 +83,10 @@ public class VTestGrid extends Composite { "Row " + cell.getRow() + ": " + cellInfo); } - double c = i * .1; - int r = (int) ((Math.cos(c) + 1) * 128); - int g = (int) ((Math.cos(c / Math.PI) + 1) * 128); - int b = (int) ((Math.cos(c / (Math.PI * 2)) + 1) * 128); + final double c = i * .1; + final int r = (int) ((Math.cos(c) + 1) * 128); + final int g = (int) ((Math.cos(c / Math.PI) + 1) * 128); + final int b = (int) ((Math.cos(c / (Math.PI * 2)) + 1) * 128); cell.getElement() .getStyle() .setBackgroundColor( @@ -89,36 +99,44 @@ public class VTestGrid extends Composite { i++; } + + @Override + public void updateCells(final Row row, + final List<Cell> cellsToUpdate) { + for (final Cell cell : cellsToUpdate) { + renderCell(cell); + } + } }; } - public void removeRows(int offset, int amount) { + public void removeRows(final int offset, final int amount) { for (int i = 0; i < amount; i++) { rows.remove(offset); } } - public void removeColumns(int offset, int amount) { + public void removeColumns(final int offset, final int amount) { for (int i = 0; i < amount; i++) { columns.remove(offset); } } } - private Escalator escalator = new Escalator(); - private Data data = new Data(); + private final Escalator escalator = new Escalator(); + private final Data data = new Data(); public VTestGrid() { initWidget(escalator); - RowContainer header = escalator.getHeader(); - header.setCellRenderer(data.createHeaderRenderer()); + final RowContainer header = escalator.getHeader(); + header.setEscalatorUpdater(data.createHeaderUpdater()); header.insertRows(0, 1); - RowContainer footer = escalator.getFooter(); - footer.setCellRenderer(data.createFooterRenderer()); + final RowContainer footer = escalator.getFooter(); + footer.setEscalatorUpdater(data.createFooterUpdater()); footer.insertRows(0, 1); - escalator.getBody().setCellRenderer(data.createBodyRenderer()); + escalator.getBody().setEscalatorUpdater(data.createBodyUpdater()); insertRows(0, 100); insertColumns(0, 10); @@ -128,12 +146,12 @@ public class VTestGrid extends Composite { } - public void insertRows(int offset, int number) { + public void insertRows(final int offset, final int number) { data.insertRows(offset, number); escalator.getBody().insertRows(offset, number); } - public void insertColumns(int offset, int number) { + public void insertColumns(final int offset, final int number) { data.insertColumns(offset, number); escalator.getColumnConfiguration().insertColumns(offset, number); } @@ -142,8 +160,8 @@ public class VTestGrid extends Composite { return escalator.getColumnConfiguration(); } - public void scrollToRow(int index, ScrollDestination destination, - int padding) { + public void scrollToRow(final int index, + final ScrollDestination destination, final int padding) { if (padding != 0) { escalator.scrollToRow(index, destination, padding); } else { @@ -151,8 +169,8 @@ public class VTestGrid extends Composite { } } - public void scrollToColumn(int index, ScrollDestination destination, - int padding) { + public void scrollToColumn(final int index, + final ScrollDestination destination, final int padding) { if (padding != 0) { escalator.scrollToColumn(index, destination, padding); } else { @@ -160,12 +178,12 @@ public class VTestGrid extends Composite { } } - public void removeRows(int offset, int amount) { + public void removeRows(final int offset, final int amount) { data.removeRows(offset, amount); escalator.getBody().removeRows(offset, amount); } - public void removeColumns(int offset, int amount) { + public void removeColumns(final int offset, final int amount) { data.removeColumns(offset, amount); escalator.getColumnConfiguration().removeColumns(offset, amount); } |