You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CloseWindowOnEscapeMaximizedButtonFocused.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package com.vaadin.tests.components.window;
  2. import com.vaadin.annotations.Widgetset;
  3. import com.vaadin.server.VaadinRequest;
  4. import com.vaadin.shared.ui.window.WindowMode;
  5. import com.vaadin.tests.components.AbstractTestUI;
  6. import com.vaadin.ui.Button;
  7. import com.vaadin.ui.Label;
  8. import com.vaadin.ui.Window;
  9. @Widgetset("com.vaadin.DefaultWidgetSet")
  10. public class CloseWindowOnEscapeMaximizedButtonFocused extends AbstractTestUI {
  11. @Override
  12. protected void setup(VaadinRequest request) {
  13. Label instructions = new Label("Press Maximise button and then ESC. "
  14. + " Window should be closed");
  15. Button openWindow = new Button("Open Window");
  16. openWindow.setId("openW");
  17. openWindow.addClickListener(e -> {
  18. Window win = new Window("Window test", new Label("Some content"));
  19. win.setWindowMode(WindowMode.NORMAL);
  20. win.setWidth("300px");
  21. win.setHeight("300px");
  22. win.center();
  23. addWindow(win);
  24. });
  25. addComponent(instructions);
  26. addComponent(openWindow);
  27. }
  28. @Override
  29. public String getTestDescription() {
  30. return "A window should be closed after the ESC button is pressed, when a maximize button is focused";
  31. };
  32. @Override
  33. public Integer getTicketNumber() {
  34. return 11838;
  35. };
  36. }