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

java.lang.Object
  extended by com.extjs.gxt.ui.client.data.ModelType

public class ModelType
extends java.lang.Object

Describes the fields and structure of a Model. Used by DataReaders when parsing raw data.


Constructor Summary
ModelType()
          Creates a new instance.
 
Method Summary
 void addField(DataField field)
          Adds a field to the model.
 void addField(java.lang.String name)
          Adds a field to the model.
 void addField(java.lang.String name, java.lang.String map)
          Adds a field to the model.
 DataField getField(int index)
          Returns the field at the given index or null if the index is out of bounds.
 DataField getField(java.lang.String name)
          Returns the field with the given name.
 int getFieldCount()
          Returns the number of fields.
 java.lang.String getRecordName()
          Returns the record name.
 java.lang.String getRoot()
          Returns the root name.
 java.lang.String getTotalName()
          Returns the total name.
 void setRecordName(java.lang.String recordName)
          Sets the record name.
 void setRoot(java.lang.String root)
          Sets the root element name.
 void setTotalName(java.lang.String totalName)
          Sets name of the property that contains the 'total number of records' value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelType

public ModelType()
Creates a new instance.

Method Detail

addField

public void addField(DataField field)
Adds a field to the model.

Parameters:
field - the field to be added

addField

public void addField(java.lang.String name)
Adds a field to the model.

Parameters:
name - the field name

addField

public void addField(java.lang.String name,
                     java.lang.String map)
Adds a field to the model.

Parameters:
name - the field name
map - the map name

getField

public DataField getField(int index)
Returns the field at the given index or null if the index is out of bounds.

Parameters:
index - the index of the field to return
Returns:
the field at the given index

getField

public DataField getField(java.lang.String name)
Returns the field with the given name.

Parameters:
name - the name of the field to return
Returns:
the field with the given name of null if no match

getFieldCount

public int getFieldCount()
Returns the number of fields.

Returns:
the field count

getRecordName

public java.lang.String getRecordName()
Returns the record name.

Returns:
the record name

getRoot

public java.lang.String getRoot()
Returns the root name.

Returns:
the root name

getTotalName

public java.lang.String getTotalName()
Returns the total name.

Returns:
the total name

setRecordName

public void setRecordName(java.lang.String recordName)
Sets the record name.

Parameters:
recordName - the record name

setRoot

public void setRoot(java.lang.String root)
Sets the root element name. When used by JsonReader, the root is the name of the property with the array of data. When used by XmlReader, the root is the name of the element in which the total count will be retrieved from use setTotalName(String).

Parameters:
root - the root name

setTotalName

public void setTotalName(java.lang.String totalName)
Sets name of the property that contains the 'total number of records' value.

Parameters:
totalName - the total name