com.extjs.gxt.ui.client.store
Class Record

java.lang.Object
  extended by com.extjs.gxt.ui.client.store.Record

public class Record
extends java.lang.Object

Records wrap model instances and provide specialized editing features, including modification tracking and editing capabilities.


Nested Class Summary
static class Record.RecordUpdate
          Update enumeration.
 
Constructor Summary
Record(java.util.Map<java.lang.String,java.lang.Object> properties)
          Creates a new record.
Record(ModelData wrappedModel)
          Creates a new record.
 
Method Summary
 void beginEdit()
          Begin an edit.
 void cancelEdit()
          Cancels all changes made in the current edit operation.
 void endEdit()
          End an edit.
 java.lang.Object get(java.lang.String property)
           
 java.util.Map<java.lang.String,java.lang.Object> getChanges()
          Gets a map of only the fields that have been modified since this record was created or commited.
 ModelData getModel()
          Returns the wrapped model instance.
 java.util.Collection<java.lang.String> getPropertyNames()
           
 boolean isDirty()
          Returns true if the record has uncommitted changes.
 java.lang.Object remove(java.lang.String property)
          Removes a field.
 java.lang.Object set(java.lang.String name, java.lang.Object value)
          Set the named field to the specified value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Record

public Record(java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new record.

Parameters:
properties - the initial values

Record

public Record(ModelData wrappedModel)
Creates a new record.

Parameters:
wrappedModel - the model
Method Detail

beginEdit

public void beginEdit()
Begin an edit. While in edit mode, no events are relayed to the containing store. Succesive calls to beginEdit without calling endEdit or cancelEdit are no-ops


cancelEdit

public void cancelEdit()
Cancels all changes made in the current edit operation.


endEdit

public void endEdit()
End an edit. If any data was modified, the containing store is notified.


get

public java.lang.Object get(java.lang.String property)

getChanges

public java.util.Map<java.lang.String,java.lang.Object> getChanges()
Gets a map of only the fields that have been modified since this record was created or commited. Any removed properties will not be in the returned map

Returns:
the changed fields

getModel

public ModelData getModel()
Returns the wrapped model instance.

Returns:
the model

getPropertyNames

public java.util.Collection<java.lang.String> getPropertyNames()

isDirty

public boolean isDirty()
Returns true if the record has uncommitted changes.

Returns:
the dirty state

remove

public java.lang.Object remove(java.lang.String property)
Removes a field.

Parameters:
property - the name of the field to remove

set

public java.lang.Object set(java.lang.String name,
                            java.lang.Object value)
Set the named field to the specified value.

Parameters:
name - the name of the field to set
value - the value of the field to set