diff options
Diffstat (limited to 'uitest/src/com/vaadin/tests/tickets/Ticket2244.java')
-rw-r--r-- | uitest/src/com/vaadin/tests/tickets/Ticket2244.java | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/uitest/src/com/vaadin/tests/tickets/Ticket2244.java b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java new file mode 100644 index 0000000000..495e3de26a --- /dev/null +++ b/uitest/src/com/vaadin/tests/tickets/Ticket2244.java @@ -0,0 +1,130 @@ +package com.vaadin.tests.tickets; + +import com.vaadin.Application; +import com.vaadin.data.util.BeanItem; +import com.vaadin.ui.Button; +import com.vaadin.ui.Button.ClickEvent; +import com.vaadin.ui.Form; +import com.vaadin.ui.FormLayout; +import com.vaadin.ui.GridLayout; +import com.vaadin.ui.Label; +import com.vaadin.ui.UI.LegacyWindow; + +public class Ticket2244 extends Application.LegacyApplication { + + Form form; + + @Override + public void init() { + LegacyWindow w = new LegacyWindow(getClass().getSimpleName()); + setMainWindow(w); + + GridLayout gl = new GridLayout(3, 3); + gl.setSpacing(true); + gl.addComponent(new Label("Before form")); + gl.newLine(); + + form = new Form(gl); + form.setItemDataSource(new BeanItem<MyBean>(new MyBean())); + + gl.addComponent(new Label("After form")); + + w.addComponent(form); + + w.addComponent(new Button("new item", new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + form.setItemDataSource(new BeanItem<MyBean>(new MyBean())); + + } + + })); + w.addComponent(new Button("new bigger item", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + form.setItemDataSource(new BeanItem<MyBean>( + new MyBiggerBean())); + + } + + })); + w.addComponent(new Button("new grid layout", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + form.setLayout(new GridLayout()); + + } + + })); + w.addComponent(new Button("new form layout", + new Button.ClickListener() { + + @Override + public void buttonClick(ClickEvent event) { + form.setLayout(new FormLayout()); + + } + + })); + + } + + public class MyBean { + String firstname; + String lastname; + String password; + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + } + + public class MyBiggerBean extends MyBean { + String address; + String phone; + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + } + +} |