use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiCell 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);
}
}
}
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.GuidedDecisionTableUiCell in project drools-wb by kiegroup.
the class ConditionColumnSynchronizerTest method testOtherwise.
@Test
public void testOtherwise() throws VetoException {
// Single Pattern, single Condition
final Pattern52 pattern = boundApplicantPattern("$a");
final ConditionCol52 condition = nameEqualsCondition();
modelSynchronizer.appendColumn(pattern, condition);
modelSynchronizer.appendRow();
uiModel.setCellValue(0, 2, new GuidedDecisionTableUiCell("John"));
modelSynchronizer.appendRow();
uiModel.setCellValue(1, 2, new GuidedDecisionTableUiCell("George"));
modelSynchronizer.setCellOtherwiseState(1, 2);
assertFalse(((GuidedDecisionTableUiCell) uiModel.getCell(0, 2).getValue()).isOtherwise());
assertTrue(((GuidedDecisionTableUiCell) uiModel.getCell(1, 2).getValue()).isOtherwise());
}
Aggregations