View Javadoc

1   package com.vaadin.data.util;
2   
3   import org.shortbrain.vaadin.container.property.HierarchicalBeanBuilder;
4   
5   /**
6    * An extension of {@link BeanItemContainer} that is {@link com.vaadin.data.Container.Hierarchical}.
7    * 
8    * <p>
9    * Behind the scene it uses {@link ContainerHierarchicalWrapper}.
10   * </p>
11   * 
12   * @author Vincent Demeester <vincent@shortbrain.org>
13   * 
14   * @param <BEANTYPE>
15   *            The type of the Bean
16   * 
17   * @since 0.2.0
18   * 
19   * @see AbstractHierarchicalBeanContainer
20   * @see BeanContainer
21   * @see ContainerHierarchicalWrapper
22   * @see com.vaadin.data.Container.Hierarchical
23   */
24  public class HierarchicalBeanItemContainer<BEANTYPE> extends AbstractHierarchicalBeanContainer<BEANTYPE, BEANTYPE> {
25  
26      private static final long serialVersionUID = 2707281313111154765L;
27  
28      /**
29       * Create a {@link HierarchicalBeanContainer} with the given IDTYPE and BEANTYPE.
30       * 
31       * @param type
32       *            The type of the Bean
33       */
34      public HierarchicalBeanItemContainer(Class<BEANTYPE> type) {
35          super(type, new BeanItemContainer<BEANTYPE>(type));
36      }
37  
38      /**
39       * Create a {@link HierarchicalBeanContainer} with the given IDTYPE and BEANTYPE.
40       * 
41       * @param type
42       *            The type of the Bean
43       * @param hierarchicalBeanBuilder
44       *            The builder for {@link com.vaadin.data.Container.Hierarchical}
45       */
46      public HierarchicalBeanItemContainer(Class<BEANTYPE> type,
47              HierarchicalBeanBuilder<BEANTYPE, BEANTYPE> hierarchicalBeanBuilder) {
48          this(type);
49          setHierarchicalBeanBuilder(hierarchicalBeanBuilder);
50      }
51  
52      @Override
53      public void setBeanIdProperty(Object propertyId) {
54          throw new UnsupportedOperationException("BeanItemContainer always uses an IdentityBeanIdResolver");
55      }
56  
57  }