Search in sources :

Example 51 with BaseColumn

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

the class CellUpdateManagerBase method getCellValue.

private DTCellValue52 getCellValue() {
    final DTCellValue52 cell = model.getData().get(coordinate.getRow()).get(coordinate.getCol());
    final BaseColumn baseColumn = model.getExpandedColumns().get(coordinate.getCol());
    return getRealCellValue((DTColumnConfig52) baseColumn, cell);
}
Also used : BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 52 with BaseColumn

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

the class PatternRowBuilder method build.

public void build(final NotificationReporter notificationReporter) {
    final List<BaseColumn> expandedColumns = dtable.getExpandedColumns();
    for (; sourceIndex < expandedColumns.size(); sourceIndex++) {
        final BaseColumn baseColumn = expandedColumns.get(sourceIndex);
        if (Skipper.shouldSkip(notificationReporter, baseColumn)) {
            // Ignore row column and do not up the columnIndex
            continue;
        } else if (baseColumn instanceof BRLActionVariableColumn) {
            sourceIndex = sourceIndex + dtable.getBRLColumn((BRLActionVariableColumn) baseColumn).getChildColumns().size() - 1;
        } else if (baseColumn instanceof BRLConditionVariableColumn) {
            addBRLConditionVariableColumn((BRLConditionVariableColumn) baseColumn);
        } else if (baseColumn instanceof ConditionCol52) {
            addConditionCol52((ConditionCol52) baseColumn);
        }
        columnIndex++;
    }
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) BRLActionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn) BRLConditionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)

Example 53 with BaseColumn

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

the class DefaultValueDropDownManager method getCurrentValueMap.

@Override
public Map<String, String> getCurrentValueMap(Context context) {
    Map<String, String> currentValueMap = new HashMap<String, String>();
    final Pattern52 basePattern = context.getBasePattern();
    final BaseColumn baseColumn = context.getBaseColumn();
    // Get values for all Constraints or Actions on the same pattern as the baseColumn
    if (baseColumn instanceof ConditionCol52 && basePattern != null) {
        for (ConditionCol52 cc : basePattern.getChildColumns()) {
            currentValueMap.put(cc.getFactField(), getValue(cc));
        }
    } else if (baseColumn instanceof ActionSetFieldCol52) {
        ActionSetFieldCol52 baseActionColumn = (ActionSetFieldCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionSetFieldCol52) {
                final ActionSetFieldCol52 asf = (ActionSetFieldCol52) ac;
                if (asf.getBoundName().equals(binding)) {
                    currentValueMap.put(asf.getFactField(), getValue(asf));
                }
            }
        }
    } else if (baseColumn instanceof ActionInsertFactCol52) {
        ActionInsertFactCol52 baseActionColumn = (ActionInsertFactCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionInsertFactCol52) {
                final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac;
                if (aif.getBoundName().equals(binding)) {
                    currentValueMap.put(aif.getFactField(), getValue(aif));
                }
            }
        }
    }
    return currentValueMap;
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) HashMap(java.util.HashMap) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 54 with BaseColumn

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

the class ConditionColumnSynchronizer method doMoveSingleCondition.

// Move a single Condition column; it must remain within the bounds of it's parent Pattern's columns
private void doMoveSingleCondition(final MoveColumnToMetaData metaData) throws VetoException {
    final ConditionCol52 modelColumn = (ConditionCol52) metaData.getColumn();
    final Pattern52 modelPattern = model.getPattern(modelColumn);
    if (modelPattern == null) {
        throw new ModelSynchronizer.MoveVetoException();
    }
    final List<ConditionCol52> modelPatternConditionColumns = modelPattern.getChildColumns();
    final int modelPatternConditionColumnCount = modelPatternConditionColumns.size();
    if (modelPatternConditionColumnCount == 0) {
        throw new ModelSynchronizer.MoveVetoException();
    }
    final List<BaseColumn> allModelColumns = model.getExpandedColumns();
    final int minColumnIndex = allModelColumns.indexOf(modelPatternConditionColumns.get(0));
    final int maxColumnIndex = allModelColumns.indexOf(modelPatternConditionColumns.get(modelPatternConditionColumnCount - 1));
    final int targetColumnIndex = metaData.getTargetColumnIndex();
    final int sourceColumnIndex = metaData.getSourceColumnIndex();
    if (targetColumnIndex < minColumnIndex || targetColumnIndex > maxColumnIndex) {
        throw new ModelSynchronizer.MoveVetoException();
    }
    moveModelData(targetColumnIndex, sourceColumnIndex, sourceColumnIndex);
    modelPatternConditionColumns.remove(modelColumn);
    modelPatternConditionColumns.add(targetColumnIndex - minColumnIndex, modelColumn);
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)

Example 55 with BaseColumn

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

the class LimitedEntryBRLActionColumnSynchronizer 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 LimitedEntryBRLActionColumn modelColumn = (LimitedEntryBRLActionColumn) md.getColumn();
    final List<ActionCol52> modelActionColumns = model.getActionCols();
    final int modelActionColumnCount = modelActionColumns.size();
    if (modelActionColumnCount == 0) {
        throw new ModelSynchronizer.MoveVetoException();
    }
    final List<BaseColumn> allModelColumns = model.getExpandedColumns();
    final int minColumnIndex = allModelColumns.indexOf(modelActionColumns.get(0));
    final int maxColumnIndex = allModelColumns.indexOf(modelActionColumns.get(modelActionColumnCount - 1));
    final int targetColumnIndex = md.getTargetColumnIndex();
    final int sourceColumnIndex = md.getSourceColumnIndex();
    if (targetColumnIndex < minColumnIndex || targetColumnIndex > maxColumnIndex) {
        throw new ModelSynchronizer.MoveVetoException();
    }
    moveModelData(targetColumnIndex, sourceColumnIndex, sourceColumnIndex);
    modelActionColumns.remove(modelColumn);
    modelActionColumns.add(targetColumnIndex - minColumnIndex, modelColumn);
}
Also used : LimitedEntryBRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryBRLActionColumn) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)

Aggregations

BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)126 Test (org.junit.Test)72 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)57 ArrayList (java.util.ArrayList)55 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)44 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)34 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)33 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)29 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)26 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)25 List (java.util.List)23 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)23 CompositeColumn (org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn)23 BRLConditionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn)21 RuleNameColumn (org.drools.workbench.models.guided.dtable.shared.model.RuleNameColumn)21 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)20 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)20 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)20 BRLActionColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn)19 BRLActionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn)19