use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method testCanvasCommandUndoWithColumns.
@Test
public void testCanvasCommandUndoWithColumns() {
relation.getColumn().add(new InformationItem());
relation.getRow().add(new org.kie.workbench.common.dmn.api.definition.v1_1.List());
uiModel.appendColumn(uiModelColumn);
uiModel.appendRow(new DMNGridRow());
uiModelMapper.fromDMNModel(0, 0);
// Add Graph column first as RelationUIModelMapper relies on the model being first updated
command.newGraphCommand(handler).execute(gce);
// Add column and then undo
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
reset(command, canvasOperation);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.undo(handler));
assertEquals(2, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
assertEquals(uiModelColumn, uiModel.getColumns().get(1));
assertEquals(1, uiModel.getRowCount());
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method setup.
@Before
public void setup() {
this.relation = new Relation();
this.row = new List();
this.uiModelRow = new DMNGridRow();
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
makeCommand(0);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class BaseMoveCommandsTest method addUiModelRow.
protected void addUiModelRow(final int rowIndex) {
final DMNGridRow uiRow = new DMNGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class DeleteRelationColumnCommandTest method testCanvasCommandExecuteWithRows.
@Test
public void testCanvasCommandExecuteWithRows() {
relation.getRow().add(new List());
relation.getRow().get(0).getExpression().add(new LiteralExpression());
uiModel.appendRow(new DMNGridRow());
uiModelMapper.fromDMNModel(0, 0);
uiModelMapper.fromDMNModel(0, 1);
makeCommand();
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
assertEquals(1, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
assertEquals(1, uiModel.getRowCount());
assertEquals(1, uiModel.getRows().get(0).getCells().size());
assertEquals(1, uiModel.getCell(0, 0).getValue().getValue());
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method setup.
@Before
public void setup() {
this.relation = new Relation();
this.relation.getRow().add(new List());
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector);
makeCommand(0);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
}
Aggregations