package org.vaadin.mcont.demo.data;

import com.vaadin.data.util.ExtensibleBeanContainer;

public class DemoContainer extends ExtensibleBeanContainer {

    public DemoContainer() {
        super(Person.class, Employee.class, Child.class);

        addBean("person1", new Person("person1"));
        addBean("employee1", new Employee("employee1", "employer1"));
        addBean("child1", new Child("child1", "rubber duck"));
    }

}

@@ -30,16 +30,54 @@
 .data;%0A%0A
+import com.vaadin.data.util.BeanItem;%0A
 import c
@@ -180,16 +180,32 @@
 ontainer
+%3CString, Person%3E
  %7B%0A%0A    
@@ -287,16 +287,24 @@
 class);%0A
+        
 %0A       
@@ -308,80 +308,178 @@
     
-add
+set
 Bean
-(%22person1%22, new Person(%22person1%22));%0A        addBean(%22employee1%22, 
+IdProperty(%22name%22);%0A%0A        // optimized loop%0A        for (int i=1; i %3C= 1000; ++i) %7B%0A            addPerson(new Person(%22person%22+i), false);%0A            addPerson(
 new 
@@ -496,18 +496,19 @@
 employee
-1
 %22
++i
 , %22emplo
@@ -514,22 +514,33 @@
 oyer
-1%22));%0A
+%22+i), false);%0A   
         
 addB
@@ -539,60 +539,787 @@
     
+ 
 add
-Bean(%22child1%22, new Child(%22child1%22, %22rubber duck%22)
+Person(new Child(%22child%22+i, %22rubber duck%22), false);%0A        %7D%0A        %0A        fireItemSetChange();%0A    %7D%0A    %0A    /**%0A%09 * Add a Person bean, optionally disabling filtering of the container after%0A%09 * adding the item to better support batched operations.%0A%09 * %0A%09 * @param person Person bean%0A%09 * @param filter%0A%09 *            true to perform filtering after adding, false to skip filtering%0A%09 * @return%0A%09 */%0A    protected BeanItem%3CPerson%3E addPerson(Person person, boolean filter) %7B%0A        String itemId = resolveBeanId(person);%0A        if (itemId == null) %7B%0A            throw new IllegalArgumentException(%0A                    %22Resolved identifier for a bean must not be null%22);%0A        %7D%0A%09%09return (BeanItem%3CPerson%3E) internalAddItemAtEnd(itemId,%0A%09%09%09%09createBeanItem(person), filter
 );%0A 

Update demo, optimized batched adding of multiple items