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

Commit

Permalink
Merge pull request #285 from josejulio/bugs/1368107
Browse files Browse the repository at this point in the history
Bug 1368107 - Increase the amount of items per page.
  • Loading branch information
burmanm committed Jan 14, 2017
2 parents 6f71078 + 57ee16e commit e75f214
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 e75f214

Please sign in to comment.