AbstractMultiGridView extends Composite implements MultiGridView<T, V>,
                                                                                                                                         RequiresResize { @Override public void loadListTable(final String key, final Consumer<ListTable<T>> readyCallback) { preferences.load(preferences -> { final GridGlobalPreferences pref = new GridGlobalPreferences(key, getInitColumns(), getBannedColumns()); pref.setPageSize(preferences.getItemsPerPage()); final ListTable<T> newListGrid = new ListTable<>(pref); newListGrid.setShowLastPagerButton(false); newListGrid.setShowFastFordwardPagerButton(false); newListGrid.enableDataGridMinWidth(true); initSelectionModel(newListGrid); addColumnSortHandler(newListGrid); userPreferencesService.call((GridPreferencesStore preferencesStore) -> { if (preferencesStore == null) { newListGrid.setGridPreferencesStore(new GridPreferencesStore(pref)); } else { newListGrid.setGridPreferencesStore(preferencesStore); } initColumns(newListGrid); newListGrid.loadPageSizePreferences(); newListGrid.setPreferencesService(userPreferencesService); addNewTableToColumn(newListGrid); listTable = newListGrid; listTable.setPersistPreferencesOnChange(false); reloadColumnSortList(); readyCallback.accept(listTable); }).loadUserPreferences(key, UserPreferencesType.GRIDPREFERENCES); }, error -> new DefaultWorkbenchErrorCallback().error(error)); }  void displayNotification(String text); @Override void displayBlockingError(String summary,
                                     String content); @Override void clearBlockingError(); void init(final V presenter); @Override void loadListTable(final String key,
                              final Consumer<ListTable<T>> readyCallback); void showBusyIndicator(final String message); void hideBusyIndicator(); ListTable<T> getListGrid(); abstract void initColumns(ListTable<T> extendedPagedTable); void initSelectionModel(final ListTable<T> extendedPagedTable); abstract String getEmptyTableCaption(); abstract List<String> getInitColumns(); abstract List<String> getBannedColumns(); @Inject void setUserPreferencesService(final Caller<UserPreferencesService> userPreferencesService); Column<T, String> createTextColumn(final String columnId,
                                              final Function<T, String> valueFunction); Column<T, Number> createNumberColumn(final String columnId,
                                                final Function<T, Number> valueFunction); ColumnMeta<T> initChecksColumn(final ListTable<T> extendedPagedTable); ColumnMeta<T> initActionsColumn(); List<ColumnMeta<T>> renameVariables(ListTable<T> extendedPagedTable, List<ColumnMeta<T>> columnMetas); void addDomainSpecifColumns(Set<String> columns); void removeDomainSpecifColumns(); @Override void setSaveFilterCallback(final BiConsumer<String, Consumer<String>> filterNameCallback); @Override void addActiveFilter(final ActiveFilterItem<T> filter); @Override void removeActiveFilter(final ActiveFilterItem<T> filter); @Override void removeAllActiveFilters(); @Override void onResize(); @Override String getSortColumn(); @Override Boolean isSortAscending(); static final String COL_ID_SELECT; static final String COL_ID_ACTIONS; static final int ACTIONS_COLUMN_WIDTH; static final int CHECK_COLUMN_WIDTH; static final int ERROR_COLUMN_WIDTH; }
@Test public void testGlobalPreferences() { doAnswer((InvocationOnMock inv) -> { ((ParameterizedCommand<ManagePreferences>) inv.getArguments()[0]).execute(new ManagePreferences().defaultValue(new ManagePreferences())); return null; }).when(preferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); Consumer<ListTable> consumer = table -> assertEquals(ManagePreferences.DEFAULT_PAGINATION_OPTION.intValue(), table.getGridPreferencesStore().getPageSizePreferences()); getView().loadListTable("key", consumer); }
@Test public void testEnableDataGridMinWidth() { doAnswer((InvocationOnMock inv) -> { ((ParameterizedCommand<ManagePreferences>) inv.getArguments()[0]).execute(new ManagePreferences().defaultValue(new ManagePreferences())); return null; }).when(preferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); Consumer<ListTable> consumer = table -> assertTrue(table.isDataGridMinWidthEnabled()); getView().loadListTable("key", consumer); }
@Test public void testSetPersistOnPreferencesChangeAfterLoadListTable() { doAnswer((InvocationOnMock inv) -> { ((ParameterizedCommand<ManagePreferences>) inv.getArguments()[0]).execute(new ManagePreferences().defaultValue(new ManagePreferences())); return null; }).when(preferences).load(any(ParameterizedCommand.class), any(ParameterizedCommand.class)); Consumer<ListTable> consumer = table -> { assertEquals(ManagePreferences.DEFAULT_PAGINATION_OPTION.intValue(), table.getGridPreferencesStore().getPageSizePreferences()); assertFalse(table.isPersistingPreferencesOnChange()); }; getView().loadListTable("key", consumer); }