Search in sources :

Example 61 with MetadataCol52

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());
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) Test(org.junit.Test)

Example 62 with MetadataCol52

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);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) PriorityListUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.PriorityListUiColumn) Test(org.junit.Test)

Example 63 with MetadataCol52

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;
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) BaseColumnFieldDiff(org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)

Example 64 with MetadataCol52

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());
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Test(org.junit.Test)

Example 65 with MetadataCol52

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());
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) StringUiColumn(org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn) Test(org.junit.Test)

Aggregations

MetadataCol52 (org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52)67 Test (org.junit.Test)52 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)18 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)12 ArrayList (java.util.ArrayList)11 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)10 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)10 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)9 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)9 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)8 DecisionTableSelectionsChangedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectionsChangedEvent)8 DecisionTableSelectedEvent (org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.DecisionTableSelectedEvent)7 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)6 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)6 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)5 GuidedDecisionTableView (org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView)5 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)4 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)4 BaseColumnFieldDiff (org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff)4 CompositeColumn (org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn)4