com.vaadin.data.util
Class BeanItem<BT>

java.lang.Object
  extended by com.vaadin.data.util.PropertysetItem
      extended by com.vaadin.data.util.BeanItem<BT>
All Implemented Interfaces:
Item, Item.PropertySetChangeNotifier, Serializable, Cloneable

public class BeanItem<BT>
extends PropertysetItem

A wrapper class for adding the Item interface to any Java Bean.

Since:
3.0
Version:
7.0.0.alpha3
Author:
Vaadin Ltd.
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.data.Item
Item.Editor, Item.PropertySetChangeListener, Item.PropertySetChangeNotifier, Item.Viewer
 
Constructor Summary
BeanItem(BT bean)
           Creates a new instance of BeanItem and adds all properties of a Java Bean to it.
BeanItem(BT bean, Collection<?> propertyIds)
           Creates a new instance of BeanItem and adds all listed properties of a Java Bean to it - in specified order.
BeanItem(BT bean, String[] propertyIds)
           Creates a new instance of BeanItem and adds all listed properties of a Java Bean to it - in specified order.
 
Method Summary
 void addNestedProperty(String nestedPropertyId)
          Adds a nested property to the item.
 void expandProperty(String propertyId, String... subPropertyIds)
          Expands nested bean properties by replacing a top-level property with some or all of its sub-properties.
 BT getBean()
          Gets the underlying JavaBean object.
 
Methods inherited from class com.vaadin.data.util.PropertysetItem
addItemProperty, addListener, clone, equals, getItemProperty, getItemPropertyIds, getListeners, hashCode, removeItemProperty, removeListener, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanItem

public BeanItem(BT bean)

Creates a new instance of BeanItem and adds all properties of a Java Bean to it. The properties are identified by their respective bean names.

Note : This version only supports introspectable bean properties and their getter and setter methods. Stand-alone is and are methods are not supported.

Parameters:
bean - the Java Bean to copy properties from.

BeanItem

public BeanItem(BT bean,
                Collection<?> propertyIds)

Creates a new instance of BeanItem and adds all listed properties of a Java Bean to it - in specified order. The properties are identified by their respective bean names.

Note : This version only supports introspectable bean properties and their getter and setter methods. Stand-alone is and are methods are not supported.

Parameters:
bean - the Java Bean to copy properties from.
propertyIds - id of the property.

BeanItem

public BeanItem(BT bean,
                String[] propertyIds)

Creates a new instance of BeanItem and adds all listed properties of a Java Bean to it - in specified order. The properties are identified by their respective bean names.

Note : This version only supports introspectable bean properties and their getter and setter methods. Stand-alone is and are methods are not supported.

Parameters:
bean - the Java Bean to copy properties from.
propertyIds - ids of the properties.
Method Detail

expandProperty

public void expandProperty(String propertyId,
                           String... subPropertyIds)
Expands nested bean properties by replacing a top-level property with some or all of its sub-properties. The expansion is not recursive.

Parameters:
propertyId - property id for the property whose sub-properties are to be expanded,
subPropertyIds - sub-properties to expand, all sub-properties are expanded if not specified

addNestedProperty

public void addNestedProperty(String nestedPropertyId)
Adds a nested property to the item.

Parameters:
nestedPropertyId - property id to add. This property must not exist in the item already and must of of form "field1.field2" where field2 is a field in the object referenced to by field1

getBean

public BT getBean()
Gets the underlying JavaBean object.

Returns:
the bean object.


Copyright © 2000-2011 Vaadin Ltd. All Rights Reserved.