use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method hasColumnDefinitionsWithMetadataColumn.
@Test
public void hasColumnDefinitionsWithMetadataColumn() {
final MetadataCol52 metadataCol52 = new MetadataCol52();
dtPresenter.getModel().getMetadataCols().add(metadataCol52);
assertTrue(dtPresenter.hasColumnDefinitions());
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnConverterTest method convertRulePriorityColumn.
@Test
public void convertRulePriorityColumn() throws Exception {
final MetadataCol52 metadataCol = new MetadataCol52();
metadataCol.setMetadata(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME);
final GridColumn<?> column = metaDataColumnConverter.convertColumn(metadataCol, mock(GuidedDecisionTablePresenter.Access.class), mock(GuidedDecisionTableView.class));
assertTrue(column instanceof PriorityListUiColumn);
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final BaseColumnSynchronizer.ColumnMetaData originalMetaData, final BaseColumnSynchronizer.ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
final MetadataCol52 originalColumn = (MetadataCol52) originalMetaData.getColumn();
final MetadataCol52 editedColumn = (MetadataCol52) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
update(originalColumn, editedColumn);
final boolean isMetaDataUpdated = BaseColumnFieldDiffImpl.hasChanged(MetadataCol52.FIELD_METADATA, diffs);
final boolean isHideUpdated = BaseColumnFieldDiffImpl.hasChanged(DTColumnConfig52.FIELD_HIDE_COLUMN, diffs);
if (isMetaDataUpdated) {
setColumnHeader(originalColumn, originalColumn.getMetadata());
}
if (isHideUpdated) {
setColumnVisibility(originalColumn, originalColumn.isHideColumn());
}
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class NewGuidedDecisionTableWizardTest method resolvedHitColumnIsAdded.
@Test
public void resolvedHitColumnIsAdded() throws Exception {
final GuidedDecisionTable52 model = whenModelIsCreatedWithHitPolicy(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT);
assertEquals(1, model.getMetadataCols().size());
final MetadataCol52 metadataCol52 = model.getMetadataCols().get(0);
assertEquals(GuidedDecisionTable52.HitPolicy.RESOLVED_HIT_METADATA_NAME, metadataCol52.getMetadata());
}
use of org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52 in project drools-wb by kiegroup.
the class MetaDataColumnSynchronizerTest method testMoveColumnTo_MoveLeft.
@Test
public void testMoveColumnTo_MoveLeft() throws VetoException {
final MetadataCol52 column1 = new MetadataCol52();
column1.setMetadata("metadata1");
final MetadataCol52 column2 = new MetadataCol52();
column2.setMetadata("metadata2");
modelSynchronizer.appendColumn(column1);
modelSynchronizer.appendColumn(column2);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new BaseGridCellValue<String>("metadata1"));
uiModel.setCellValue(0, 3, new BaseGridCellValue<String>("metadata2"));
assertEquals(2, model.getMetadataCols().size());
assertEquals(column1, model.getMetadataCols().get(0));
assertEquals(column2, model.getMetadataCols().get(1));
assertEquals("metadata1", model.getData().get(0).get(2).getStringValue());
assertEquals("metadata2", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_1 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_1 = uiModel.getColumns().get(3);
assertEquals("metadata1", uiModelColumn1_1.getHeaderMetaData().get(0).getTitle());
assertEquals("metadata2", uiModelColumn2_1.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_1 instanceof StringUiColumn);
assertTrue(uiModelColumn2_1 instanceof StringUiColumn);
assertEquals(2, uiModelColumn1_1.getIndex());
assertEquals(3, uiModelColumn2_1.getIndex());
assertEquals("metadata1", uiModel.getRow(0).getCells().get(uiModelColumn1_1.getIndex()).getValue().getValue());
assertEquals("metadata2", uiModel.getRow(0).getCells().get(uiModelColumn2_1.getIndex()).getValue().getValue());
uiModel.moveColumnTo(2, uiModelColumn2_1);
assertEquals(2, model.getMetadataCols().size());
assertEquals(column2, model.getMetadataCols().get(0));
assertEquals(column1, model.getMetadataCols().get(1));
assertEquals("metadata2", model.getData().get(0).get(2).getStringValue());
assertEquals("metadata1", model.getData().get(0).get(3).getStringValue());
assertEquals(4, uiModel.getColumns().size());
final GridColumn<?> uiModelColumn1_2 = uiModel.getColumns().get(2);
final GridColumn<?> uiModelColumn2_2 = uiModel.getColumns().get(3);
assertEquals("metadata2", uiModelColumn1_2.getHeaderMetaData().get(0).getTitle());
assertEquals("metadata1", uiModelColumn2_2.getHeaderMetaData().get(0).getTitle());
assertTrue(uiModelColumn1_2 instanceof StringUiColumn);
assertTrue(uiModelColumn2_2 instanceof StringUiColumn);
assertEquals(3, uiModelColumn1_2.getIndex());
assertEquals(2, uiModelColumn2_2.getIndex());
assertEquals("metadata2", uiModel.getRow(0).getCells().get(uiModelColumn1_2.getIndex()).getValue().getValue());
assertEquals("metadata1", uiModel.getRow(0).getCells().get(uiModelColumn2_2.getIndex()).getValue().getValue());
}
Aggregations