diff options
author | Matti Tahvonen <matti.tahvonen@itmill.com> | 2008-12-18 09:08:37 +0000 |
---|---|---|
committer | Matti Tahvonen <matti.tahvonen@itmill.com> | 2008-12-18 09:08:37 +0000 |
commit | dd3b7214d125be023553858a72a4ebc29c89dfd9 (patch) | |
tree | 555bcb22ef2da15651c918f82244181f4d2ac14e /src/com/itmill/toolkit/tests/tickets | |
parent | 4ec3a68f79a4c436b6b2d1cbd96613fae9f849f9 (diff) | |
download | vaadin-framework-dd3b7214d125be023553858a72a4ebc29c89dfd9.tar.gz vaadin-framework-dd3b7214d125be023553858a72a4ebc29c89dfd9.zip |
added test case
svn changeset:6258/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/tests/tickets')
-rw-r--r-- | src/com/itmill/toolkit/tests/tickets/Ticket2365.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/com/itmill/toolkit/tests/tickets/Ticket2365.java b/src/com/itmill/toolkit/tests/tickets/Ticket2365.java new file mode 100644 index 0000000000..c37d5a8495 --- /dev/null +++ b/src/com/itmill/toolkit/tests/tickets/Ticket2365.java @@ -0,0 +1,57 @@ +package com.itmill.toolkit.tests.tickets; + +import com.itmill.toolkit.Application; +import com.itmill.toolkit.ui.Button; +import com.itmill.toolkit.ui.Panel; +import com.itmill.toolkit.ui.VerticalLayout; +import com.itmill.toolkit.ui.Window; +import com.itmill.toolkit.ui.Button.ClickEvent; + +public class Ticket2365 extends Application { + + public void init() { + + final Window mainWin = new Window(getClass().getSimpleName()); + setMainWindow(mainWin); + + VerticalLayout lo = new VerticalLayout(); + lo.setSizeFull(); + mainWin.setLayout(lo); + + final Panel p = createMultilevelPanel(5, (Panel) null); + + Button b = new Button("Toggle parent level size"); + lo.addComponent(b); + b.addListener(new Button.ClickListener() { + 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.getLayout().setSizeFull(); + } + Panel p = new Panel("Panel level " + i--); + p.getLayout().setSizeFull(); + p.setSizeFull(); + panel.addComponent(p); + if (i > 0) { + createMultilevelPanel(i, p); + } + return panel; + } + +} |