}
});
refresh10.setId("refresh10");
+ Button refreshAll = new Button("Refresh all", new ClickListener() {
+ @Override
+ public void buttonClick(ClickEvent event) {
+ grid.refreshAllRows();
+ }
+ });
+ refreshAll.setId("refreshAll");
addComponents(new HorizontalLayout(refresh(0), refresh(1), refresh(2),
new Button("Refresh non-existant", new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
grid.refreshRows("foobar");
}
- })), refresh10);
+ })), refresh10, refreshAll);
addComponents(new HorizontalLayout(style(0), style(1), style(2)));
}
Assert.assertEquals("!!Marge", grid.getCell(2, 1).getText());
}
+ @Test
+ public void refreshAllRows() {
+ openTestURL();
+ grid = $(GridElement.class).first();
+ update(0);
+ update(1);
+ update(2);
+ style(1);
+ style(2);
+
+ Assert.assertEquals("Lisa", grid.getCell(0, 1).getText());
+ Assert.assertEquals("Joshua", grid.getCell(1, 1).getText());
+ Assert.assertEquals("Marge", grid.getCell(2, 1).getText());
+
+ Assert.assertFalse(hasCssClass(grid.getRow(0), "rowstyle"));
+ Assert.assertFalse(hasCssClass(grid.getRow(1), "rowstyle"));
+ Assert.assertFalse(hasCssClass(grid.getRow(2), "rowstyle"));
+ Assert.assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle"));
+ Assert.assertFalse(hasCssClass(grid.getCell(1, 0), "cellstyle"));
+ Assert.assertFalse(hasCssClass(grid.getCell(2, 0), "cellstyle"));
+
+ refreshAll();
+ Assert.assertEquals("!Lisa", grid.getCell(0, 1).getText());
+ Assert.assertEquals("!Joshua", grid.getCell(1, 1).getText());
+ Assert.assertEquals("!Marge", grid.getCell(2, 1).getText());
+
+ Assert.assertFalse(hasCssClass(grid.getRow(0), "rowstyle"));
+ Assert.assertTrue(hasCssClass(grid.getRow(1), "rowstyle"));
+ Assert.assertTrue(hasCssClass(grid.getRow(2), "rowstyle"));
+ Assert.assertFalse(hasCssClass(grid.getCell(0, 0), "cellstyle"));
+ Assert.assertTrue(hasCssClass(grid.getCell(1, 0), "cellstyle"));
+ Assert.assertTrue(hasCssClass(grid.getCell(2, 0), "cellstyle"));
+ }
+
private void refresh10First() {
$(ButtonElement.class).id("refresh10").click();
}
private void refresh(int i) {
$(ButtonElement.class).id("refresh" + i).click();
}
+
+ private void refreshAll() {
+ $(ButtonElement.class).id("refreshAll").click();
+ }
}