use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.
the class AttributeColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
final AttributeCol52 originalColumn = (AttributeCol52) originalMetaData.getColumn();
final AttributeCol52 editedColumn = (AttributeCol52) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
final boolean isAttributeUpdated = BaseColumnFieldDiffImpl.hasChanged(AttributeCol52.FIELD_ATTRIBUTE, diffs);
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(DTColumnConfig52.FIELD_HIDE_COLUMN, diffs);
if (isAttributeUpdated) {
clearColumnData(originalColumn);
}
synchroniseUpdateColumn(originalColumn);
if (isAttributeUpdated) {
setColumnHeader(originalColumn, originalColumn.getAttribute());
}
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty.
@Test
public void testRefreshAttributeWidgetWhenAttributeColumnsIsNotEmpty() {
final AttributeColumnConfigRow attributeColumnConfigRow = mock(AttributeColumnConfigRow.class);
final Label blankSlate = mock(Label.class);
final AttributeCol52 attributeCol52 = mock(AttributeCol52.class);
final Widget widget = mock(Widget.class);
final List<AttributeCol52> attributeColumns = new ArrayList<AttributeCol52>() {
{
add(attributeCol52);
}
};
doReturn(verticalPanel).when(presenter).getAttributeWidget();
doReturn(attributeColumnConfigRow).when(this.attributeColumnConfigRow).get();
doReturn(widget).when(attributeColumnConfigRow).getView();
doReturn(blankSlate).when(presenter).blankSlate();
presenter.refreshAttributeWidget(attributeColumns);
verify(attributeColumnConfigRow).init(attributeCol52, modeller);
verify(verticalPanel, never()).add(blankSlate);
verify(verticalPanel).add(widget);
}
use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testRefresh.
@Test
public void testRefresh() {
final GuidedDecisionTable52 guidedDecisionTable52 = mock(GuidedDecisionTable52.class);
doReturn(Optional.of(guidedDecisionTable52)).when(presenter).getGuidedDecisionTable52();
doNothing().when(presenter).refreshAttributeWidget(any());
doNothing().when(presenter).refreshMetaDataWidget(any());
doNothing().when(presenter).refreshConditionsWidget(any());
doNothing().when(presenter).refreshActionsWidget(any());
final List<AttributeCol52> attributeCol52s = new ArrayList<>();
final List<MetadataCol52> metadataCol52s = new ArrayList<>();
final List<CompositeColumn<? extends BaseColumn>> compositeColumns = new ArrayList<>();
final List<ActionCol52> actionCol52s = new ArrayList<>();
doReturn(attributeCol52s).when(guidedDecisionTable52).getAttributeCols();
doReturn(metadataCol52s).when(guidedDecisionTable52).getAttributeCols();
doReturn(compositeColumns).when(guidedDecisionTable52).getAttributeCols();
doReturn(actionCol52s).when(guidedDecisionTable52).getAttributeCols();
presenter.refresh();
verify(presenter).refreshAttributeWidget(attributeCol52s);
verify(presenter).refreshMetaDataWidget(metadataCol52s);
verify(presenter).refreshConditionsWidget(compositeColumns);
verify(presenter).refreshActionsWidget(actionCol52s);
}
use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnRefreshAttributesPanelEvent.
@Test
public void testOnRefreshAttributesPanelEvent() {
final RefreshAttributesPanelEvent event = mock(RefreshAttributesPanelEvent.class);
final GuidedDecisionTableView.Presenter eventPresenter = mock(GuidedDecisionTableView.Presenter.class);
final List<AttributeCol52> columns = new ArrayList<>();
doReturn(eventPresenter).when(event).getPresenter();
doReturn(columns).when(event).getColumns();
doNothing().when(presenter).refreshAttributeWidget(any());
doNothing().when(presenter).refreshColumnsNoteInfo(any());
presenter.onRefreshAttributesPanelEvent(event);
verify(presenter).refreshAttributeWidget(columns);
verify(presenter).refreshColumnsNoteInfo(eventPresenter);
}
use of org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterAttributesAndMetadataTest method appendAttributeColumn.
@Test
public void appendAttributeColumn() throws VetoException {
reset(modellerPresenter);
final AttributeCol52 column = new AttributeCol52();
column.setAttribute(RuleAttributeWidget.AUTO_FOCUS_ATTR);
dtPresenter.appendColumn(column);
verify(synchronizer, times(1)).appendColumn(eq(column));
verify(refreshAttributesPanelEvent, times(1)).fire(any(RefreshAttributesPanelEvent.class));
verify(modellerPresenter, times(1)).updateLinks();
}
Aggregations