List of usage examples for org.springframework.beans.support PagedListHolder setPage
public void setPage(int page)
From source file:com.klm.workshop.controller.host.manage.WorkshopController.java
/** * List of workshops/*from ww w.ja v a 2 s. c o m*/ * * @param model Objects and view * @param page Current pagination page * @param search Search value * @return The workshops list view */ @RequestMapping(value = "/workshops/index", method = RequestMethod.GET) public ModelAndView index(ModelAndView model, @RequestParam(name = "p", required = false, defaultValue = "0") int page, @RequestParam(name = "search", required = false, defaultValue = "") String search) { PagedListHolder pagedListHolder = new PagedListHolder(); pagedListHolder.setSource(workshopDAO.searchAll(search)); pagedListHolder.setPage(page); model.addObject("pagedListHolder", pagedListHolder); model.setViewName("host/manage/workshops/index"); return model; }
From source file:com.klm.workshop.controller.host.manage.UserController.java
/** * List of users//from w ww . j a v a 2 s. com * * @param model Objects and view * @param page Current pagination page * @param search Search value * @return The users list view */ @RequestMapping(value = "/users/index", method = RequestMethod.GET) public ModelAndView index(ModelAndView model, @RequestParam(name = "p", required = false, defaultValue = "0") int page, @RequestParam(name = "search", required = false, defaultValue = "") String search) { PagedListHolder pagedListHolder = new PagedListHolder(); pagedListHolder.setSource(userDAO.searchAll(search)); pagedListHolder.setPage(page); model.addObject("pagedListHolder", pagedListHolder); model.setViewName("host/manage/users/index"); return model; }
From source file:com.klm.workshop.controller.host.manage.SessionController.java
/** * List of sessions//from w w w. ja va 2 s. c o m * * @param model Objects and view * @param page Current pagination page * @param search Search value * @return The sessions list view */ @RequestMapping(value = "/sessions/index", method = RequestMethod.GET) public ModelAndView index(ModelAndView model, @RequestParam(name = "p", required = false, defaultValue = "0") int page, @RequestParam(name = "search", required = false, defaultValue = "") String search) { PagedListHolder pagedListHolder = new PagedListHolder(); pagedListHolder.setSource(sessionDAO.searchAll(search)); pagedListHolder.setPage(page); model.addObject("pagedListHolder", pagedListHolder); model.setViewName("host/manage/sessions/index"); return model; }
From source file:org.openmrs.module.conceptsearch.web.controller.AbstractSearchFormController.java
public void setConceptsPerPage(ModelMap model, WebRequest request, HttpSession session) { //set count/*from w w w. j a v a 2 s . c o m*/ String count = request.getParameter("count"); PagedListHolder resListHolder = (PagedListHolder) session.getAttribute("sortResults"); if (resListHolder != null) { int cCount = Integer.parseInt(count); if (cCount == -1) cCount = 10000; resListHolder.setPageSize(cCount); resListHolder.setPage(0); model.addAttribute("searchResult", resListHolder); } else { log.warn("Results are gone"); } }
From source file:org.openmrs.module.conceptsearch.web.controller.AbstractSearchFormController.java
public void switchToPage(@RequestParam("page") String page, ModelMap model, WebRequest request, HttpSession session) {//from ww w.j a v a 2s . c o m PagedListHolder resListHolder = (PagedListHolder) session.getAttribute("sortResults"); if (resListHolder != null) { if ("previous".equals(page)) { resListHolder.previousPage(); } else if ("next".equals(page)) { resListHolder.nextPage(); } else { resListHolder.setPage(Integer.parseInt(page)); } model.addAttribute("searchResult", resListHolder); } else { log.warn("Results are gone"); } }
From source file:com.eftech.wood.controllers.ControllerMain.java
@RequestMapping(value = "/plywood") public String allPlywood(HttpServletRequest request, ModelMap modelMap, HttpSession session) { try {//w w w . jav a2 s. c o m PagedListHolder<Plywood> pagedListHolder = new PagedListHolder<Plywood>(plywoodService.findAll()); int page = ServletRequestUtils.getIntParameter(request, "p", 0); pagedListHolder.setPage(page); pagedListHolder.setPageSize(6); modelMap.put("pagedListHolder", pagedListHolder); session.setAttribute("maxLength", plywoodService.getMaxValue("length")); session.setAttribute("maxThickness", plywoodService.getMaxValue("thickness")); session.setAttribute("maxWeight", plywoodService.getMaxValue("weight")); session.setAttribute("maxPrice", plywoodService.getMaxValue("price")); session.setAttribute("pagedUrl", request.getRequestURL().toString()); session.setAttribute("product", PRODUCT_PLYWOOD); setAttributeFilter(null, false, session); } catch (Exception e) { errorsService.save(new Errors("Show products page", e.getMessage())); } return "all_products"; }
From source file:com.eftech.wood.controllers.ControllerMain.java
@RequestMapping(value = "/particleBoard") public String allParticleBoard(HttpServletRequest request, ModelMap modelMap, HttpSession session) { try {/*from w w w.ja v a 2 s . c o m*/ PagedListHolder<ParticleBoard> pagedListHolder = new PagedListHolder<ParticleBoard>( particleBoardService.findAll()); int page = ServletRequestUtils.getIntParameter(request, "p", 0); pagedListHolder.setPage(page); pagedListHolder.setPageSize(6); modelMap.put("pagedListHolder", pagedListHolder); session.setAttribute("maxLength", particleBoardService.getMaxValue("length")); session.setAttribute("maxThickness", particleBoardService.getMaxValue("thickness")); session.setAttribute("maxWeight", particleBoardService.getMaxValue("weight")); session.setAttribute("maxPrice", particleBoardService.getMaxValue("price")); session.setAttribute("maxLaminated", particleBoardService.getMaxValue("laminated")); session.setAttribute("pagedUrl", request.getRequestURL().toString()); session.setAttribute("product", PRODUCT_PARTICLE_BOARD); setAttributeFilter(null, false, session); } catch (Exception e) { errorsService.save(new Errors("Show products page", e.getMessage())); } return "all_products"; }
From source file:com.eftech.wood.controllers.ControllerMain.java
@RequestMapping(value = "filterPlywood", method = RequestMethod.GET) public String filterPlywood(@RequestParam(value = "thickness") String thickness, @RequestParam(value = "length") String length, @RequestParam(value = "weight") String weight, @RequestParam(value = "water_resistance") String water_resistance, @RequestParam(value = "sanded_or_unsanded") String sanded_or_unsanded, @RequestParam(value = "price") String price, HttpServletRequest request, ModelMap modelMap, HttpSession session) {/*from w ww. ja va2s . c o m*/ try { Filter filter = new Filter(thickness, length, weight, price, water_resistance, sanded_or_unsanded); PagedListHolder<Plywood> pagedListHolder = new PagedListHolder<Plywood>( plywoodService.findAllByFilter(filter)); int page = ServletRequestUtils.getIntParameter(request, "p", 0); pagedListHolder.setPage(page); pagedListHolder.setPageSize(6); modelMap.put("pagedListHolder", pagedListHolder); String url = "?thickness=" + thickness + "&length=" + length + "&weight=" + weight + "&water_resistance=" + water_resistance + "&sanded_or_unsanded=" + sanded_or_unsanded + "&price=" + price; session.setAttribute("pagedUrl", request.getRequestURL().toString() + url); session.setAttribute("product", PRODUCT_PLYWOOD); setAttributeFilter(filter, true, session); } catch (Exception e) { errorsService.save(new Errors("Apply filter product", e.getMessage())); } return "all_products"; }
From source file:com.eftech.wood.controllers.ControllerMain.java
@RequestMapping(value = "filterParticleBoard", method = RequestMethod.GET) public String filterParticleBoard(@RequestParam(value = "thickness") String thickness, @RequestParam(value = "length") String length, @RequestParam(value = "weight") String weight, @RequestParam(value = "laminated") String laminated, @RequestParam(value = "price") String price, HttpServletRequest request, ModelMap modelMap, HttpSession session) { try {/* w w w . j av a2s . co m*/ Filter filter = new Filter(thickness, length, weight, laminated, price); PagedListHolder<ParticleBoard> pagedListHolder = new PagedListHolder<ParticleBoard>( particleBoardService.findAllByFilter(filter)); int page = ServletRequestUtils.getIntParameter(request, "p", 0); pagedListHolder.setPage(page); pagedListHolder.setPageSize(6); modelMap.put("pagedListHolder", pagedListHolder); String url = "?thickness=" + thickness + "&length=" + length + "&weight=" + weight + "&laminated=" + laminated + "&price=" + price; session.setAttribute("pagedUrl", request.getRequestURL().toString() + url); session.setAttribute("product", PRODUCT_PARTICLE_BOARD); setAttributeFilter(filter, true, session); } catch (Exception e) { errorsService.save(new Errors("Apply filter product", e.getMessage())); } return "all_products"; }
From source file:es.itecban.deployment.executionmanager.gui.swf.service.PlanReportSearchManager.java
public PagedListHolder findReportsPaginated(RequestContext context) { PagedListHolder pList = null; if (context.getCurrentEvent().getId().equals("search")) { pList = new PagedListHolder(Arrays.asList(this.findPlanReportByParameters(context))); } else {//from ww w .ja va2 s. co m pList = (PagedListHolder) context.getFlowScope().get("availableReports", PagedListHolder.class); } if (pList != null) { if (context.getRequestParameters().get("p") != null) { pList.setPage(Integer.parseInt(context.getRequestParameters().get("p"))); } pList.setPageSize(10); } return pList; }