Package net.sourceforge.pebble.util

Examples of net.sourceforge.pebble.util.Pageable


            if ( pageSize <= 0 )
                pageSize = PAGE_SIZE;

            List<SearchHit> hits = result.getHits();
            Pageable pageable = new Pageable(hits);
            pageable.setPageSize(pageSize);
            pageable.setPage(offset);
            List<SearchHit> subList = pageable.getListForPage();

            BlogService service = new BlogService();

            for (SearchHit hit : subList ) {
                BlogEntry entry = service.getBlogEntry(hit.getBlog(), hit.getId());
View Full Code Here


      responses = new ArrayList(blog.getRejectedResponses());
    } else {
      responses = new ArrayList(blog.getApprovedResponses());
    }

    Pageable pageable = new Pageable(responses) {
      public List getListForPage() {
        List responses = new ArrayList();
        BlogService service = new BlogService();
        Iterator it = super.getListForPage().iterator();
        while (it.hasNext()) {
          try {
            responses.add(service.getResponse(blog, (String)it.next()));
          } catch (BlogServiceException e) {
            // do nothing - some responses just won't get shown,
            // but a message will be sent to the blog
          }
        }
        return responses;
      }
    };
    pageable.setPageSize(PAGE_SIZE);
    pageable.setPage(page);
    getModel().put("pageable", pageable);

    getModel().put("type", type);

    return new ResponsesView();
View Full Code Here

          results.sortByDateDescending();
        } else {
          results.sortByScoreDescending();
        }

        Pageable pageable = new Pageable(results.getHits());
        pageable.setPageSize(PAGE_SIZE);
        pageable.setPage(page);

        try {
          getModel().put("searchResults", results);
          getModel().put("pageable", pageable);
          getModel().put("query", java.net.URLEncoder.encode(query, blog.getCharacterEncoding()));
View Full Code Here

  public void testActionCalledWithDefaultParameters() throws Exception {
    View view = action.process(request, response);
    assertTrue(view instanceof ResponsesView);

    assertEquals("approved", model.get("type"));
    Pageable pageable = (Pageable)model.get("pageable");
    assertNotNull("pageable", pageable);
    assertEquals(0, pageable.getList().size());
    assertEquals(0, pageable.getPage());
    assertEquals(0, pageable.getMaxPages());
    assertEquals(0, pageable.getPreviousPage());
    assertEquals(0, pageable.getNextPage());
  }
View Full Code Here

    View view = action.process(request, response);
    assertTrue(view instanceof ResponsesView);

    assertEquals("approved", model.get("type"));
    Pageable pageable = (Pageable)model.get("pageable");
    assertNotNull("pageable", pageable);
    assertEquals(numberOfComments, pageable.getList().size());
    assertEquals(1, pageable.getPage());
    assertEquals(1, pageable.getMaxPages());
    assertEquals(0, pageable.getPreviousPage());
    assertEquals(0, pageable.getNextPage());
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.pebble.util.Pageable

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.