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.

SubWindowWithUndefinedHeight.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package com.vaadin.tests.components.window;
  2. import com.vaadin.tests.components.TestBase;
  3. import com.vaadin.ui.Button;
  4. import com.vaadin.ui.TabSheet;
  5. import com.vaadin.ui.VerticalLayout;
  6. import com.vaadin.ui.Window;
  7. import com.vaadin.v7.ui.Table;
  8. public class SubWindowWithUndefinedHeight extends TestBase {
  9. @Override
  10. protected String getDescription() {
  11. return "Setting subwindow height to undefined after initial rendering does not update visual height";
  12. }
  13. @Override
  14. protected Integer getTicketNumber() {
  15. return 7916;
  16. }
  17. @Override
  18. protected void setup() {
  19. final VerticalLayout layout = new VerticalLayout();
  20. layout.setMargin(true);
  21. final Window subwindow = new Window("subwindow", layout);
  22. subwindow.center();
  23. subwindow.setSizeUndefined();
  24. layout.setSizeUndefined();
  25. final Button tabButton = new Button("A button");
  26. tabButton.setCaption("Tab 1");
  27. tabButton.setWidth("200px");
  28. final Table table = new Table();
  29. table.setCaption("tab 2");
  30. table.setWidth("100%");
  31. table.setHeight("100%");
  32. final TabSheet tabsheet = new TabSheet();
  33. tabsheet.addComponent(tabButton);
  34. tabsheet.addComponent(table);
  35. tabsheet.addSelectedTabChangeListener(
  36. new TabSheet.SelectedTabChangeListener() {
  37. @Override
  38. public void selectedTabChange(
  39. TabSheet.SelectedTabChangeEvent event) {
  40. if (tabsheet.getSelectedTab() == tabButton) {
  41. tabsheet.setSizeUndefined();
  42. layout.setSizeUndefined();
  43. subwindow.setSizeUndefined();
  44. } else if (tabsheet.getSelectedTab() == table) {
  45. subwindow.setWidth("500px");
  46. subwindow.setHeight("500px");
  47. layout.setSizeFull();
  48. tabsheet.setSizeFull();
  49. }
  50. }
  51. });
  52. layout.addComponent(tabsheet);
  53. Button button = new Button("click me",
  54. event -> getMainWindow().addWindow(subwindow));
  55. getMainWindow().addComponent(button);
  56. }
  57. }