summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-10-01 17:48:40 +0300
committerHenri Sara <hesara@vaadin.com>2015-10-02 08:17:38 +0000
commit904ae72ed3ca7f9477d59bd7fd284bb254895f8b (patch)
tree64e4d04b86ce904c46e702c757694723d64cb09b
parent4e02b7e7402a1d79298787968065a7773e7e34a8 (diff)
downloadvaadin-framework-904ae72ed3ca7f9477d59bd7fd284bb254895f8b.tar.gz
vaadin-framework-904ae72ed3ca7f9477d59bd7fd284bb254895f8b.zip
Fix TreeTableContextClick support (#19056)
Change-Id: Ib6bac73ba96c4919df2e1bf5c9c83160707530bb
-rw-r--r--client/src/com/vaadin/client/ui/table/TableConnector.java6
-rw-r--r--client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java5
-rw-r--r--uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java53
-rw-r--r--uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java32
4 files changed, 95 insertions, 1 deletions
diff --git a/client/src/com/vaadin/client/ui/table/TableConnector.java b/client/src/com/vaadin/client/ui/table/TableConnector.java
index 70248d367c..badfcf7d28 100644
--- a/client/src/com/vaadin/client/ui/table/TableConnector.java
+++ b/client/src/com/vaadin/client/ui/table/TableConnector.java
@@ -104,7 +104,7 @@ public class TableConnector extends AbstractFieldConnector implements
colKey = w.getColKey();
} else if (getWidget().scrollBody.getElement().isOrHasChild(e)) {
section = Section.BODY;
- VScrollTableRow w = WidgetUtil.findWidget(e, VScrollTableRow.class);
+ VScrollTableRow w = getScrollTableRow(e);
rowKey = w.getKey();
colKey = getWidget().tHead.getHeaderCell(
getElementIndex(e, w.getElement())).getColKey();
@@ -124,6 +124,10 @@ public class TableConnector extends AbstractFieldConnector implements
details);
}
+ protected VScrollTableRow getScrollTableRow(Element e) {
+ return WidgetUtil.findWidget(e, VScrollTableRow.class);
+ }
+
private int getElementIndex(Element e,
com.google.gwt.user.client.Element element) {
int i = 0;
diff --git a/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java b/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java
index 4aab248e29..0e0c190c11 100644
--- a/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java
+++ b/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java
@@ -143,4 +143,9 @@ public class TreeTableConnector extends TableConnector {
return info;
}
+
+ @Override
+ protected VScrollTableRow getScrollTableRow(Element e) {
+ return WidgetUtil.findWidget(e, VTreeTableRow.class);
+ }
}
diff --git a/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java
new file mode 100644
index 0000000000..7d995710c9
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClick.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.contextclick;
+
+import com.vaadin.data.Item;
+import com.vaadin.shared.ui.table.TableConstants.Section;
+import com.vaadin.tests.util.PersonContainer;
+import com.vaadin.ui.Table.TableContextClickEvent;
+import com.vaadin.ui.TreeTable;
+
+public class TreeTableContextClick extends
+ AbstractContextClickUI<TreeTable, TableContextClickEvent> {
+
+ @Override
+ protected TreeTable createTestComponent() {
+ TreeTable treeTable = new TreeTable();
+ treeTable.setContainerDataSource(PersonContainer.createWithTestData());
+ treeTable.setFooterVisible(true);
+ return treeTable;
+ }
+
+ @Override
+ protected void handleContextClickEvent(TableContextClickEvent event) {
+ String value = "";
+ Object propertyId = event.getPropertyId();
+ if (event.getItemId() != null) {
+ Item item = event.getComponent().getContainerDataSource()
+ .getItem(event.getItemId());
+ value += item.getItemProperty("firstName").getValue() + " ";
+ value += item.getItemProperty("lastName").getValue();
+ } else if (event.getSection() == Section.HEADER) {
+ value = testComponent.getColumnHeader(propertyId);
+ } else if (event.getSection() == Section.FOOTER) {
+ value = testComponent.getColumnFooter(propertyId);
+ }
+ log("ContextClickEvent value: " + value + ", propertyId: " + propertyId
+ + ", section: " + event.getSection());
+ }
+
+}
diff --git a/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java
new file mode 100644
index 0000000000..fa3a34be06
--- /dev/null
+++ b/uitest/src/com/vaadin/tests/contextclick/TreeTableContextClickTest.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright 2000-2014 Vaadin Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.vaadin.tests.contextclick;
+
+import org.openqa.selenium.interactions.Actions;
+
+public class TreeTableContextClickTest extends TableContextClickTest {
+
+ @Override
+ protected Class<?> getUIClass() {
+ return TreeTableContextClick.class;
+ }
+
+ @Override
+ protected void contextClick(org.openqa.selenium.WebElement e) {
+ new Actions(getDriver()).moveToElement(e, 10, 10).contextClick()
+ .perform();
+ };
+}