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

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.BaseModelData
All Implemented Interfaces:
ModelData, java.io.Serializable
Direct Known Subclasses:
BaseListLoadConfig, BaseModel, SimpleComboValue, Theme, Time

public class BaseModelData
extends java.lang.Object
implements ModelData, java.io.Serializable

Default ModelData implementation.

See Also:
Serialized Form

Constructor Summary
BaseModelData()
          Creates a new model data instance.
BaseModelData(java.util.Map<java.lang.String,java.lang.Object> properties)
          Creates a new model with the given properties.
 
Method Summary
<X> X
get(java.lang.String property)
          Returns the named property from this model instance.
<X> X
get(java.lang.String property, X valueWhenNull)
          Returns a property value.
 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.
 boolean isAllowNestedValues()
          Returns true if nested values are enabled.
<X> X
remove(java.lang.String property)
          Removes the named property from this model instance.
<X> X
set(java.lang.String property, X value)
          Sets the property and fires an Update event.
 void setAllowNestedValues(boolean allowNestedValues)
          Sets whether nested properties are enabled (defaults to true).
 void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
          Sets the properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseModelData

public BaseModelData()
Creates a new model data instance.


BaseModelData

public BaseModelData(java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new model with the given properties.

Parameters:
properties - the initial properties
Method Detail

get

public <X> X get(java.lang.String property)
Description copied from interface: ModelData
Returns the named property from this model instance.

Specified by:
get in interface ModelData
Parameters:
property - the property name
Returns:
the value

get

public <X> X get(java.lang.String property,
                 X valueWhenNull)
Returns a property value.

Parameters:
property - the property name
valueWhenNull -
Returns:
the value

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
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

isAllowNestedValues

public boolean isAllowNestedValues()
Returns true if nested values are enabled.

Returns:
the nested values state

remove

public <X> X remove(java.lang.String property)
Description copied from interface: ModelData
Removes the named property from this model instance.

Specified by:
remove in interface ModelData
Parameters:
property - the property name
Returns:
the old value for the property

set

public <X> X set(java.lang.String property,
                 X value)
Sets the property and fires an Update event.

Specified by:
set in interface ModelData
Parameters:
property - the property name
value - the property value
Returns:
the old value for the property

setAllowNestedValues

public void setAllowNestedValues(boolean allowNestedValues)
Sets whether nested properties are enabled (defaults to true).

Parameters:
allowNestedValues - true to enable nested properties

setProperties

public void setProperties(java.util.Map<java.lang.String,java.lang.Object> properties)
Sets the properties.

Parameters:
properties - the properties