use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer 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);
}
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method insertRow.
@Override
public void insertRow(final int rowIndex) throws VetoException {
final MetaData metaData = new RowSynchronizer.RowMetaDataImpl(rowIndex);
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesInsert(metaData)) {
synchronizer.insert(metaData);
break;
}
}
fireInsertRowEvent(rowIndex);
systemControlledColumnValuesSynchronizer.insertRow(rowIndex);
fireUpdateColumnDataEvent();
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method appendRow.
@Override
@SuppressWarnings("unchecked")
public void appendRow() throws VetoException {
final MetaData metaData = new RowSynchronizer.RowMetaDataImpl();
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesAppend(metaData)) {
synchronizer.append(metaData);
break;
}
}
fireAppendRowEvent();
systemControlledColumnValuesSynchronizer.appendRow();
fireUpdateColumnDataEvent();
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method appendColumn.
@Override
@SuppressWarnings("unchecked")
public void appendColumn(final BaseColumn column) throws VetoException {
final MetaData metaData = new BaseColumnSynchronizer.ColumnMetaDataImpl(column);
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesAppend(metaData)) {
synchronizer.append(metaData);
break;
}
}
fireAfterColumnInsertedEvent(column);
}
use of org.drools.workbench.screens.guided.dtable.client.widget.table.model.synchronizers.Synchronizer in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method updateColumn.
@Override
@SuppressWarnings("unchecked")
public List<BaseColumnFieldDiff> updateColumn(final Pattern52 originalPattern, final ConditionCol52 originalColumn, final Pattern52 editedPattern, final ConditionCol52 editedColumn) throws VetoException {
final PatternConditionMetaData originalMetaData = new PatternConditionMetaData(originalPattern, originalColumn);
final PatternConditionMetaData editedMetaData = new PatternConditionMetaData(editedPattern, editedColumn);
for (Synchronizer synchronizer : synchronizers) {
if (synchronizer.handlesUpdate(originalMetaData)) {
return synchronizer.update(originalMetaData, editedMetaData);
}
}
return Collections.emptyList();
}
Aggregations