use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class SalienceSynchronizer method setSalienceByRowNumbers.
private void setSalienceByRowNumbers(final AttributeCol52 modelColumn, final int iModelColumn) {
// If Salience values are reverse order derive them and update column
int salience = (modelColumn.isReverseOrder() ? model.getData().size() : 1);
for (int rowNumber = 0; rowNumber < model.getData().size(); rowNumber++) {
final List<DTCellValue52> modelRow = model.getData().get(rowNumber);
final DTCellValue52 modelCell = modelRow.get(iModelColumn);
modelCell.setNumericValue(salience);
uiModel.setCellValueInternal(rowNumber, iModelColumn, gridWidgetCellFactory.convertCell(modelCell, modelColumn, cellUtilities, columnUtilities));
if (modelColumn.isReverseOrder()) {
salience--;
} else {
salience++;
}
}
uiModel.indexColumn(iModelColumn);
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class BRLActionColumnDefinitionBuilder method makeRowData.
private List<DTCellValue52> makeRowData(final ColumnUtilities columnUtilities, final BRLActionColumn brlColumn) {
final List<DTCellValue52> row = new ArrayList<>();
row.add(new DTCellValue52(1));
row.add(new DTCellValue52("desc"));
for (BRLActionVariableColumn brlVariableColumn : brlColumn.getChildColumns()) {
final DataType.DataTypes dataType = columnUtilities.getDataType(brlVariableColumn);
row.add(makeCell(dataType));
}
return row;
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class BRLActionColumnSynchronizer method update.
@Override
public List<BaseColumnFieldDiff> update(final ColumnMetaData originalMetaData, final ColumnMetaData editedMetaData) throws VetoException {
// Check operation is supported
if (!(handlesUpdate(originalMetaData) && handlesUpdate(editedMetaData))) {
return Collections.emptyList();
}
final BRLActionColumn originalColumn = (BRLActionColumn) originalMetaData.getColumn();
final BRLActionColumn editedColumn = (BRLActionColumn) editedMetaData.getColumn();
final List<BaseColumnFieldDiff> diffs = originalColumn.diff(editedColumn);
// Copy existing data for re-use if applicable
final Map<String, List<DTCellValue52>> originalColumnsData = new HashMap<String, List<DTCellValue52>>();
for (BRLActionVariableColumn variable : originalColumn.getChildColumns()) {
int iColumnIndex = model.getExpandedColumns().indexOf(variable);
final List<DTCellValue52> originalColumnData = new ArrayList<DTCellValue52>();
final String key = makeUpdateBRLActionColumnKey(variable);
for (List<DTCellValue52> row : model.getData()) {
originalColumnData.add(row.get(iColumnIndex));
}
originalColumnsData.put(key, originalColumnData);
}
// Insert new columns setting data from that above, if applicable. Column visibility is handled here too.
model.getActionCols().add(model.getActionCols().indexOf(originalColumn), editedColumn);
for (BRLActionVariableColumn childModelColumn : editedColumn.getChildColumns()) {
final String key = makeUpdateBRLActionColumnKey(childModelColumn);
if (originalColumnsData.containsKey(key)) {
final List<DTCellValue52> originalColumnData = originalColumnsData.get(key);
synchroniseAppendColumn(childModelColumn, originalColumnData);
} else {
synchroniseAppendColumn(childModelColumn);
}
}
// Delete columns for the original definition
delete(originalMetaData);
return diffs;
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class DTCellValueWidgetFactoryTest method setUp.
@Before
public void setUp() throws Exception {
ApplicationPreferences.setUp(new HashMap<String, String>() {
{
put(ApplicationPreferences.DATE_FORMAT, "dd-MM-yyyy");
}
});
when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
factory = DTCellValueWidgetFactory.getInstance(model, oracle, false, false);
insertFactCol52 = new ActionInsertFactCol52();
cellValue = new DTCellValue52();
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class AuditLogEntryCellHelperTest method getSafeHtml_ActionRetract.
@Test
public void getSafeHtml_ActionRetract() {
ActionRetractFactCol52 originalColumn = new ActionRetractFactCol52();
originalColumn.setHeader("action1");
originalColumn.setHideColumn(false);
originalColumn.setDefaultValue(new DTCellValue52("def1"));
ActionRetractFactCol52 newColumn = new ActionRetractFactCol52();
newColumn.setHeader("action2");
newColumn.setHideColumn(true);
newColumn.setDefaultValue(new DTCellValue52("def2"));
List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
assertEquals(getHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
Aggregations