summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-06-26 15:02:39 +0000
committerJohannes Dahlström <johannes.dahlstrom@vaadin.com>2012-06-26 15:02:39 +0000
commitd4d61d68982b5ce5ff435ab7c8644709cdc5950e (patch)
tree730808d1ce4dd9460e4c4c13d4b42eeeec996f4f /tests
parent556730ab5ae0daefbbc2e077463c68d2081eaec3 (diff)
downloadvaadin-framework-d4d61d68982b5ce5ff435ab7c8644709cdc5950e.tar.gz
vaadin-framework-d4d61d68982b5ce5ff435ab7c8644709cdc5950e.zip
#8193 Listen to RootPanel keydown events to handle shortcut actions from PopupPanel/VOverlay widgets
svn changeset:23977/svn branch:6.8
Diffstat (limited to 'tests')
-rw-r--r--tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java75
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java b/tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
new file mode 100644
index 0000000000..7009d03f77
--- /dev/null
+++ b/tests/testbench/com/vaadin/tests/components/popupview/PopupViewClickShortcut.java
@@ -0,0 +1,75 @@
+package com.vaadin.tests.components.popupview;
+
+import com.vaadin.event.ShortcutAction.KeyCode;
+import com.vaadin.event.ShortcutAction.ModifierKey;
+import com.vaadin.tests.components.TestBase;
+import com.vaadin.tests.util.Log;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Button.ClickEvent;
+import com.vaadin.ui.ComponentContainer;
+import com.vaadin.ui.Layout;
+import com.vaadin.ui.PopupView;
+import com.vaadin.ui.Table;
+import com.vaadin.ui.VerticalLayout;
+import com.vaadin.ui.Window;
+
+public class PopupViewClickShortcut extends TestBase {
+
+ private Window sub = new Window("Table", makeTable("Subwindow", KeyCode.S));
+
+ private Log log = new Log(5);
+
+ @Override
+ protected void setup() {
+ sub.center();
+ getMainWindow().addWindow(sub);
+ addComponent(log);
+ addComponent(new PopupView("Show popup table", makeTable("Popup",
+ KeyCode.P)));
+ addComponent(makeTable("Main window", KeyCode.M));
+ sub.addComponent(new PopupView("Show popup table", makeTable(
+ "Subwindow popup", KeyCode.U)));
+ }
+
+ private ComponentContainer makeTable(final String caption, int keyCode) {
+ final Table t = new Table();
+ t.setSelectable(true);
+ t.setHeight("200px");
+ t.setWidth("200px");
+ t.addContainerProperty("foo", String.class, "foo");
+ for (int i = 0; i < 5; i++) {
+ t.addItem(new String[] { "foo " + i }, i);
+ }
+
+ final Layout l = new VerticalLayout();
+ l.setCaption(caption);
+ l.setWidth(null);
+
+ Button b = new Button("Submit " + caption, new Button.ClickListener() {
+ private int i = 5;
+
+ public void buttonClick(ClickEvent event) {
+ log.log("Submitted from "
+ + event.getButton().getParent().getCaption());
+ t.addItem(new String[] { "added " + i++ }, i);
+ }
+ });
+ b.setClickShortcut(keyCode, ModifierKey.ALT);
+
+ l.addComponent(t);
+ l.addComponent(b);
+
+ return l;
+ }
+
+ @Override
+ protected String getDescription() {
+ return "Enter ClickShortcut does not work with PopupView";
+ }
+
+ @Override
+ protected Integer getTicketNumber() {
+ return 8193;
+ }
+
+}