use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class ConditionColumnSynchronizer method removeOtherwiseStates.
// Remove Otherwise state from column cells
private void removeOtherwiseStates(final BaseColumn column) {
final int columnIndex = this.model.getExpandedColumns().indexOf(column);
for (List<DTCellValue52> row : this.model.getData()) {
final DTCellValue52 dcv = row.get(columnIndex);
dcv.setOtherwise(false);
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class ConditionColumnSynchronizer method removeCommaSeparatedValues.
// Convert comma-separated values to the first in the list
private void removeCommaSeparatedValues(final BaseColumn column) {
final int columnIndex = this.model.getExpandedColumns().indexOf(column);
for (List<DTCellValue52> row : this.model.getData()) {
final DTCellValue52 dcv = row.get(columnIndex);
cellUtilities.removeCommaSeparatedValue(dcv);
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method updateDependentEnumerationColumns.
private Set<Integer> updateDependentEnumerationColumns(final GridData.Range rowRange, final int columnIndex) {
final int minRowIndex = rowRange.getMinRowIndex();
final int maxRowIndex = rowRange.getMaxRowIndex();
final Context context = new Context(rowRange.getMinRowIndex(), columnIndex);
final Set<Integer> dependentColumnIndexes = dependentEnumsUtilities.getDependentColumnIndexes(context);
for (int dependentColumnIndex : dependentColumnIndexes) {
for (int rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
final List<DTCellValue52> modelRow = model.getData().get(rowIndex);
final DTCellValue52 modelCell = modelRow.get(dependentColumnIndex);
modelCell.clearValues();
uiModel.deleteCellInternal(rowIndex, dependentColumnIndex);
}
uiModel.indexColumn(dependentColumnIndex);
}
dependentColumnIndexes.add(columnIndex);
return dependentColumnIndexes;
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52 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.models.guided.dtable.shared.model.DTCellValue52 in project drools-wb by kiegroup.
the class ModelSynchronizerImpl method setCellValue.
@Override
public void setCellValue(final GridData.Range rowRange, final int columnIndex, final GridCellValue<?> value) {
final int minRowIndex = rowRange.getMinRowIndex();
final int maxRowIndex = rowRange.getMaxRowIndex();
for (int rowIndex = minRowIndex; rowIndex <= maxRowIndex; rowIndex++) {
final List<DTCellValue52> modelRow = model.getData().get(rowIndex);
final DTCellValue52 modelCell = modelRow.get(columnIndex);
if (value == null) {
modelCell.clearValues();
} else {
modelRow.set(columnIndex, new DTCellValue52(value.getValue()));
}
}
final Set<Integer> columnRange = updateDependentEnumerationColumns(rowRange, columnIndex);
fireValidateEvent(rowRange, columnRange);
}
Aggregations