Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

HierarchyChangeForRemovedComponentContainers.java 1.6KB

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