use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class RowSynchronizer method append.
@Override
public void append(final RowMetaData metaData) throws VetoException {
if (!handlesAppend(metaData)) {
return;
}
final List<DTCellValue52> modelRow = new ArrayList<DTCellValue52>();
model.getData().add(modelRow);
final GridRow uiModelRow = new BaseGridRow(GuidedDecisionTableView.ROW_HEIGHT);
uiModel.appendRow(uiModelRow);
final int rowIndex = uiModel.getRowCount() - 1;
initialiseRowData(rowIndex);
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class SystemControlledColumnValuesSynchronizer method updateRowNumberColumnValues.
/**
* Update Row Number column values
*/
private void updateRowNumberColumnValues(final RowNumberCol52 modelColumn, final PostSyncOperation postSyncOperation) {
final PrioritySynchronizer.RowNumberChanges rowNumberChanges = new PrioritySynchronizer.RowNumberChanges();
final int iModelColumn = model.getExpandedColumns().indexOf(modelColumn);
for (int rowNumber = 0; rowNumber < model.getData().size(); rowNumber++) {
final List<DTCellValue52> modelRow = model.getData().get(rowNumber);
final DTCellValue52 modelCell = modelRow.get(iModelColumn);
final int oldRowNumber = (Integer) modelCell.getNumericValue();
final int newRowNumber = rowNumber + 1;
rowNumberChanges.put(oldRowNumber, newRowNumber);
modelCell.setNumericValue(newRowNumber);
uiModel.setCellValueInternal(rowNumber, iModelColumn, gridWidgetCellFactory.convertCell(modelCell, modelColumn, cellUtilities, columnUtilities));
}
postSyncOperation.execute(iModelColumn, rowNumberChanges);
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class GuidedDecisionTablePopulater method createActionRetractFactChildColumns.
private void createActionRetractFactChildColumns(final ActionRetractFact arf, final BRLActionColumn column, final List<BRLVariableColumn> variableColumns) {
// Check whether the ActionRetractFact column has been defined as a parameter in the XLS.
// This is unsupported in the Guided Rule Editor (Guided Decision Table Editor BRLFragments)
// and hence the source column needs to be updated to reflect what is supported.
final String var = arf.getVariableName();
final Set<String> templateKeys = parameterUtilities.extractTemplateKeys(var);
final String templateKey = templateKeys.isEmpty() ? var : templateKeys.iterator().next();
final List<ParameterizedValueBuilder> valueBuilders = getOrderedValueBuilders();
for (BRLVariableColumn variableColumn : variableColumns) {
if (templateKey.equals(variableColumn.getVarName())) {
final BRLActionVariableColumn source = (BRLActionVariableColumn) variableColumn;
final BRLActionVariableColumn target = new BRLActionVariableColumn(templateKey, DataType.TYPE_BOOLEAN);
target.setHeader(source.getHeader());
target.setHideColumn(source.isHideColumn());
column.getChildColumns().add(target);
for (GuidedDecisionTableSourceBuilder sb : sourceBuilders) {
if (sb instanceof GuidedDecisionTableRHSBuilder) {
final GuidedDecisionTableRHSBuilder rhs = (GuidedDecisionTableRHSBuilder) sb;
for (ParameterizedValueBuilder pvb : rhs.getValueBuilders().values()) {
if (pvb.getParameters().contains(templateKey)) {
Optional<String> firstBinding = Optional.empty();
final int pvbIndex = pvb.getParameters().indexOf(templateKey);
final List<List<DTCellValue52>> pvbData = pvb.getColumnData();
for (int iRowIndex = 0; iRowIndex < pvbData.size(); iRowIndex++) {
final List<DTCellValue52> pvbRow = pvbData.get(iRowIndex);
final String binding = pvbRow.get(pvbIndex).getStringValue();
if (!(binding == null || binding.isEmpty())) {
if (!arf.getVariableName().equals(binding)) {
final int _rowIndex = ruleRowStartIndex + iRowIndex + 1;
final int _columnIndex = ruleColumnStartIndex + valueBuilders.indexOf(pvb) + 1;
if (firstBinding.isPresent()) {
addConversionMessage("Removing Retract binding for " + binding + ". See previous conversion messages for details.", _rowIndex, _columnIndex);
pvbRow.get(pvbIndex).clearValues();
} else {
addConversionMessage("Setting Retract to use first binding, " + binding + ". Others will be removed.", _rowIndex, _columnIndex);
arf.setVariableName(binding);
pvbRow.get(pvbIndex).setBooleanValue(true);
firstBinding = Optional.of(binding);
}
}
}
}
break;
}
}
}
}
break;
}
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class GuidedDecisionTableActivationGroupBuilder method populateDecisionTable.
@Override
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) {
final AttributeCol52 column = new AttributeCol52();
column.setAttribute(GuidedDecisionTable52.ACTIVATION_GROUP_ATTR);
dtable.getAttributeCols().add(column);
if (this.values.size() < maxRowCount) {
for (int iRow = this.values.size(); iRow < maxRowCount; iRow++) {
this.values.add(new DTCellValue52(""));
}
}
addColumnData(dtable, column);
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class GuidedDecisionTableAgendaGroupBuilder method populateDecisionTable.
@Override
public void populateDecisionTable(final GuidedDecisionTable52 dtable, final int maxRowCount) {
final AttributeCol52 column = new AttributeCol52();
column.setAttribute(GuidedDecisionTable52.AGENDA_GROUP_ATTR);
dtable.getAttributeCols().add(column);
if (this.values.size() < maxRowCount) {
for (int iRow = this.values.size(); iRow < maxRowCount; iRow++) {
this.values.add(new DTCellValue52(""));
}
}
addColumnData(dtable, column);
}
Aggregations