diff options
author | Artur Signell <artur.signell@itmill.com> | 2009-12-17 11:16:42 +0000 |
---|---|---|
committer | Artur Signell <artur.signell@itmill.com> | 2009-12-17 11:16:42 +0000 |
commit | 5254061ed4df93d579b114f1fa665712e5458950 (patch) | |
tree | e5113a392c21f8b27f087afaf6cd287e7e30582f /tests | |
parent | eb754fc044516f0c501ad50f4c6358e4f827e386 (diff) | |
download | vaadin-framework-5254061ed4df93d579b114f1fa665712e5458950.tar.gz vaadin-framework-5254061ed4df93d579b114f1fa665712e5458950.zip |
Fix for #3874 - Two click events is sent for a middle click in a layout
svn changeset:10379/svn branch:6.2
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html | 20 | ||||
-rw-r--r-- | tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java | 32 |
2 files changed, 32 insertions, 20 deletions
diff --git a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html index f488eb9a81..28635a9df7 100644 --- a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html +++ b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.html @@ -40,7 +40,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:GridLayout: Click on This is label 1</td> + <td>exact:GridLayout: left left click on This is label 1</td> </tr> <tr> <td>mouseClick</td> @@ -55,7 +55,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:GridLayout: Click on This is tf5</td> + <td>exact:GridLayout: left left click on This is tf5</td> </tr> <tr> <td>mouseClick</td> @@ -70,7 +70,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:GridLayout: Click on <none></td> + <td>exact:GridLayout: left left click on <none></td> </tr> <!--VerticalLayout--> <tr> @@ -86,7 +86,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:VerticalLayout: Click on This is tf6</td> + <td>exact:VerticalLayout: left left click on This is tf6</td> </tr> <tr> <td>mouseClick</td> @@ -101,7 +101,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:VerticalLayout: Click on This is label 3</td> + <td>exact:VerticalLayout: left left click on This is label 3</td> </tr> <!--AbsoluteLayout--> <tr> @@ -122,7 +122,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:AbsoluteLayout: Click on A button with its own click listener</td> + <td>exact:AbsoluteLayout: left left click on A button with its own click listener</td> </tr> <tr> <td>mouseClick</td> @@ -137,7 +137,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:AbsoluteLayout: Click on This is its caption</td> + <td>exact:AbsoluteLayout: left click on This is its caption</td> </tr> <!--CssLayout--> <tr> @@ -168,12 +168,12 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[1]/VLabel[0]</td> - <td>exact:CSSLayout: Click on This is its caption</td> + <td>exact:CSSLayout: left click on This is its caption</td> </tr> <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:CSSLayout: Click on This is its caption</td> + <td>exact:CSSLayout: left click on This is its caption</td> </tr> <tr> <td>click</td> @@ -193,7 +193,7 @@ <tr> <td>assertText</td> <td>vaadin=runcomvaadintestslayoutsTestLayoutClickListeners::/VVerticalLayout[0]/ChildComponentContainer[0]/VVerticalLayout[0]/ChildComponentContainer[0]/VLabel[0]</td> - <td>exact:CSSLayout: Click on A button with its own click listener</td> + <td>exact:CSSLayout: left click on A button with its own click listener</td> </tr> </tbody></table> </body> diff --git a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java index ecda096690..9a7dca7e30 100644 --- a/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java +++ b/tests/src/com/vaadin/tests/layouts/TestLayoutClickListeners.java @@ -105,7 +105,7 @@ public class TestLayoutClickListeners extends AbstractTestCase { al.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { - logLayoutClick("AbsoluteLayout", event.getChildComponent()); + logLayoutClick("AbsoluteLayout", event); } }); @@ -137,7 +137,7 @@ public class TestLayoutClickListeners extends AbstractTestCase { cl.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { - logLayoutClick("CSSLayout", event.getChildComponent()); + logLayoutClick("CSSLayout", event); } }); @@ -160,22 +160,34 @@ public class TestLayoutClickListeners extends AbstractTestCase { gl.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { - logLayoutClick("GridLayout", event.getChildComponent()); + logLayoutClick("GridLayout", event); } }); gl.setRowExpandRatio(3, 1); return wrap(gl, "GridLayout"); } - protected void logLayoutClick(String layout, Component comp) { + protected void logLayoutClick(String layout, LayoutClickEvent event) { String target = "<none>"; - if (comp != null) { - target = comp.getCaption(); - if (target == null && comp instanceof Label) { - target = ((Label) comp).getValue().toString(); + Component component = event.getChildComponent(); + if (component != null) { + target = component.getCaption(); + if (target == null && component instanceof Label) { + target = ((Label) component).getValue().toString(); } } - log.log(layout + ": Click on " + target); + String button = "left"; + if (event.getButton() == event.BUTTON_RIGHT) { + button = "right"; + } else if (event.getButton() == event.BUTTON_MIDDLE) { + button = "middle"; + + } + String type = "click"; + if (event.isDoubleClick()) { + type = "double-click"; + } + log.log(layout + ": " + button + " " + type + " on " + target); } @@ -187,7 +199,7 @@ public class TestLayoutClickListeners extends AbstractTestCase { gl.addListener(new LayoutClickListener() { public void layoutClick(LayoutClickEvent event) { - logLayoutClick("VerticalLayout", event.getChildComponent()); + logLayoutClick("VerticalLayout", event); } }); |