diff options
author | Artur Signell <artur@vaadin.com> | 2012-11-28 20:53:55 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2012-11-29 11:13:51 +0000 |
commit | 393a5faf1e0e21212ee0f9fed756244d7c3dc807 (patch) | |
tree | 619d775b58aa0ed96d0b3e006da2e84e29fa546e | |
parent | d87c6f72508a4c76c0c2274bccaf4191bb5fa204 (diff) | |
download | vaadin-framework-393a5faf1e0e21212ee0f9fed756244d7c3dc807.tar.gz vaadin-framework-393a5faf1e0e21212ee0f9fed756244d7c3dc807.zip |
Fixed tooltip handling for TreeTable (#9088)
Change-Id: I9e4ae2ae4a040de795121db359d930ccda115f62
4 files changed, 414 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VTreeTable.java b/client/src/com/vaadin/client/ui/VTreeTable.java index d4bfa9698d..318fcb3bca 100644 --- a/client/src/com/vaadin/client/ui/VTreeTable.java +++ b/client/src/com/vaadin/client/ui/VTreeTable.java @@ -122,7 +122,7 @@ public class VTreeTable extends VScrollTable { } } - class VTreeTableScrollBody extends VScrollTable.VScrollTableBody { + public class VTreeTableScrollBody extends VScrollTable.VScrollTableBody { private int indentWidth = -1; VTreeTableScrollBody() { @@ -138,7 +138,7 @@ public class VTreeTable extends VScrollTable { return new VTreeTableRow(uidl, aligns2); } - class VTreeTableRow extends + public class VTreeTableRow extends VScrollTable.VScrollTableBody.VScrollTableRow { private boolean isTreeCellAdded = false; diff --git a/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java b/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java index be6e54c5ce..db16bb32a1 100644 --- a/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java +++ b/client/src/com/vaadin/client/ui/treetable/TreeTableConnector.java @@ -15,12 +15,16 @@ */ package com.vaadin.client.ui.treetable; +import com.google.gwt.dom.client.Element; import com.vaadin.client.ApplicationConnection; +import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; +import com.vaadin.client.Util; import com.vaadin.client.ui.FocusableScrollPanel; import com.vaadin.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow; import com.vaadin.client.ui.VTreeTable; import com.vaadin.client.ui.VTreeTable.PendingNavigationEvent; +import com.vaadin.client.ui.VTreeTable.VTreeTableScrollBody.VTreeTableRow; import com.vaadin.client.ui.table.TableConnector; import com.vaadin.shared.ui.Connect; import com.vaadin.shared.ui.treetable.TreeTableConstants; @@ -112,4 +116,27 @@ public class TreeTableConnector extends TableConnector { public TreeTableState getState() { return (TreeTableState) super.getState(); } + + @Override + public TooltipInfo getTooltipInfo(Element element) { + + TooltipInfo info = null; + + if (element != getWidget().getElement()) { + Object node = Util.findWidget( + (com.google.gwt.user.client.Element) element, + VTreeTableRow.class); + + if (node != null) { + VTreeTableRow row = (VTreeTableRow) node; + info = row.getTooltip(element); + } + } + + if (info == null) { + info = super.getTooltipInfo(element); + } + + return info; + } } diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html new file mode 100644 index 0000000000..7f2f61bfc3 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.html @@ -0,0 +1,357 @@ +<?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://arturwin.office.itmill.com:8888/" /> +<title>New Test</title> +</head> +<body> +<table cellpadding="1" cellspacing="1" border="1"> +<thead> +<tr><td rowspan="1" colspan="3">New Test</td></tr> +</thead><tbody> +<tr> + <td>open</td> + <td>/run/TreeTableItemDescriptionGeneratorTest?restartApplication</td> + <td></td> +</tr> +<!--All on--> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Text</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Button 1 description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Textfield's own description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Cell and row tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>12,6</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Text</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Component</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Cell description item 1,Generated component</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Row and Component tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>7,8</td> +</tr> +<tr> + <td>mouseClick</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VCheckBox[0]/domChild[0]</td> + <td>7,5</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Button 1 description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Textfield's own description</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Row tooltips--> +<tr> + <td>mouseClick</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/VOrderedLayout$Slot[0]/VCheckBox[0]/domChild[0]</td> + <td>7,8</td> +</tr> +<!--Text tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[1]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--Button tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VButton[0]/domChild[0]/domChild[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<!--TextField tooltip--> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::PID_Stable/FocusableScrollPanel[0]/VTreeTable$VTreeTableScrollBody[0]/VTreeTable$VTreeTableScrollBody$VTreeTableRow[1]/VTextField[0]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +<tr> + <td>assertText</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]/FlowPanel[0]/domChild[1]</td> + <td>Row description item 1</td> +</tr> +<tr> + <td>mouseMoveAt</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::/VVerticalLayout[0]/VOrderedLayout$Slot[1]/VVerticalLayout[0]/domChild[3]</td> + <td>22,7</td> +</tr> +<tr> + <td>waitForElementNotPresent</td> + <td>vaadin=runTreeTableItemDescriptionGeneratorTest::Root/VTooltip[0]</td> + <td></td> +</tr> +</tbody></table> +</body> +</html> diff --git a/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java new file mode 100644 index 0000000000..2864156b03 --- /dev/null +++ b/uitest/src/com/vaadin/tests/components/treetable/TreeTableItemDescriptionGeneratorTest.java @@ -0,0 +1,28 @@ +/* + * Copyright 2012 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.components.treetable; + +import com.vaadin.tests.components.table.TableItemDescriptionGeneratorTest; +import com.vaadin.ui.Table; +import com.vaadin.ui.TreeTable; + +public class TreeTableItemDescriptionGeneratorTest extends + TableItemDescriptionGeneratorTest { + @Override + protected Table createTable() { + return new TreeTable(); + } +} |