@Test public void testUpdate() throws VetoException { final ActionWorkItemSetFieldCol52 column = spy(new ActionWorkItemSetFieldCol52()); column.setWorkItemName(WORK_ITEM_NAME); column.setHeader("col1"); modelSynchronizer.appendColumn(column); final ActionWorkItemSetFieldCol52 edited = new ActionWorkItemSetFieldCol52(); edited.setWorkItemName(WORK_ITEM_NAME); edited.setWidth(column.getWidth()); edited.setHideColumn(true); edited.setHeader("updated"); List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited); assertEquals(2, diffs.size()); verify(column).diff(edited); assertEquals(2, model.getActionCols().size()); assertEquals(5, uiModel.getColumns().size()); assertTrue(uiModel.getColumns().get(4) instanceof BooleanUiColumn); assertEquals("updated", uiModel.getColumns().get(4).getHeaderMetaData().get(1).getTitle()); assertEquals(false, uiModel.getColumns().get(4).isVisible()); }
@Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn(); final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; }
ActionWorkItemSetFieldColumnSynchronizer extends ActionColumnSynchronizer { @Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn(); final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; } }
ActionWorkItemSetFieldColumnSynchronizer extends ActionColumnSynchronizer { @Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn(); final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; }  }
ActionWorkItemSetFieldColumnSynchronizer extends ActionColumnSynchronizer { @Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn(); final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; }  @Override int priority(); @Override boolean handlesAppend(final MetaData metaData); @Override void append(final ColumnMetaData metaData); @Override boolean handlesUpdate(final MetaData metaData); @Override List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData,
                                            final ColumnMetaData editedMetaData); @Override boolean handlesMoveColumnsTo(final List<? extends MetaData> metaData); }
ActionWorkItemSetFieldColumnSynchronizer extends ActionColumnSynchronizer { @Override public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException { if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) { return Collections.emptyList(); } final ActionWorkItemSetFieldCol52 originalColumn = (ActionWorkItemSetFieldCol52) originalMetaData.getColumn(); final ActionWorkItemSetFieldCol52 editedColumn = (ActionWorkItemSetFieldCol52) editedMetaData.getColumn(); final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn); update(originalColumn, editedColumn); final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HIDE_COLUMN, diffs); final boolean isHeaderUpdated = BaseColumnFieldDiffImpl.hasChanged(ActionWorkItemSetFieldCol52.FIELD_HEADER, diffs); if (isHideUpdated) { setColumnVisibility(originalColumn, originalColumn.isHideColumn()); } if (isHeaderUpdated) { setColumnHeader(originalColumn, originalColumn.getHeader()); } return diffs; }  @Override int priority(); @Override boolean handlesAppend(final MetaData metaData); @Override void append(final ColumnMetaData metaData); @Override boolean handlesUpdate(final MetaData metaData); @Override List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData,
                                            final ColumnMetaData editedMetaData); @Override boolean handlesMoveColumnsTo(final List<? extends MetaData> metaData);  }