Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 1368107 - Increase the amount of items per page.
Browse files Browse the repository at this point in the history
This increases the number of items per page on every gui/portal-war
that uses the PageControlSettingsUIBean.
  • Loading branch information
josejulio authored and Simeon Pinder committed Jan 23, 2017
1 parent 97bf369 commit 9b2d5e0
Showing 1 changed file with 24 additions and 2 deletions.
Expand Up @@ -24,8 +24,30 @@
* @author Joseph Marques
*/
public class PageControlSettingsUIBean {
private SelectItem[] pageSizes = new SelectItem[] { new SelectItem("15", "15"), new SelectItem("30", "30"),
new SelectItem("45", "45") };
private SelectItem[] pageSizes;
private static String MAX_ITEMS_PER_PAGE = "rhq.server.gui.max-items-per-page";

public PageControlSettingsUIBean() {
try {
String maxItemsPerPage = System.getProperty(MAX_ITEMS_PER_PAGE);
int maxItemsPerPageInt;
if (maxItemsPerPage != null && (maxItemsPerPageInt = Integer.parseInt(maxItemsPerPage)) >= 45) {
// Scale default page sizes
String tier0 = String.valueOf(Math.max(15, (int) (maxItemsPerPageInt * 0.25)));
String tier1 = String.valueOf(Math.max(30, (int) (maxItemsPerPageInt * 0.50)));
String tier2 = String.valueOf(Math.max(45, (int) (maxItemsPerPageInt * 0.75)));
pageSizes = new SelectItem[] { new SelectItem(tier0, tier0), new SelectItem(tier1, tier1),
new SelectItem(tier2, tier2), new SelectItem(maxItemsPerPage, maxItemsPerPage) };
}
} catch (NumberFormatException nfe) {
// Ignore this exception.
}
if (pageSizes == null) {
pageSizes = new SelectItem[]{new SelectItem("15", "15"), new SelectItem("30", "30"),
new SelectItem("45", "45")};
}

}

public SelectItem[] getPageSizes() {
return pageSizes;
Expand Down

0 comments on commit 9b2d5e0

Please sign in to comment.