|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.extjs.gxt.ui.client.store.Record
public class Record
Records wrap model instances and provide specialized editing features, including modification tracking and editing capabilities.
Rather than editing a model from a store directly, record can be used to "buffer" any changes to the model. Changes can be "committed" or "rejected" at both the record and store level. Record instances can be retrieved from the container store by calling @linkStore.getRecord(ModelData)
. To get a list of modified records call @link
Store.getModifiedRecords()
.
Code snippet:
Record record = store.getRecord(store.getAt(0)); record.set("foo", "bar"); List<Record> modified = store.getModifiedRecords(); for (Record r : modified) { } store.commitChanges();
Nested Class Summary | |
---|---|
static class |
Record.RecordUpdate
Update enumeration. |
Field Summary | |
---|---|
protected ModelData |
model
The wrapped model. |
protected RpcMap |
modified
Contains a map of all fields that have been modified and their original values or null if no fields have been modified. |
Constructor Summary | |
---|---|
Record(java.util.Map<java.lang.String,java.lang.Object> properties)
Creates a new record, wrapping a new model data instance. |
|
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. |
protected void |
clearError()
|
void |
commit(boolean silent)
Usually called by the ListStore which owns the Record. |
void |
endEdit()
End an edit. |
java.lang.Object |
get(java.lang.String property)
Returns the value for the 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 committed. |
ModelData |
getModel()
Returns the wrapped model instance. |
java.util.Collection<java.lang.String> |
getPropertyNames()
|
protected boolean |
hasError()
|
boolean |
isDirty()
Returns true if the record has uncommitted changes. |
boolean |
isEditing()
Returns true if the record is being updated. |
boolean |
isModified(java.lang.String property)
Returns true if the field passed has been modified since the load or last commit. |
boolean |
isValid(java.lang.String property)
Returns true if the record is valid. |
protected void |
join(Store store)
|
void |
reject(boolean silent)
Usually called by the ListStore which owns the Record. |
void |
set(java.lang.String name,
java.lang.Object value)
Set the named field to the specified value. |
void |
setDirty(boolean dirty)
Manually sets the dirty state of the record. |
void |
setValid(java.lang.String property,
boolean valid)
Sets whether the record is valid (defaults to true). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected RpcMap modified
protected ModelData model
Constructor Detail |
---|
public Record(java.util.Map<java.lang.String,java.lang.Object> properties)
properties
- the initial valuespublic Record(ModelData wrappedModel)
wrappedModel
- the modelMethod Detail |
---|
public void beginEdit()
public void cancelEdit()
public void commit(boolean silent)
ListStore
which owns the Record. Commits all
changes made to the Record since either creation, or the last commit
operation.
silent
- true to skip notification of the owning store of the changepublic void endEdit()
public java.lang.Object get(java.lang.String property)
property
- the property name
public java.util.Map<java.lang.String,java.lang.Object> getChanges()
public ModelData getModel()
public java.util.Collection<java.lang.String> getPropertyNames()
public boolean isDirty()
public boolean isEditing()
public boolean isModified(java.lang.String property)
property
- the property name
public boolean isValid(java.lang.String property)
property
- the property name
public void reject(boolean silent)
ListStore
which owns the Record. Rejects all
changes made to the Record since either creation, or the last commit
operation. Modified fields are reverted to their original values.
silent
- true to skip notification of the owning store of the changepublic void set(java.lang.String name, java.lang.Object value)
name
- the name of the field to setvalue
- the value of the field to setpublic void setDirty(boolean dirty)
dirty
- the dirty statepublic void setValid(java.lang.String property, boolean valid)
property
- the property namevalid
- true if valid, false otherwiseprotected void clearError()
protected boolean hasError()
protected void join(Store store)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |