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

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.BaseModelData
      extended by com.extjs.gxt.ui.client.data.BaseModel
All Implemented Interfaces:
ChangeEventSource, Model, ModelData, java.io.Serializable
Direct Known Subclasses:
AbstractAxis, BaseTreeModel, BeanModel, ChartConfig, ChartModel, DataConfig, Keys, Label, Legend, LineChart.LineStyle, RadarAxis.RadarLabels, Text, ToolTip

public class BaseModel
extends BaseModelData
implements Model, java.io.Serializable

Models are generic data structures that notify listeners when changed. The structure allows a form of 'introspection' as all property names and values can be queried and retrieved at runtime.

All events fired by the model will bubble to all parents.

Model objects implement Serializable and can therefore be used with GWT RPC. A model's children are not marked transient and will be passed in remote procedure calls.

Events:
Model.Add : (source, item)
Fires after the button is selected.
Model.Insert : (source, item)
Fires after the button is selected.
Model.Update : (source, item)
Fires after the button is selected.

See Also:
ChangeListener, Serializable, Serialized Form

Field Summary
protected  ChangeEventSupport 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
BaseModel()
          Creates a new base model.
BaseModel(java.util.Map<java.lang.String,java.lang.Object> properties)
          Creates a new base model.
 
Method Summary
 void addChangeListener(ChangeListener... listener)
          Adds a listener to receive change events.
 void addChangeListener(java.util.List<ChangeListener> listeners)
          Adds the listeners to receive change events.
protected  void fireEvent(int type)
           
protected  void fireEvent(int type, Model item)
           
 boolean isSilent()
          Returns true if change events are disabled.
 void notify(ChangeEvent evt)
          Notifies listeners of the given change event.
protected  void notifyPropertyChanged(java.lang.String name, java.lang.Object value, java.lang.Object oldValue)
           
<X> X
remove(java.lang.String name)
          Removes the named property from this model instance.
 void removeChangeListener(ChangeListener... listener)
          Removes a previously added change listener.
 void removeChangeListeners()
          Removes all change listeners.
<X> X
set(java.lang.String name, X value)
          Sets the property and fires an Update event.
 void setSilent(boolean silent)
          Sets whether change events are fired.
 
Methods inherited from class com.extjs.gxt.ui.client.data.BaseModelData
get, get, getProperties, getPropertyNames, isAllowNestedValues, setAllowNestedValues, setProperties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.extjs.gxt.ui.client.data.ModelData
get, getProperties, getPropertyNames
 

Field Detail

changeEventSupport

protected transient ChangeEventSupport changeEventSupport
Constructor Detail

BaseModel

public BaseModel()
Creates a new base model.


BaseModel

public BaseModel(java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new base model.

Parameters:
properties - the initial values
Method Detail

addChangeListener

public void addChangeListener(ChangeListener... listener)
Adds a listener to receive change events.

Specified by:
addChangeListener in interface ChangeEventSource
Parameters:
listener - the listener to be added

addChangeListener

public void addChangeListener(java.util.List<ChangeListener> listeners)
Adds the listeners to receive change events.

Parameters:
listeners - the listeners to add

isSilent

public boolean isSilent()
Returns true if change events are disabled.

Returns:
true if silent

notify

public void notify(ChangeEvent evt)
Description copied from interface: ChangeEventSource
Notifies listeners of the given change event.

Specified by:
notify in interface ChangeEventSource
Parameters:
evt - the change event

remove

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

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

removeChangeListener

public void removeChangeListener(ChangeListener... listener)
Removes a previously added change listener.

Specified by:
removeChangeListener in interface ChangeEventSource
Parameters:
listener - the listener to be removed

removeChangeListeners

public void removeChangeListeners()
Description copied from interface: ChangeEventSource
Removes all change listeners.

Specified by:
removeChangeListeners in interface ChangeEventSource

set

public <X> X set(java.lang.String name,
                 X value)
Description copied from class: BaseModelData
Sets the property and fires an Update event.

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

setSilent

public void setSilent(boolean silent)
Description copied from interface: ChangeEventSource
Sets whether change events are fired.

Specified by:
setSilent in interface ChangeEventSource
Parameters:
silent - true to disable change event, otherwise false

fireEvent

protected void fireEvent(int type)

fireEvent

protected void fireEvent(int type,
                         Model item)

notifyPropertyChanged

protected void notifyPropertyChanged(java.lang.String name,
                                     java.lang.Object value,
                                     java.lang.Object oldValue)