PagedTable extends SimpleTable<T> { public final void loadPageSizePreferences() { pageSize = getPageSizeStored(); this.dataGrid.setPageStart(0); this.dataGrid.setPageSize(pageSize); this.pager.setPageSize(pageSize); this.pageSizesSelector.setValue(String.valueOf(pageSize)); setTableHeight(); } PagedTable();  PagedTable(final int pageSize);  PagedTable(final int pageSize,
                      final ProvidesKey<T> providesKey);  PagedTable(final int pageSize,
                      final ProvidesKey<T> providesKey,
                      final GridGlobalPreferences gridGlobalPreferences);  PagedTable(final int pageSize,
                      final ProvidesKey<T> providesKey,
                      final GridGlobalPreferences gridGlobalPreferences,
                      final boolean showPageSizesSelector);  PagedTable(final int pageSize,
                      final ProvidesKey<T> providesKey,
                      final GridGlobalPreferences gridGlobalPreferences,
                      final boolean showPageSizesSelector,
                      final boolean showFFButton,
                      final boolean showLButton); AbstractDataProvider<T> getDataProvider(); void setDataProvider(final AbstractDataProvider<T> dataProvider); int getPageSize(); int getPageStart(); final void loadPageSizePreferences(); boolean isDataGridMinWidthEnabled(); void enableDataGridMinWidth(boolean enabled); void setDefaultColumWidthSize(int defaultColumWidthSize); void setShowLastPagerButton(boolean showLastPagerButton); void setShowFastFordwardPagerButton(boolean showFastFordwardPagerButton); void setPageSizesSelectorDropup(boolean forceDropup,
                                           boolean dropupAuto); HasWidgets getTopToolbar(); static final int DEFAULT_PAGE_SIZE; static final int HEIGHT_OFFSET_PX; @UiField
    public UberfireSimplePager pager; @UiField
    public Select pageSizesSelector; @UiField
    public Column dataGridContainer; @UiField
    public Column topToolbar; }
@Test public void testDataGridHeight() throws Exception { final int PAGE_SIZE = 10; final int ROWS = 2; final int EXPECTED_HEIGHT_PX = PagedTable.HEIGHT_OFFSET_PX; PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false); pagedTable.dataGrid = spy(pagedTable.dataGrid); when(pagedTable.dataGrid.getRowCount()).thenReturn(ROWS); verify(pagedTable.dataGrid, times(0)).setHeight(anyString()); pagedTable.loadPageSizePreferences(); verify(pagedTable.dataGrid, times(1)).setHeight(eq(EXPECTED_HEIGHT_PX + "px")); }
@Test public void testDataGridHeightWithMoreItemsThanPaging() throws Exception { final int PAGE_SIZE = 10; final int ROWS = 12; final int EXPECTED_HEIGHT_PX = PagedTable.HEIGHT_OFFSET_PX; PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false); pagedTable.dataGrid = spy(pagedTable.dataGrid); when(pagedTable.dataGrid.getRowCount()).thenReturn(ROWS); verify(pagedTable.dataGrid, times(0)).setHeight(anyString()); pagedTable.loadPageSizePreferences(); verify(pagedTable.dataGrid, times(1)).setHeight(eq(EXPECTED_HEIGHT_PX + "px")); }
@Test public void testLoadPageSizePreferencesResetsPageStart() throws Exception { final int PAGE_SIZE = 10; PagedTable pagedTable = new PagedTable(PAGE_SIZE); pagedTable.dataGrid = spy(pagedTable.dataGrid); verify(pagedTable.dataGrid, times(0)).setPageStart(0); pagedTable.loadPageSizePreferences(); verify(pagedTable.dataGrid, times(1)).setPageStart(0); }