use of org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler in project kie-wb-common by kiegroup.
the class DeleteParameterBindingCommandTest method testCanvasCommandExecuteDeleteOneOfThree.
@Test
public void testCanvasCommandExecuteDeleteOneOfThree() {
final Binding secondBinding = new Binding();
final Binding thirdBinding = new Binding();
invocation.getBinding().add(secondBinding);
invocation.getBinding().add(thirdBinding);
final BaseGridRow secondRow = new BaseGridRow();
final BaseGridRow thirdRow = new BaseGridRow();
uiModel.appendRow(secondRow);
uiModel.appendRow(thirdRow);
makeCommand(1);
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
assertEquals(2, uiModel.getRowCount());
assertEquals(uiGridRow, uiModel.getRow(0));
assertEquals(thirdRow, uiModel.getRow(1));
assertEquals(3, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
assertEquals(uiNameColumn, uiModel.getColumns().get(1));
assertEquals(uiExpressionEditorColumn, uiModel.getColumns().get(2));
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler in project kie-wb-common by kiegroup.
the class AddRelationRowCommandTest method testCanvasCommandExecuteWithColumns.
@Test
public void testCanvasCommandExecuteWithColumns() {
relation.getRow().add(new List());
relation.getRow().add(new List());
relation.getColumn().add(new InformationItem());
uiModel.appendColumn(uiModelColumn);
uiModel.appendRow(new DMNGridRow());
uiModel.appendRow(new DMNGridRow());
makeCommand(1);
// Add Graph row first as RelationUIModelMapper relies on the model being first updated
command.newGraphCommand(handler).execute(gce);
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
assertEquals(3, uiModel.getRowCount());
assertEquals(uiModelRow, uiModel.getRows().get(1));
assertEquals(2, uiModel.getColumnCount());
assertEquals(uiRowNumberColumn, uiModel.getColumns().get(0));
// checking just the row added by command
assertEquals(uiModelColumn, uiModel.getColumns().get(1));
assertEquals(2, uiModel.getRows().get(1).getCells().size());
assertEquals(2, uiModel.getCell(1, 0).getValue().getValue());
assertEquals("", uiModel.getCell(1, 1).getValue().getValue());
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler 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.stunner.core.client.canvas.AbstractCanvasHandler 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.stunner.core.client.canvas.AbstractCanvasHandler in project kie-wb-common by kiegroup.
the class CaseManagementCanvasCommandFactoryTest method checkUpdatePositionCommandType.
@Test
public void checkUpdatePositionCommandType() {
// Checks the command is a specific sub-class for Case Management
final CanvasCommand<AbstractCanvasHandler> command = factory.updatePosition(child, new Point2D(0.0, 0.0));
assertNotNull(command);
assertTrue(command instanceof CaseManagementUpdatePositionCommand);
}
Aggregations