Class JsonReaderResponse<T>

java.lang.Object
ch.tocco.nice2.netui.api.dwr.extstore.JsonReaderResponse<T>
Type Parameters:
T - Type of Objects that will be converted to Ext.data.Records by the client-side Ext.data.DataReader.

public class JsonReaderResponse<T> extends Object
Creates a response that can be consumed by an Ext.data.JsonReader. The client-side Ext.data.JsonReader must have the "root" property set to "objectsToConvertToRecords". Note: Ext documentation often uses "rows" for this property, but "objectsToConvertToRecords" is more clear. Example Ext.data.JsonReader configuration: { root : 'objectsToConvertToRecords' } If the parameterized type has two properties "field1" and "field2", then when an instance of this class is read by the client, it will look like: { objectsToConvertToRecords : [ { field1 : 'value', field2 : 'value', }, { field1 : 'value', field2 : 'value', } ], success : true }
  • Constructor Details

    • JsonReaderResponse

      public JsonReaderResponse(List<T> objectsToConvertToRecords)
      Creates a successful JsonReaderResponse with the provided objectsToConvertToRecords.
      Parameters:
      objectsToConvertToRecords - items
    • JsonReaderResponse

      public JsonReaderResponse(List<T> objectsToConvertToRecords, Map<String,Object> properties)
    • JsonReaderResponse

      public JsonReaderResponse(List<T> objectsToConvertToRecords, Map<String,Object> properties, @Nullable @Nullable Integer total)
    • JsonReaderResponse

      public JsonReaderResponse()
      Creates an unsuccessful JsonReaderResponse with null objectsToConvertToRecords. This signals the case where the client established a connection with the server, but the server couldn't fulfill it (e.g., user doesn't have proper user credentials).
  • Method Details

    • setMetaData

      public void setMetaData(MetaData metaData)
      Adds the meta data object to the json reader response. Adding meta data can be used to reconfigure the column model dynamically.
      Parameters:
      metaData - the meta data object.
    • getSuccess

      public boolean getSuccess()
    • getObjectsToConvertToRecords

      public Object[] getObjectsToConvertToRecords()
    • getProperties

      public Map<String,Object> getProperties()
    • getMetaData

      public MetaData getMetaData()
    • getTotal

      @Nullable public @Nullable Integer getTotal()