use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.impl.ConditionColumnSynchronizer.MoveRowToMetaData in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method moveRowsTo.
@Override
@SuppressWarnings("unchecked")
public void moveRowsTo(final int targetRowIndex, final List<GridRow> rows) throws VetoException {
// Generate meta-data to handle moves
final List<MoveRowToMetaData> metaData = new ArrayList<MoveRowToMetaData>();
for (int index = 0; index < rows.size(); index++) {
final GridRow row = rows.get(index);
final int sourceRowIndex = uiModel.getRows().indexOf(row);
if (sourceRowIndex == targetRowIndex) {
throw new MoveVetoException();
}
final List<DTCellValue52> modelRow = model.getData().get(sourceRowIndex);
metaData.add(new MoveRowToMetaDataImpl(sourceRowIndex, targetRowIndex + index, modelRow));
}
final List<Synchronizer> handlers = new ArrayList<Synchronizer>();
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesMoveRowsTo(metaData)) {
handlers.add(synchronizer);
}
}
if (handlers.isEmpty()) {
throw new MoveVetoException();
}
for (Synchronizer synchronizer : handlers) {
synchronizer.moveRowsTo(metaData);
}
}
Aggregations