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