use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTableMetadataBuilder method populateDecisionTable.
@Override
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) {
final MetadataCol52 column = new MetadataCol52();
final String value = this.definitions.get(headerCol);
column.setHideColumn(true);
column.setMetadata(value);
dtable.getMetadataCols().add(column);
if (this.values.size() < maxRowCount) {
for (int iRow = this.values.size(); iRow < maxRowCount; iRow++) {
this.values.add(new DTCellValue52(""));
}
}
addColumnData(dtable, column);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnSynchronizer method append.
@Override
public void append(final BaseColumnSynchronizer.ColumnMetaData metaData) throws VetoException {
// Check operation is supported
if (!handlesAppend(metaData)) {
return;
}
final MetadataCol52 column = (MetadataCol52) metaData.getColumn();
model.getMetadataCols().add(column);
synchroniseAppendColumn(column);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnSynchronizer method moveColumnsTo.
@Override
public void moveColumnsTo(final List<MoveColumnToMetaData> metaData) throws VetoException {
// Check operation is supported
if (!handlesMoveColumnsTo(metaData)) {
return;
}
final MoveColumnToMetaData md = metaData.get(0);
final MetadataCol52 modelColumn = (MetadataCol52) md.getColumn();
final List<MetadataCol52> modelMetaDataColumns = model.getMetadataCols();
final int modelMetaDataColumnCount = modelMetaDataColumns.size();
if (modelMetaDataColumnCount == 0) {
throw new ModelSynchronizer.MoveVetoException();
}
final List<BaseColumn> allModelColumns = model.getExpandedColumns();
final int minColumnIndex = allModelColumns.indexOf(modelMetaDataColumns.get(0));
final int maxColumnIndex = allModelColumns.indexOf(modelMetaDataColumns.get(modelMetaDataColumnCount - 1));
final int targetColumnIndex = md.getTargetColumnIndex();
final int sourceColumnIndex = md.getSourceColumnIndex();
if (targetColumnIndex < minColumnIndex || targetColumnIndex > maxColumnIndex) {
throw new ModelSynchronizer.MoveVetoException();
}
moveModelData(targetColumnIndex, sourceColumnIndex, sourceColumnIndex);
modelMetaDataColumns.remove(modelColumn);
modelMetaDataColumns.add(targetColumnIndex - minColumnIndex, modelColumn);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnSynchronizer method delete.
@Override
public void delete(final BaseColumnSynchronizer.ColumnMetaData metaData) throws VetoException {
// Check operation is supported
if (!handlesDelete(metaData)) {
return;
}
final MetadataCol52 column = (MetadataCol52) metaData.getColumn();
final int columnIndex = model.getExpandedColumns().indexOf(column);
model.getMetadataCols().remove(column);
synchroniseDeleteColumn(columnIndex);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class ColumnsPagePresenterTest method testOnRefreshMetaDataPanelEvent.
@Test
public void testOnRefreshMetaDataPanelEvent() {
final RefreshMetaDataPanelEvent event = mock(RefreshMetaDataPanelEvent.class);
final GuidedDecisionTableView.Presenter eventPresenter = mock(GuidedDecisionTableView.Presenter.class);
final List<MetadataCol52> columns = new ArrayList<>();
doReturn(eventPresenter).when(event).getPresenter();
doReturn(columns).when(event).getColumns();
doNothing().when(presenter).refreshMetaDataWidget(any());
doNothing().when(presenter).refreshColumnsNoteInfo(any());
presenter.onRefreshMetaDataPanelEvent(event);
verify(presenter).refreshMetaDataWidget(columns);
verify(presenter).refreshColumnsNoteInfo(eventPresenter);
}
Aggregations