1. #1
    Ext User
    Join Date
    May 2008
    Posts
    105
    Vote Rating
    0
    Grandiosa is on a distinguished road

      0  

    Default [CLOSED] ModelReader does not honor configdata

    [CLOSED] ModelReader does not honor configdata


    The ModelReader class:

    Code:
     public class ModelReader<C> implements DataReader<C, ListLoadResult<ModelData>> {
    
      public ListLoadResult read(C loadConfig, Object data) {
        if (data instanceof ModelData) {
          List list = new ArrayList();
          list.add(data);
          return new BaseListLoadResult(list);
        } else if (data instanceof List) {
          return new BaseListLoadResult((List) data);
        } else if (data instanceof ListLoadResult) {
          return (ListLoadResult)data;
        } else {
          throw new RuntimeException("Error converting data");
        }
      }
    The loadConfig object is unused. If the incoming data is a list, shouldn't the ModelReader only return a subset of the list? I mean if the loadConfig parameter is a BasePagingLoadConfig object ?

    This is needed in a custom proxy's load method using this code:

    PagingLoadResult<Data> result ;
    result = reader.read(config, data);

    where data is of type Data, and can be set by the user at any time.
    The reader object would be a ModelReader if the BasePagingLoader was constructed with this reader as an argument.

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    It is not the job of the reader to limit or filter the data it is passed. It is the job of the loader to return the correct data.

  3. #3
    Ext User
    Join Date
    May 2008
    Posts
    105
    Vote Rating
    0
    Grandiosa is on a distinguished road

      0  

    Default


    Fair enough. But the fact that the config object is there led me to think I should use it like this :-)

    Looking at the other DataReader implementations none of them actually use the config object, so maybe it should be removed from the method signature...

  4. #4
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Although no GXT readers use the load config it is possible that anyone creating their own reader may want to use it.

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar