TaskListViewImpl extends AbstractTaskListView<TaskListPresenter> { @Override public List<String> getInitColumns() { return Arrays.asList(COL_ID_SELECT, COLUMN_NAME, COLUMN_PROCESS_ID, COLUMN_STATUS, COLUMN_CREATED_ON, COL_ID_ACTIONS); }  @Override List<String> getInitColumns();  }
@Test public void testRenameProcessVariableForInitColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); List<GridColumnPreference> gridColumnPreferenceList = extendedPagedTable.getGridPreferencesStore().getColumnPreferences(); gridColumnPreferenceList.add(new GridColumnPreference("Id", -1, "")); gridColumnPreferenceList.add(new GridColumnPreference("performance", -1, "")); view.initCellPreview(extendedPagedTable); final ColumnMeta checkColumnMeta = view.initChecksColumn(extendedPagedTable); final Column<TaskSummary, String> createdOnColumn = view.createTextColumn(COLUMN_CREATED_ON, task -> DateUtils.getDateTimeStr(task.getCreatedOn())); ColumnMeta<TaskSummary> actionsColumnMeta = view.initActionsColumn(); extendedPagedTable.addSelectionIgnoreColumn(checkColumnMeta.getColumn()); extendedPagedTable.addSelectionIgnoreColumn(actionsColumnMeta.getColumn()); List<ColumnMeta<TaskSummary>> columnMetas = view.getGeneralColumnMetas(extendedPagedTable, checkColumnMeta, createdOnColumn, actionsColumnMeta); assertThat(columnMetas.stream()).extracting(c -> c.getCaption()).hasSize(18).doesNotContain("Var_Id"); List<ColumnMeta<TaskSummary>> tmp = view.renameVariables(extendedPagedTable, columnMetas); columnMetas.addAll(tmp); assertThat(columnMetas.stream()).extracting(c -> c.getCaption()).hasSize(20).containsOnlyOnce("Var_Id"); }
@Test public void testRenameProcessVariableForAddDomainSpecifColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); when(view.getListGrid()).thenReturn(extendedPagedTable); Set<String> set = Collections.singleton("Id"); view.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(18).doesNotContain("Var_Id"); view.addDomainSpecifColumns(set); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(19).containsOnlyOnce("Var_Id"); }
@Test public void testRemoveColumnMetaFromColumnsForAddDomainSpecifColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); when(view.getListGrid()).thenReturn(extendedPagedTable); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().add(new GridColumnPreference("Extra", -1, "")); Set<String> set = Sets.newHashSet("Extra"); view.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().size()).isEqualTo(19); view.addDomainSpecifColumns(set); assertThat(set.size()).isEqualTo(0); }
@Test public void testRemoveColumnMetaFromExtendedPagedTableForAddDomainSpecifColumns() { GridGlobalPreferences gridPreferences = new GridGlobalPreferences("test", view.getInitColumns(), view.getBannedColumns()); ListTable<TaskSummary> extendedPagedTable = new ListTable<TaskSummary>(gridPreferences); when(view.getListGrid()).thenReturn(extendedPagedTable); Column<TaskSummary, String> column = view.createTextColumn("Extra", taskSummary -> taskSummary.getName()); ColumnMeta<TaskSummary> columnMeta = new ColumnMeta<TaskSummary>(column, "Extra", true, true); Set<String> set = Collections.singleton("Extra_test"); view.initColumns(extendedPagedTable); assertThat(extendedPagedTable.getColumnMetaList().size()).isEqualTo(18); extendedPagedTable.addColumns(Collections.singletonList(columnMeta)); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(19).containsOnlyOnce("Extra"); view.addDomainSpecifColumns(set); assertThat(extendedPagedTable.getColumnMetaList().stream()).extracting(c -> c.getCaption()).hasSize(19).doesNotContain("Extra"); assertThat(set.size()).isEqualTo(1); }