Search in sources :

Example 11 with MetadataCol52

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

Example 12 with MetadataCol52

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

Example 13 with MetadataCol52

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

Example 14 with MetadataCol52

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

Example 15 with MetadataCol52

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);
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) RefreshMetaDataPanelEvent(org.drools.workbench.screens.guided.dtable.client.widget.table.events.cdi.RefreshMetaDataPanelEvent) ArrayList(java.util.ArrayList) GuidedDecisionTableView(org.drools.workbench.screens.guided.dtable.client.widget.table.GuidedDecisionTableView) 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