All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.extjs.gxt.ui.client.data.XmlPagingLoadResultReader Maven / Gradle / Ivy

There is a newer version: 2.3.1-gwt22
Show newest version
/*
 * Sencha GXT 2.3.1 - Sencha for GWT
 * Copyright(c) 2007-2013, Sencha, Inc.
 * [email protected]
 * 
 * http://www.sencha.com/products/gxt/license/
 */
 package com.extjs.gxt.ui.client.data;

import java.util.List;

/**
 * A XmlReader implementation that reads XML data using a
 * ModelType definition and returns a paging list load result
 * instance.
 * 
 * @param  the type of list load result being returned by the reader
 */
public class XmlPagingLoadResultReader> extends XmlLoadResultReader {
  /**
   * Creates a new reader.
   * 
   * @param modelType the model type definition
   */
  public XmlPagingLoadResultReader(ModelType modelType) {
    super(modelType);
  }

  @Override
  protected Object createReturnData(Object loadConfig, List records, int totalCount) {
    ListLoadResult result = (ListLoadResult) super.createReturnData(loadConfig, records, totalCount);

    if (result instanceof PagingLoadResult) {
      PagingLoadResult r = (PagingLoadResult) result;
      r.setTotalLength(totalCount);

      if (loadConfig instanceof PagingLoadConfig) {
        PagingLoadConfig config = (PagingLoadConfig) loadConfig;
        r.setOffset(config.getOffset());
      }
    }
    return result;

  }

  @Override
  protected BasePagingLoadResult newLoadResult(Object loadConfig, List models) {
    return new BasePagingLoadResult(models);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy