com.extjs.gxt.ui.client.data
Class BeanModel

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.BaseModelData
      extended by com.extjs.gxt.ui.client.data.BaseModel
          extended by com.extjs.gxt.ui.client.data.BeanModel
All Implemented Interfaces:
ChangeEventSource, Model, ModelData, java.io.Serializable

public class BeanModel
extends BaseModel

A ModelData instance that wraps a bean. BeanModels cannot be instantiated directly, rather, they are returned by BeanModelFactory.

Nested beans are supported when creating BeanModel instances with limited support for nested lists of beans. Any child lists must be defined with java.util.List and must be paramertized with a BeanModelTag class or subclass.

When working with bean models, avoid setting beans as values, rather, set the wrapping bean model instance.

See Also:
BeanModelFactory, Serialized Form

Field Summary
protected  java.lang.Object bean
           
protected  java.util.List<java.lang.String> beanProperties
           
protected  java.util.Map<java.lang.String,BeanModel> nestedModels
           
 
Fields inherited from class com.extjs.gxt.ui.client.data.BaseModel
changeEventSupport
 
Fields inherited from class com.extjs.gxt.ui.client.data.BaseModelData
allowNestedValues, map
 
Fields inherited from interface com.extjs.gxt.ui.client.data.ChangeEventSource
Add, Remove, Update
 
Constructor Summary
protected BeanModel()
           
 
Method Summary
<X> X
getBean()
          Returns the bean.
 java.util.Map<java.lang.String,java.lang.Object> getProperties()
          Returns the model's properties and values as a map.
 java.util.Collection<java.lang.String> getPropertyNames()
          Returns an collection of the model's property names.
protected  java.lang.Object processValue(java.lang.Object value)
           
protected  void setBean(java.lang.Object bean)
          Sets the bean.
 java.lang.String toString()
           
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseModel
addChangeListener, addChangeListener, fireEvent, fireEvent, isSilent, notify, notifyPropertyChanged, remove, removeChangeListener, removeChangeListeners, set, setSilent
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseModelData
get, get, isAllowNestedValues, setAllowNestedValues, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.extjs.gxt.ui.client.data.ModelData
get
 

Field Detail

bean

protected transient java.lang.Object bean

nestedModels

protected java.util.Map<java.lang.String,BeanModel> nestedModels

beanProperties

protected java.util.List<java.lang.String> beanProperties
Constructor Detail

BeanModel

protected BeanModel()
Method Detail

getBean

public <X> X getBean()
Returns the bean.

Returns:
the bean

getProperties

public java.util.Map<java.lang.String,java.lang.Object> getProperties()
Description copied from interface: ModelData
Returns the model's properties and values as a map.

Changes to the returned collection should not mutate this model instance.

Specified by:
getProperties in interface ModelData
Overrides:
getProperties in class BaseModelData
Returns:
the properties and values

getPropertyNames

public java.util.Collection<java.lang.String> getPropertyNames()
Description copied from interface: ModelData
Returns an collection of the model's property names.

The collection should be a snapshot of the property names that the model represents.

Changes to the returned collection should not mutate this model instance.

Specified by:
getPropertyNames in interface ModelData
Overrides:
getPropertyNames in class BaseModelData

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

processValue

protected java.lang.Object processValue(java.lang.Object value)

setBean

protected void setBean(java.lang.Object bean)
Sets the bean.

Parameters:
bean - the bean