@Test public void setItemsPerPage() { pg.setItems(123); pg.setPage(11); pg.setItemsPerPage(PageSize.$20); assertEquals(7, pg.getPages()); assertEquals(123, pg.getItems()); assertEquals(20, pg.getItemsPerPage()); assertEquals(6, pg.getPage()); assertEquals(1, pg.getFirstPage()); assertEquals(5, pg.getPreviousPage()); assertEquals(1, pg.getPreviousPage(10)); assertEquals(7, pg.getNextPage()); assertEquals(7, pg.getNextPage(10)); assertEquals(101, pg.getBeginIndex()); assertEquals(120, pg.getEndIndex()); assertEquals(100, pg.getOffset()); assertEquals(20, pg.getLength()); assertTrue(pg.isDisabledPage(0)); assertFalse(pg.isDisabledPage(1)); assertFalse(pg.isDisabledPage(2)); assertTrue(pg.isDisabledPage(6)); assertFalse(pg.isDisabledPage(7)); assertTrue(pg.isDisabledPage(8)); pg.setItemsPerPage(5); assertEquals(25, pg.getPages()); assertEquals(123, pg.getItems()); assertEquals(5, pg.getItemsPerPage()); assertEquals(21, pg.getPage()); assertEquals(1, pg.getFirstPage()); assertEquals(20, pg.getPreviousPage()); assertEquals(11, pg.getPreviousPage(10)); assertEquals(22, pg.getNextPage()); assertEquals(25, pg.getNextPage(10)); assertEquals(101, pg.getBeginIndex()); assertEquals(105, pg.getEndIndex()); assertEquals(100, pg.getOffset()); assertEquals(5, pg.getLength()); assertTrue(pg.isDisabledPage(0)); assertFalse(pg.isDisabledPage(1)); assertFalse(pg.isDisabledPage(2)); assertTrue(pg.isDisabledPage(21)); assertFalse(pg.isDisabledPage(22)); assertTrue(pg.isDisabledPage(26)); }
public int setItemsPerPage(int itemsPerPage) { int tmp = this.itemsPerPage; this.itemsPerPage = itemsPerPage > 0 ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; if (page > 0) { setPage((int) ((double) (page - 1) * tmp / this.itemsPerPage) + 1); } return this.itemsPerPage; }
Paginator implements Serializable, CloneableObject<Paginator> { public int setItemsPerPage(int itemsPerPage) { int tmp = this.itemsPerPage; this.itemsPerPage = itemsPerPage > 0 ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; if (page > 0) { setPage((int) ((double) (page - 1) * tmp / this.itemsPerPage) + 1); } return this.itemsPerPage; } }
Paginator implements Serializable, CloneableObject<Paginator> { public int setItemsPerPage(int itemsPerPage) { int tmp = this.itemsPerPage; this.itemsPerPage = itemsPerPage > 0 ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; if (page > 0) { setPage((int) ((double) (page - 1) * tmp / this.itemsPerPage) + 1); } return this.itemsPerPage; } Paginator();  Paginator(int itemsPerPage);  Paginator(int itemsPerPage, int items);  Paginator(PageSize pageSize);  Paginator(PageSize pageSize, int items); }
Paginator implements Serializable, CloneableObject<Paginator> { public int setItemsPerPage(int itemsPerPage) { int tmp = this.itemsPerPage; this.itemsPerPage = itemsPerPage > 0 ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; if (page > 0) { setPage((int) ((double) (page - 1) * tmp / this.itemsPerPage) + 1); } return this.itemsPerPage; } Paginator();  Paginator(int itemsPerPage);  Paginator(int itemsPerPage, int items);  Paginator(PageSize pageSize);  Paginator(PageSize pageSize, int items); int getPages(); int getPage(); int setPage(int page); int getItems(); int setItems(int items); int getItemsPerPage(); int setItemsPerPage(int itemsPerPage); int setItemsPerPage(PageSize pageSize); int getOffset(); int getLength(); int getBeginIndex(); int getEndIndex(); int setItem(int itemOffset); int getFirstPage(); int getLastPage(); int getPreviousPage(); int getPreviousPage(int n); int getNextPage(); int getNextPage(int n); int getPrevious(); int getNext(); boolean isDisabledPage(int page); int[] getSlider(); int[] getSlider(int width); @Override Paginator clone(); @Override String toString(); }
Paginator implements Serializable, CloneableObject<Paginator> { public int setItemsPerPage(int itemsPerPage) { int tmp = this.itemsPerPage; this.itemsPerPage = itemsPerPage > 0 ? itemsPerPage : DEFAULT_ITEMS_PER_PAGE; if (page > 0) { setPage((int) ((double) (page - 1) * tmp / this.itemsPerPage) + 1); } return this.itemsPerPage; } Paginator();  Paginator(int itemsPerPage);  Paginator(int itemsPerPage, int items);  Paginator(PageSize pageSize);  Paginator(PageSize pageSize, int items); int getPages(); int getPage(); int setPage(int page); int getItems(); int setItems(int items); int getItemsPerPage(); int setItemsPerPage(int itemsPerPage); int setItemsPerPage(PageSize pageSize); int getOffset(); int getLength(); int getBeginIndex(); int getEndIndex(); int setItem(int itemOffset); int getFirstPage(); int getLastPage(); int getPreviousPage(); int getPreviousPage(int n); int getNextPage(); int getNextPage(int n); int getPrevious(); int getNext(); boolean isDisabledPage(int page); int[] getSlider(); int[] getSlider(int width); @Override Paginator clone(); @Override String toString(); static final int DEFAULT_ITEMS_PER_PAGE; static final int DEFAULT_SLIDER_SIZE; static final int UNKNOWN_ITEMS; }