diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket2365.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/tickets/Ticket2365.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2365.java b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java new file mode 100644 index 0000000000..b191901356 --- /dev/null +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2365.java @@ -0,0 +1,60 @@ +package com.vaadin.tests.tickets; + +import com.vaadin.Application; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Panel; +import com.vaadin.ui.UI.LegacyWindow; +import com.vaadin.ui.VerticalLayout; + +public class Ticket2365 extends Application.LegacyApplication { + + @Override + public void init() { + + final LegacyWindow mainWin = new LegacyWindow(getClass() + .getSimpleName()); + setMainWindow(mainWin); + + VerticalLayout lo = new VerticalLayout(); + lo.setSizeFull(); + mainWin.setContent(lo); + + final Panel p = createMultilevelPanel(5, (Panel) null); + + Button b = new Button("Toggle parent level size"); + lo.addComponent(b); + b.addListener(new Button.ClickListener() { + @Override + public void buttonClick(ClickEvent event) { + if (p.getWidth() > 0) { + p.setSizeUndefined(); + } else { + p.setSizeFull(); + } + } + }); + + lo.addComponent(p); + + lo.setExpandRatio(p, 1); + + } + + private Panel createMultilevelPanel(int i, Panel panel) { + if (panel == null) { + panel = new Panel("Panel level " + i); + panel.setSizeFull(); + panel.getContent().setSizeFull(); + } + Panel p = new Panel("Panel level " + i--); + p.getContent().setSizeFull(); + p.setSizeFull(); + panel.addComponent(p); + if (i > 0) { + createMultilevelPanel(i, p); + } + return panel; + } + +} |