Package br.gov.frameworkdemoiselle.pagination

Examples of br.gov.frameworkdemoiselle.pagination.Pagination


  }

  @Override
  public List<Item> loadItems(final int startIndex, final int count) {
    PaginationContext paginationContext = Beans.getReference(PaginationContext.class);
    Pagination pagination = paginationContext.getPagination(beanClass);

    pagination.setFirstResult(startIndex);

    List<E> resultList;
    if (list != null && !list.isEmpty()) {
      resultList = list;
      list = null;
    } else {
      resultList = handler.handleResultList();
    }

    size = pagination.getTotalResults();

    List<Item> items = new ArrayList<Item>();
    for (E entity : resultList) {
      items.add(new BeanItem<E>(entity));
    }
View Full Code Here


   * Because that, we first check the size, asking only for one record (0 to 1). After that the "PageSize" attribute will be set.
   */
  @Override
  public int size() {
    PaginationContext paginationContext = Beans.getReference(PaginationContext.class);
    Pagination pagination = paginationContext.getPagination(beanClass, true);

    // If size equals 0 then is the first call to container or the table has 0 record.
    // Lets minimize the overhead asking only for 1 record.
    if (size == 0) {
      // Store this list for further use. Lets minimize even more the overhead.
      list = handler.handleResultList();
      size = pagination.getTotalResults(); // Ok, now we have the real totalResults.
    }

    return size;
  }
View Full Code Here

  public Pagination getPagination(final Class<?> clazz) {
    return this.getPagination(clazz, false);
  }

  public Pagination getPagination(final Class<?> clazz, final boolean create) {
    Pagination pagination = cache.get(clazz);

    if (pagination == null && create) {
      pagination = new PaginationImpl();
      pagination.setPageSize(getConfig().getPageSize());

      cache.put(clazz, pagination);
    }

    return pagination;
View Full Code Here

  public Pagination getPagination(final Class<?> clazz) {
    return this.getPagination(clazz, false);
  }

  public Pagination getPagination(final Class<?> clazz, final boolean create) {
    Pagination pagination = cache.get(clazz);

    if (pagination == null && create) {
      pagination = new PaginationImpl();
      pagination.setPageSize(getConfig().getPageSize());

      cache.put(clazz, pagination);
    }

    return pagination;
View Full Code Here

TOP

Related Classes of br.gov.frameworkdemoiselle.pagination.Pagination

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.