Search in sources :

Example 76 with DTCellValue52

use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.

the class GuidedDecisionTableSalienceBuilder method populateDecisionTable.

@Override
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) {
    final AttributeCol52 column = new AttributeCol52();
    column.setAttribute(GuidedDecisionTable52.SALIENCE_ATTR);
    // If sequential set column to use reverse row number
    if (isSequential) {
        column.setUseRowNumber(true);
        column.setReverseOrder(true);
        final int maxRow = this.values.size();
        for (int iRow = 0; iRow < maxRow; iRow++) {
            final DTCellValue52 dcv = this.values.get(iRow);
            dcv.setNumericValue(Integer.valueOf(maxRow - iRow));
        }
    }
    dtable.getAttributeCols().add(column);
    if (this.values.size() < maxRowCount) {
        for (int iRow = this.values.size(); iRow < maxRowCount; iRow++) {
            final DTCellValue52 dcv = new DTCellValue52(0);
            this.values.add(dcv);
        }
    }
    addColumnData(dtable, column);
}
Also used : AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 77 with DTCellValue52

use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.

the class GuidedDecisionTableTimerBuilder method addCellValue.

@Override
public void addCellValue(final int row, final int column, final String value) {
    final DTCellValue52 dcv = new DTCellValue52(value.trim());
    this.values.add(dcv);
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 78 with DTCellValue52

use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.

the class IndexedParametersValueBuilder method addCellValue.

public void addCellValue(final int row, final int column, final String value) {
    final List<String> cellVals = split(value);
    final List<DTCellValue52> rowValues = new ArrayList<DTCellValue52>();
    for (int parameterIndex = 0; parameterIndex < getParameters().size(); parameterIndex++) {
        final String cv = cellVals.size() > parameterIndex ? cellVals.get(parameterIndex).trim() : "";
        rowValues.add(new DTCellValue52(cv));
    }
    this.values.add(rowValues);
}
Also used : ArrayList(java.util.ArrayList) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 79 with DTCellValue52

use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.

the class RowNumberBuilder method populateDecisionTable.

@Override
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) {
    if (this.values.size() < maxRowCount) {
        for (int iRow = this.values.size(); iRow < maxRowCount; iRow++) {
            this.values.add(new DTCellValue52(0));
        }
    }
    for (int iRow = 0; iRow < this.values.size(); iRow++) {
        dtable.getData().add(new ArrayList<DTCellValue52>());
        final DTCellValue52 dcv = this.values.get(iRow);
        dcv.setNumericValue(Integer.valueOf(iRow + 1));
        dtable.getData().get(iRow).add(0, dcv);
    }
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 80 with DTCellValue52

use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.

the class PrioritySynchronizer method update.

public void update(final int rowNumberColumnIndex, final RowNumberChanges rowNumberChanges) {
    if (!GuidedDecisionTable52.HitPolicy.RESOLVED_HIT.equals(model.getHitPolicy())) {
        return;
    }
    final Optional<BaseColumnInfo> optional = getPriorityColumnInfo();
    if (optional.isPresent()) {
        final BaseColumnInfo baseColumnInfo = optional.get();
        for (final List<DTCellValue52> row : model.getData()) {
            final DTCellValue52 dtCellValue52 = row.get(baseColumnInfo.getColumnIndex());
            final int oldValue = getNumber(dtCellValue52);
            final int rowNumber = row.get(rowNumberColumnIndex).getNumericValue().intValue() - 1;
            if (oldValue != 0) {
                GuidedDecisionTableUiCell newUiCell;
                if (oldValue > rowNumber || rowNumberChanges.get(oldValue) > rowNumber) {
                    newUiCell = new GuidedDecisionTableUiCell<>("");
                } else {
                    dtCellValue52.setStringValue(Integer.toString(rowNumberChanges.get(oldValue)));
                    newUiCell = gridWidgetCellFactory.convertCell(dtCellValue52, baseColumnInfo.getBaseColumn(), cellUtilities, columnUtilities);
                }
                uiModel.setCellValueInternal(rowNumber, baseColumnInfo.getColumnIndex(), newUiCell);
            }
        }
    }
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) GuidedDecisionTableUiCell(org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiCell)

Aggregations

DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)244 Test (org.junit.Test)121 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)53 ArrayList (java.util.ArrayList)51 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)46 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)46 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)39 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)39 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)30 List (java.util.List)29 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)28 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)27 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)25 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)24 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)23 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)21 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)20 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)20 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)20 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)20