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.

FormOneToMany.java 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.vaadin.tests.fields;
  2. import com.vaadin.data.util.BeanItem;
  3. import com.vaadin.tests.components.TestBase;
  4. import com.vaadin.tests.util.Millionaire;
  5. import com.vaadin.ui.Form;
  6. public class FormOneToMany extends TestBase {
  7. @Override
  8. protected void setup() {
  9. final Form form = new Form();
  10. addComponent(form);
  11. form.setItemDataSource(createMillionaireItem());
  12. // TODO support adding, editing and removing secondary addresses
  13. }
  14. protected BeanItem<Millionaire> createMillionaireItem() {
  15. Millionaire person = new Millionaire("First", "Last", "foo@vaadin.com",
  16. "02-111 2222", "Ruukinkatu 2-4", 20540, "Turku");
  17. BeanItem<Millionaire> item = new BeanItem<Millionaire>(person);
  18. // add nested properties from address
  19. item.expandProperty("address");
  20. // TODO for now, hide secondary residences
  21. item.removeItemProperty("secondaryResidences");
  22. return item;
  23. }
  24. @Override
  25. protected String getDescription() {
  26. return "Form with an editable list of sub-objects.";
  27. }
  28. @Override
  29. protected Integer getTicketNumber() {
  30. return null;
  31. }
  32. }