--- /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>ValueAfterClearingContainer</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">ValueAfterClearingContainer</td></tr>
+</thead><tbody>
+<tr>
+ <td>open</td>
+ <td>/run/com.vaadin.tests.components.table.ValueAfterClearingContainer?restartApplication</td>
+ <td></td>
+</tr>
+<!-- add items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<!-- verify selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>1. Value changed to 2</td>
+</tr>
+<!-- remove items from table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromTableButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>2. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>3. Value changed to 2</td>
+</tr>
+<!-- remove items from container -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>4. Table selection: 2</td>
+</tr>
+<!-- replace the items -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that selection still exists -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>5. Table selection: 2</td>
+</tr>
+<!-- remove items from container and sanitize the table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveItemsFromContainerAndSanitizeButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that sanitizing cleared the value -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>6. Value changed to null</td>
+</tr>
+<!-- replace the items and select one of them -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SaddItemsButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>7. Value changed to 2</td>
+</tr>
+<!-- remove selected item from the table -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromTableButton/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal cleared the selection -->
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>8. Value changed to null</td>
+</tr>
+<!-- select new item and remove it from the container -->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>9. Value changed to 3</td>
+</tr>
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SremoveSelectedFromContainer/domChild[0]</td>
+ <td></td>
+</tr>
+<!-- verify that removal failed to clear the value -->
+<tr>
+ <td>click</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SshowValueButton/domChild[0]</td>
+ <td></td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>10. Table selection: 3</td>
+</tr>
+<!-- verify the item has been removed -->
+<tr>
+ <td>mouseClick</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[2]/domChild[0]/domChild[0]</td>
+ <td>40,13</td>
+</tr>
+<tr>
+ <td>assertText</td>
+ <td>vaadin=runcomvaadintestscomponentstableValueAfterClearingContainer::PID_SLog_row_0</td>
+ <td>11. Value changed to 4</td>
+</tr>
+
+</tbody></table>
+</body>
+</html>
@Override
protected void setup() {
+ log.setId("log");
+ table.setId("table");
table.setSelectable(true);
table.addContainerProperty(PROPERTY_ID, Integer.class, null);
table.setImmediate(true);
addComponent(table);
final CheckBox multiselect = new CheckBox("Multiselect");
multiselect.setImmediate(true);
+ multiselect.setId("multiselect");
multiselect.addValueChangeListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
}
});
addComponent(multiselect);
- addComponent(new Button("Add table items", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- if (!table.getItemIds().isEmpty()) {
- Notification.show("Only possible when the table is empty");
- return;
- } else {
- for (int i = 0; i < 5; i++) {
- table.addItem(new Object[] { Integer.valueOf(i) },
- Integer.valueOf(i));
+ Button addItemsButton = new Button("Add table items",
+ new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ if (!table.getItemIds().isEmpty()) {
+ Notification
+ .show("Only possible when the table is empty");
+ return;
+ } else {
+ for (int i = 0; i < 5; i++) {
+ table.addItem(
+ new Object[] { Integer.valueOf(i) },
+ Integer.valueOf(i));
+ }
+ }
}
- }
- }
- }));
+ });
+ addItemsButton.setId("addItemsButton");
+ addComponent(addItemsButton);
- addComponent(new Button("Show value", new Button.ClickListener() {
- public void buttonClick(ClickEvent event) {
- log.log("Table selection: " + table.getValue());
- }
- }));
-
- addComponent(new Button("Remove items from table",
+ Button showValueButton = new Button("Show value",
new Button.ClickListener() {
+ public void buttonClick(ClickEvent event) {
+ log.log("Table selection: " + table.getValue());
+ }
+ });
+ showValueButton.setId("showValueButton");
+ addComponent(showValueButton);
+
+ Button removeItemsFromTableButton = new Button(
+ "Remove items from table", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
table.removeAllItems();
}
- }));
+ });
+ removeItemsFromTableButton.setId("removeItemsFromTableButton");
+ addComponent(removeItemsFromTableButton);
- addComponent(new Button("Remove items from container",
- new Button.ClickListener() {
+ Button removeItemsFromContainerButton = new Button(
+ "Remove items from container", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
table.getContainerDataSource().removeAllItems();
}
- }));
- addComponent(new Button("Remove items from container and sanitize",
+ });
+ removeItemsFromContainerButton.setId("removeItemsFromContainerButton");
+ addComponent(removeItemsFromContainerButton);
+ Button removeItemsFromContainerAndSanitizeButton = new Button(
+ "Remove items from container and sanitize",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
table.getContainerDataSource().removeAllItems();
table.sanitizeSelection();
}
- }));
- addComponent(new Button("Remove selected item from table",
- new Button.ClickListener() {
+ });
+ removeItemsFromContainerAndSanitizeButton
+ .setId("removeItemsFromContainerAndSanitizeButton");
+ addComponent(removeItemsFromContainerAndSanitizeButton);
+ Button removeSelectedFromTableButton = new Button(
+ "Remove selected item from table", new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Object selection = table.getValue();
if (selection == null) {
table.removeItem(selection);
}
}
- }));
- addComponent(new Button("Remove selected item from container",
+ });
+ removeSelectedFromTableButton.setId("removeSelectedFromTableButton");
+ addComponent(removeSelectedFromTableButton);
+ Button removeSelectedFromContainer = new Button(
+ "Remove selected item from container",
new Button.ClickListener() {
public void buttonClick(ClickEvent event) {
Object selection = table.getValue();
.removeItem(selection);
}
}
- }));
+ });
+ removeSelectedFromContainer.setId("removeSelectedFromContainer");
+ addComponent(removeSelectedFromContainer);
}
@Override