--- /dev/null
+package com.vaadin.tests.components.form;\r
+\r
+import com.vaadin.data.Item;\r
+import com.vaadin.data.util.BeanItem;\r
+import com.vaadin.tests.components.TestBase;\r
+import com.vaadin.ui.Form;\r
+import com.vaadin.ui.HorizontalLayout;\r
+\r
+public class FormFieldCaptions extends TestBase {\r
+\r
+ @Override\r
+ protected void setup() {\r
+ // Method 1\r
+ Form form1 = new Form();\r
+ Item item1 = createItem();\r
+ for (Object propertyId : item1.getItemPropertyIds()) {\r
+ form1\r
+ .addItemProperty(propertyId, item1\r
+ .getItemProperty(propertyId));\r
+ }\r
+\r
+ // Method 2\r
+\r
+ Form form2 = new Form();\r
+ Item item2 = createItem();\r
+ form2.setItemDataSource(item2);\r
+\r
+ // Layout\r
+ HorizontalLayout hl = new HorizontalLayout();\r
+ hl.addComponent(form1);\r
+ hl.addComponent(form2);\r
+\r
+ addComponent(hl);\r
+ }\r
+\r
+ private Item createItem() {\r
+ return new BeanItem<Person>(new Person("John", "Doe", 38));\r
+ }\r
+\r
+ public class Person {\r
+ private String firstName;\r
+ private String lastName;\r
+\r
+ public Person(String firstName, String lastName, int age) {\r
+ super();\r
+ this.firstName = firstName;\r
+ this.lastName = lastName;\r
+ this.age = age;\r
+ }\r
+\r
+ public String getFirstName() {\r
+ return firstName;\r
+ }\r
+\r
+ public void setFirstName(String firstName) {\r
+ this.firstName = firstName;\r
+ }\r
+\r
+ public String getLastName() {\r
+ return lastName;\r
+ }\r
+\r
+ public void setLastName(String lastName) {\r
+ this.lastName = lastName;\r
+ }\r
+\r
+ public int getAge() {\r
+ return age;\r
+ }\r
+\r
+ public void setAge(int age) {\r
+ this.age = age;\r
+ }\r
+\r
+ private int age;\r
+ }\r
+\r
+ @Override\r
+ protected String getDescription() {\r
+ return "The two forms generated using different methods should have the same captions for all fields";\r
+ }\r
+\r
+ @Override\r
+ protected Integer getTicketNumber() {\r
+ return 3554;\r
+ }\r
+\r
+}\r