Search in sources :

Example 51 with DTCellValue52

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

the class ConditionColumnSynchronizer method removeOtherwiseStates.

// Remove Otherwise state from column cells
private void removeOtherwiseStates(final BaseColumn column) {
    final int columnIndex = this.model.getExpandedColumns().indexOf(column);
    for (List<DTCellValue52> row : this.model.getData()) {
        final DTCellValue52 dcv = row.get(columnIndex);
        dcv.setOtherwise(false);
    }
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 52 with DTCellValue52

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

the class ConditionColumnSynchronizer method removeCommaSeparatedValues.

// Convert comma-separated values to the first in the list
private void removeCommaSeparatedValues(final BaseColumn column) {
    final int columnIndex = this.model.getExpandedColumns().indexOf(column);
    for (List<DTCellValue52> row : this.model.getData()) {
        final DTCellValue52 dcv = row.get(columnIndex);
        cellUtilities.removeCommaSeparatedValue(dcv);
    }
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 53 with DTCellValue52

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

the class ModelSynchronizerImpl method updateDependentEnumerationColumns.

private Set<Integer> updateDependentEnumerationColumns(final GridData.Range rowRange, final int columnIndex) {
    final int minRowIndex = rowRange.getMinRowIndex();
    final int maxRowIndex = rowRange.getMaxRowIndex();
    final Context context = new Context(rowRange.getMinRowIndex(), columnIndex);
    final Set<Integer> dependentColumnIndexes = dependentEnumsUtilities.getDependentColumnIndexes(context);
    for (int dependentColumnIndex : dependentColumnIndexes) {
        for (int rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
            final List<DTCellValue52> modelRow = model.getData().get(rowIndex);
            final DTCellValue52 modelCell = modelRow.get(dependentColumnIndex);
            modelCell.clearValues();
            uiModel.deleteCellInternal(rowIndex, dependentColumnIndex);
        }
        uiModel.indexColumn(dependentColumnIndex);
    }
    dependentColumnIndexes.add(columnIndex);
    return dependentColumnIndexes;
}
Also used : Context(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.DependentEnumsUtilities.Context) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 54 with DTCellValue52

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

the class ModelSynchronizerImpl method moveRowsTo.

@Override
@SuppressWarnings("unchecked")
public void moveRowsTo(final int targetRowIndex, final List<GridRow> rows) throws VetoException {
    // Generate meta-data to handle moves
    final List<MoveRowToMetaData> metaData = new ArrayList<MoveRowToMetaData>();
    for (int index = 0; index < rows.size(); index++) {
        final GridRow row = rows.get(index);
        final int sourceRowIndex = uiModel.getRows().indexOf(row);
        if (sourceRowIndex == targetRowIndex) {
            throw new MoveVetoException();
        }
        final List<DTCellValue52> modelRow = model.getData().get(sourceRowIndex);
        metaData.add(new MoveRowToMetaDataImpl(sourceRowIndex, targetRowIndex + index, modelRow));
    }
    final List<Synchronizer> handlers = new ArrayList<Synchronizer>();
    for (Synchronizer synchronizer : synchronizers) {
        if (synchronizer.handlesMoveRowsTo(metaData)) {
            handlers.add(synchronizer);
        }
    }
    if (handlers.isEmpty()) {
        throw new MoveVetoException();
    }
    for (Synchronizer synchronizer : handlers) {
        synchronizer.moveRowsTo(metaData);
    }
}
Also used : Synchronizer(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer) ModelSynchronizer(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.ModelSynchronizer) MoveRowToMetaData(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.impl.ConditionColumnSynchronizer.MoveRowToMetaData) ArrayList(java.util.ArrayList) MoveRowToMetaDataImpl(org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.impl.ConditionColumnSynchronizer.MoveRowToMetaDataImpl) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow)

Example 55 with DTCellValue52

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

the class ModelSynchronizerImpl method setCellValue.

@Override
public void setCellValue(final GridData.Range rowRange, final int columnIndex, final GridCellValue<?> value) {
    final int minRowIndex = rowRange.getMinRowIndex();
    final int maxRowIndex = rowRange.getMaxRowIndex();
    for (int rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
        final List<DTCellValue52> modelRow = model.getData().get(rowIndex);
        final DTCellValue52 modelCell = modelRow.get(columnIndex);
        if (value == null) {
            modelCell.clearValues();
        } else {
            modelRow.set(columnIndex, new DTCellValue52(value.getValue()));
        }
    }
    final Set<Integer> columnRange = updateDependentEnumerationColumns(rowRange, columnIndex);
    fireValidateEvent(rowRange, columnRange);
}
Also used : DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

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