* if the two ranges aren't connected
*/
public Range combineWith(Range other) throws IllegalArgumentException {
+ if (other.isEmpty()) {
+ return this;
+ } else if (isEmpty()) {
+ return other;
+ }
+
if (getStart() > other.getEnd() || other.getStart() > getEnd()) {
throw new IllegalArgumentException("There is a gap between " + this
+ " and " + other);
}
}
});
+
+ createClickAction("Remove all rows", "Body rows",
+ new Command<Grid, String>() {
+ @SuppressWarnings("unchecked")
+ @Override
+ public void execute(Grid c, String value, Object data) {
+ ds.removeAllItems();
+ }
+ }, null);
}
@SuppressWarnings("boxing")
"modified: Column 0", getBodyCellByRowAndColumn(0, 0).getText());
}
+ @Test
+ public void testRemovingAllItems() throws Exception {
+ openTestURL();
+
+ selectMenuPath("Component", "Body rows", "Remove all rows");
+
+ assertEquals(0, getGridElement().findElement(By.tagName("tbody"))
+ .findElements(By.tagName("tr")).size());
+ }
+
private void assertPrimaryStylename(String stylename) {
assertTrue(getGridElement().getAttribute("class").contains(stylename));