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.

HierarchyChangeForRemovedComponentContainers.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.vaadin.tests.components;
  2. import com.vaadin.ui.Button;
  3. import com.vaadin.ui.HorizontalLayout;
  4. import com.vaadin.ui.VerticalLayout;
  5. public class HierarchyChangeForRemovedComponentContainers extends TestBase {
  6. private HorizontalLayout mainContent;
  7. private VerticalLayout lo2;
  8. @Override
  9. protected void setup() {
  10. mainContent = new HorizontalLayout();
  11. mainContent.setSizeFull();
  12. lo2 = new VerticalLayout();
  13. Button button1 = new Button("asdasd1");
  14. button1.setHeight("90%");
  15. Button button2 = new Button("asdasd2");
  16. button2.setHeight("90%");
  17. lo2.addComponent(button1);
  18. lo2.addComponent(button2);
  19. compose();
  20. addComponent(
  21. new Button("Replace layout with button", event -> compose2()));
  22. }
  23. private void compose() {
  24. getLayout().removeAllComponents();
  25. getLayout().addComponent(mainContent);
  26. mainContent.addComponent(lo2);
  27. System.out.println("composed");
  28. }
  29. private void compose2() {
  30. getLayout().removeAllComponents();
  31. getLayout().addComponent(lo2);
  32. }
  33. @Override
  34. protected String getDescription() {
  35. return "HierarchyChange events should be triggered for removed layouts";
  36. }
  37. @Override
  38. protected Integer getTicketNumber() {
  39. return 9815;
  40. }
  41. }