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);
}
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++;
}
}
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;
}
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);
}
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);
}
Aggregations