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.

RepaintWindowContents.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.vaadin.tests.components.window;
  2. import com.vaadin.server.VaadinRequest;
  3. import com.vaadin.tests.components.AbstractReindeerTestUI;
  4. import com.vaadin.ui.Button;
  5. import com.vaadin.ui.Layout;
  6. import com.vaadin.ui.VerticalLayout;
  7. import com.vaadin.ui.Window;
  8. public class RepaintWindowContents extends AbstractReindeerTestUI {
  9. private static final long serialVersionUID = 1L;
  10. @SuppressWarnings("serial")
  11. @Override
  12. protected void setup(VaadinRequest request) {
  13. final Window window = new Window("Test window");
  14. addWindow(window);
  15. final Layout layout1 = new VerticalLayout();
  16. Button button1 = new Button("Button 1");
  17. layout1.addComponent(button1);
  18. final Layout layout2 = new VerticalLayout();
  19. Button button2 = new Button("Button 2");
  20. layout2.addComponent(button2);
  21. window.setContent(layout1);
  22. button1.addClickListener(event -> window.setContent(layout2));
  23. button2.addClickListener(event -> window.setContent(layout1));
  24. }
  25. @Override
  26. protected String getTestDescription() {
  27. return "Clicking the button switches the content between content1 and content2";
  28. }
  29. @Override
  30. protected Integer getTicketNumber() {
  31. return 8832;
  32. }
  33. }