use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.data.Coordinate in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method fireValidateEvent.
protected void fireValidateEvent(final GridData.Range rowRange, final Set<Integer> columnRange) {
final int minRowIndex = rowRange.getMinRowIndex();
final int maxRowIndex = rowRange.getMaxRowIndex();
final List<Coordinate> updates = new ArrayList<>();
for (final Integer columnIndex : columnRange) {
for (int rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
updates.add(new Coordinate(rowIndex, columnIndex));
}
}
final ValidateEvent event = new ValidateEvent(updates);
eventBus.fireEvent(event);
}
use of org.kie.workbench.common.widgets.decoratedgrid.client.widget.data.Coordinate in project drools-wb by kiegroup.
the class TemplateDataTableWidget method onUpdateModel.
public void onUpdateModel(UpdateModelEvent event) {
// Copy data into the underlying model
Map<Coordinate, List<List<CellValue<? extends Comparable<?>>>>> updates = event.getUpdates();
for (Map.Entry<Coordinate, List<List<CellValue<? extends Comparable<?>>>>> e : updates.entrySet()) {
// Coordinate of change
Coordinate originCoordinate = e.getKey();
int originRowIndex = originCoordinate.getRow();
int originColumnIndex = originCoordinate.getCol();
// Changed data
List<List<CellValue<? extends Comparable<?>>>> data = e.getValue();
InterpolationVariable[] vars = model.getInterpolationVariablesList();
for (int iRow = 0; iRow < data.size(); iRow++) {
List<CellValue<? extends Comparable<?>>> rowData = data.get(iRow);
int targetRowIndex = originRowIndex + iRow;
for (int iCol = 0; iCol < rowData.size(); iCol++) {
int targetColumnIndex = originColumnIndex + iCol;
CellValue<? extends Comparable<?>> changedCell = rowData.get(iCol);
InterpolationVariable var = vars[targetColumnIndex];
TemplateDataColumn col = new TemplateDataColumn(var.getVarName(), var.getDataType(), var.getFactType(), var.getFactField());
String dcv = cellValueFactory.convertToModelCell(col, changedCell);
List<String> columnData = model.getTable().get(var.getVarName());
columnData.set(targetRowIndex, dcv);
}
}
}
}
Aggregations