ColumnPicker extends UberfireColumnPicker<T> { public List<GridColumnPreference> getColumnsState() { List<GridColumnPreference> state = new ArrayList<GridColumnPreference>(); for (final ColumnMeta<T> cm : columnMetaList) { if (cm.isVisible()) { state.add(new GridColumnPreference(getColumnStoreName(cm), dataGrid.getColumnIndex(cm.getColumn()), dataGrid.getColumnWidth(cm.getColumn()))); } } return state; } ColumnPicker(DataGrid<T> dataGrid,
                        GridPreferencesStore gridPreferences);  ColumnPicker(DataGrid<T> dataGrid); void setGridPreferencesStore(GridPreferencesStore gridPreferences); List<GridColumnPreference> getColumnsState(); void adjustColumnWidths(); int getDataGridMinWidth(); void setDefaultColumnWidthSize(int defaultColumnSize); static int DETAULT_COLUMN_WIDTH; }
@Test public void testColumnPreference() { final Column column = mock(Column.class); when(column.getDataStoreName()).thenReturn("id"); final ColumnMeta meta = new ColumnMeta(column, "caption"); meta.setHeader(new TextHeader("header")); columnPicker.addColumn(meta); final List<GridColumnPreference> columnsState = columnPicker.getColumnsState(); assertEquals(1, columnsState.size()); final GridColumnPreference preference = columnsState.get(0); assertEquals(preference.getName(), column.getDataStoreName()); assertEquals(0, preference.getPosition().intValue()); }