本文整理汇总了Java中org.springframework.beans.support.PagedListHolder类的典型用法代码示例。如果您正苦于以下问题:Java PagedListHolder类的具体用法?Java PagedListHolder怎么用?Java PagedListHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagedListHolder类属于org.springframework.beans.support包,在下文中一共展示了PagedListHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleRequestInternal
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
Map<ReportRepositoryDescription, PagedListHolder<DatabaseReportDescription>> repositoryList = new LinkedHashMap<ReportRepositoryDescription, PagedListHolder <DatabaseReportDescription>>();
// Go through all active repositories and get all reports for each repository
for (ReportRepositoryDescription reportRepositoryDescription : m_reportListService.getActiveRepositories()) {
PagedListHolder<DatabaseReportDescription> pageListholder = new PagedListHolder<DatabaseReportDescription>(m_reportListService.getReportsByRepositoryId(reportRepositoryDescription.getId()));
pageListholder.setPageSize(m_pageSize);
int page = ServletRequestUtils.getIntParameter(request,"p_" + reportRepositoryDescription.getId(),0);
pageListholder.setPage(page);
repositoryList.put(reportRepositoryDescription, pageListholder);
}
return new ModelAndView("report/database/batchList","repositoryList", repositoryList);
}
示例2: currentPage
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
private Pager currentPage(PagedListHolder<?> pagedListHolder) {
int currentIndex = pagedListHolder.getPage() + 1;
int beginIndex = Math.max(1, currentIndex - PRODUCT_LIST_PAGE_SIZE);
int endIndex = Math.min(beginIndex + 5, pagedListHolder.getPageCount());
int totalPageCount = pagedListHolder.getPageCount();
int totalItems = pagedListHolder.getNrOfElements();
String baseUrl = PRODUCT_LIST_BASEURL;
Pager pager = new Pager();
pager.setBeginIndex(beginIndex);
pager.setEndIndex(endIndex);
pager.setCurrentIndex(currentIndex);
pager.setTotalPageCount(totalPageCount);
pager.setTotalItems(totalItems);
pager.setBaseUrl(baseUrl);
return pager;
}
示例3: history
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
@RequestMapping("/job/{jobId}/history")
public ModelAndView history(@PathVariable int jobId,
HttpServletRequest request, HttpServletResponse response) {
ModelAndView mav = new ModelAndView();
int page = ServletRequestUtils.getIntParameter(request, "p", 0);
int pageSize = 20;
HistoryPage historyPage = getJobService().getHistory(jobId, page, pageSize);
PagedListHolder pagedListHolder = new PageHolder(historyPage.getTotalNumberOfResults(), page, pageSize, 10);
mav.addObject("job", getJobService().getJob(jobId));
mav.addObject("history", historyPage.getHistoryInfos());
mav.addObject("pagedListHolder", pagedListHolder);
mav.addObject("page", page);
mav.addObject("numberOfPages", historyPage.getNumberOfPages());
mav.addObject("role", getRole());
mav.setViewName("history");
return mav;
}
示例4: handleRequest
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
String username = request.getParameter("username");
String password = request.getParameter("password");
Account account = this.petStore.getAccount(username, password);
if (account == null) {
return new ModelAndView("Error", "message", "Invalid username or password. Signon failed.");
}
else {
UserSession userSession = new UserSession(account);
PagedListHolder myList = new PagedListHolder(this.petStore.getProductListByCategory(account.getFavouriteCategoryId()));
myList.setPageSize(4);
userSession.setMyList(myList);
request.getSession().setAttribute("userSession", userSession);
String forwardAction = request.getParameter("forwardAction");
if (forwardAction != null) {
response.sendRedirect(forwardAction);
return null;
}
else {
return new ModelAndView("index");
}
}
}
示例5: doExecute
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
protected ActionForward doExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
AccountActionForm acctForm = (AccountActionForm) form;
if (AccountActionForm.VALIDATE_EDIT_ACCOUNT.equals(acctForm.getValidate())) {
acctForm.getAccount().setListOption(request.getParameter("account.listOption") != null);
acctForm.getAccount().setBannerOption(request.getParameter("account.bannerOption") != null);
Account account = acctForm.getAccount();
getPetStore().updateAccount(account);
acctForm.setAccount(getPetStore().getAccount(account.getUsername()));
PagedListHolder myList = new PagedListHolder(getPetStore().getProductListByCategory(account.getFavouriteCategoryId()));
myList.setPageSize(4);
acctForm.setMyList(myList);
request.getSession().setAttribute("accountForm", acctForm);
request.getSession().removeAttribute("workingAccountForm");
return mapping.findForward("success");
}
else {
request.setAttribute("message", "Your account was not updated because the submitted information was not validated.");
return mapping.findForward("failure");
}
}
示例6: execute
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
AccountActionForm acctForm = (AccountActionForm) form;
if (AccountActionForm.VALIDATE_NEW_ACCOUNT.equals(acctForm.getValidate())) {
acctForm.getAccount().setListOption(request.getParameter("account.listOption") != null);
acctForm.getAccount().setBannerOption(request.getParameter("account.bannerOption") != null);
Account account = acctForm.getAccount();
String username = acctForm.getAccount().getUsername();
getPetStore().insertAccount(account);
acctForm.setAccount(getPetStore().getAccount(username));
PagedListHolder myList = new PagedListHolder(getPetStore().getProductListByCategory(account.getFavouriteCategoryId()));
myList.setPageSize(4);
acctForm.setMyList(myList);
request.getSession().setAttribute("accountForm", acctForm);
request.getSession().removeAttribute("workingAccountForm");
return mapping.findForward("success");
}
else {
request.setAttribute("message", "Your account was not created because the submitted information was not validated.");
return mapping.findForward("failure");
}
}
示例7: getPhotoBook
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
public PagedListHolder<SpacePhoto> getPhotoBook(List<SpacePhoto> photos, String pageString) {
PagedListHolder<SpacePhoto> book = new PagedListHolder<>(photos);
book.setPageSize(PHOTOS_IN_PAGE);
int page = 0;
if (Strings.isNullOrEmpty(pageString)) {
page = 0;
} else {
try {
page = Integer.parseInt(pageString);
} catch (NumberFormatException nfe) {
if ("f".equals(pageString)) {
page = 0;
} else if ("l".equals(pageString)) {
page = book.getPageCount();
}
}
}
book.setPage(page == 0 ? 0 : page - 1);
return book;
}
示例8: getSubmissionBook
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
public PagedListHolder<SpacePhotoSubmission> getSubmissionBook(List<SpacePhotoSubmission> submissions, String pageString) {
PagedListHolder<SpacePhotoSubmission> book = new PagedListHolder<>(submissions);
book.setPageSize(PHOTOS_IN_PAGE);
int page = 0;
if (Strings.isNullOrEmpty(pageString)) {
page = 0;
} else {
try {
page = Integer.parseInt(pageString);
} catch (NumberFormatException nfe) {
if ("f".equals(pageString)) {
page = 0;
} else if ("l".equals(pageString)) {
page = book.getPageCount();
}
}
}
book.setPage(page == 0 ? 0 : page - 1);
return book;
}
示例9: getBook
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
public PagedListHolder<OccupationRequest> getBook(List<OccupationRequest> requests, String pageString) {
PagedListHolder<OccupationRequest> book = new PagedListHolder<>(requests);
book.setPageSize(30);
int page = 0;
if (Strings.isNullOrEmpty(pageString)) {
page = 0;
} else {
try {
page = Integer.parseInt(pageString);
} catch (NumberFormatException nfe) {
if ("f".equals(pageString)) {
page = 0;
} else if ("l".equals(pageString)) {
page = book.getPageCount();
}
}
}
book.setPage(page == 0 ? 0 : page - 1);
return book;
}
示例10: handleRequestInternal
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
logger.debug("start: reload reporting configuration files");
// TODO indigo: We have to solve this problem on DAO level
synchronized (m_reportListService) {
m_reportListService.reloadConfigurationFiles();
}
logger.debug("stop : reload reporting configuration files");
Map<ReportRepositoryDescription, PagedListHolder<DatabaseReportDescription>> repositoryList = new LinkedHashMap<ReportRepositoryDescription, PagedListHolder<DatabaseReportDescription>>();
for (ReportRepositoryDescription reportRepositoryDescription : m_reportListService.getActiveRepositories()) {
PagedListHolder<DatabaseReportDescription> pageListholder = new PagedListHolder<DatabaseReportDescription>(m_reportListService.getReportsByRepositoryId(reportRepositoryDescription.getId()));
pageListholder.setPageSize(m_pageSize);
int page = ServletRequestUtils.getIntParameter(request, "p_" + reportRepositoryDescription.getId(), 0);
pageListholder.setPage(page);
repositoryList.put(reportRepositoryDescription, pageListholder);
}
return new ModelAndView("report/database/reportList", "repositoryList", repositoryList);
}
示例11: allPlayers
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
@RequestMapping("/all")
public String allPlayers(HttpServletRequest request, Model model,
@RequestParam(value = "playerUpdated", required = false) player player,
@RequestParam(value = "oldPlayerTeam", required = false) String oldTeam){
PagedListHolder pagedList = pagination.pagedListImpl(15, request, players.getAllPlayers());
model.addAttribute("allPlayers", pagedList);
model.addAttribute("playerUpdated", player);
model.addAttribute("oldPlayerTeam", oldTeam);
return "admin/pages/allPlayers";
}
示例12: pagedListImpl
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
@Override
public PagedListHolder pagedListImpl(int size, HttpServletRequest request, List pageSource) {
pagedListHolder = new PagedListHolder(pageSource);
pagedListHolder.setPage(ServletRequestUtils.getIntParameter(request, "page", 0));
pagedListHolder.setPageSize(size);
return pagedListHolder;
}
示例13: pagedProductsPage
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@RequestMapping(value = "/products/page/{pageNumber}", method = RequestMethod.GET)
public String pagedProductsPage(HttpServletRequest request, @PathVariable Integer pageNumber, Model uiModel) {
logger.debug("Showing paged products page # {}", pageNumber);
PagedListHolder<Product> pagedListHolder = (PagedListHolder<Product>) request.getSession()
.getAttribute(SESSION_ATTRIBUTE_PRODUCTLIST);
if (pagedListHolder == null) {
pagedListHolder = new PagedListHolder<Product>(productService.getProducts());
pagedListHolder.setPageSize(PRODUCT_LIST_PAGE_SIZE);
} else {
final int goToPage = pageNumber - 1;
if (goToPage <= pagedListHolder.getPageCount() && goToPage >= 0) {
pagedListHolder.setPage(goToPage);
}
}
request.getSession().setAttribute(SESSION_ATTRIBUTE_PRODUCTLIST, pagedListHolder);
uiModel.addAttribute(MODEL_ATTRIBUTE_PAGER, currentPage(pagedListHolder));
uiModel.addAttribute(MODEL_ATTRIBUTE_PRODUCTS, pagedListHolder);
return PRODUCT_LIST_VIEW;
}
示例14: processFindForm
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
@RequestMapping(value = "/products/list", method = RequestMethod.GET)
public String processFindForm(UserQuery userQuery, BindingResult result, Model model, HttpServletRequest request) {
List<Product> results = null;
Boolean isSimpleTermQuery = userQuery.getQuery().matches("[a-zA-Z_0-9 ]*");
if (StringUtils.isEmpty(userQuery.getQuery())) {
return "redirect:/products/search";
} else
try {
if (isSimpleTermQuery) {
HighlightPage<Product> highlightedResults = productService
.findByHighlightedNameCriteria(userQuery.getQuery());
results = SolrUtils.highlightPagesToList(highlightedResults);
} else {
results = productService.getProductsWithUserQuery(userQuery.getQuery());
}
} catch (UncategorizedSolrException ex) {
logger.info(MessageFormat.format("Bad Query: {0}", userQuery.getQuery()));
result.rejectValue("query", "product.search.error", new Object[] { userQuery.getQuery() }, "not found");
return PRODUCT_SEARCH_VIEW;
}
if (results.size() < 1) {
result.rejectValue("query", "product.search.noresults", new Object[] { userQuery.getQuery() }, "not found");
return PRODUCT_SEARCH_VIEW;
}
if (results.size() > 1) {
PagedListHolder<Product> pagedListHolder = new PagedListHolder<Product>(results);
pagedListHolder.setPageSize(PRODUCT_LIST_PAGE_SIZE);
request.getSession().setAttribute(SESSION_ATTRIBUTE_PRODUCTLIST, pagedListHolder);
return "redirect:/products/page/1";
} else {
Product product = results.iterator().next();
return "redirect:/products/" + product.getId();
}
}
示例15: onSubmit
import org.springframework.beans.support.PagedListHolder; //导入依赖的package包/类
protected ModelAndView onSubmit(
HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
throws Exception {
AccountForm accountForm = (AccountForm) command;
try {
if (accountForm.isNewAccount()) {
this.petStore.insertAccount(accountForm.getAccount());
}
else {
this.petStore.updateAccount(accountForm.getAccount());
}
}
catch (DataIntegrityViolationException ex) {
errors.rejectValue("account.username", "USER_ID_ALREADY_EXISTS",
"User ID already exists: choose a different ID.");
return showForm(request, response, errors);
}
UserSession userSession = new UserSession(this.petStore.getAccount(accountForm.getAccount().getUsername()));
PagedListHolder myList = new PagedListHolder(
this.petStore.getProductListByCategory(accountForm.getAccount().getFavouriteCategoryId()));
myList.setPageSize(4);
userSession.setMyList(myList);
request.getSession().setAttribute("userSession", userSession);
return super.onSubmit(request, response, command, errors);
}