use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class MoveRowsCommandTest method appendRow.
private void appendRow(final int rowIndex, final String rowIdentifier) {
final String inValue = "in " + rowIdentifier;
final String outValue = "out " + rowIdentifier;
dtable.getRule().add(new DecisionRule() {
{
getInputEntry().add(new UnaryTests() {
{
setText(inValue);
}
});
getOutputEntry().add(new LiteralExpression() {
{
setText(outValue);
}
});
}
});
final DMNGridRow uiRow = new DMNGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>(inValue));
uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>(outValue));
rowsUnderTest.add(uiRow);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class MoveRowsCommandTest method addUiModelRow.
protected void addUiModelRow(final int rowIndex) {
final DMNGridRow uiRow = new DMNGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>("name" + rowIndex));
uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>("editor" + rowIndex));
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class DeleteParameterBindingCommandTest method testGraphCommandExecuteRemoveFromMiddle.
@Test
public void testGraphCommandExecuteRemoveFromMiddle() {
final Binding firstBinding = new Binding();
final Binding lastBinding = new Binding();
invocation.getBinding().add(0, firstBinding);
invocation.getBinding().add(lastBinding);
uiModel.appendRow(new DMNGridRow());
uiModel.appendRow(new DMNGridRow());
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
Assertions.assertThat(invocation.getBinding()).containsExactly(firstBinding, lastBinding);
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class MoveRowsCommandTest method addUiModelRow.
protected void addUiModelRow(final int rowIndex) {
final DMNGridRow uiRow = new DMNGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>("name" + rowIndex));
uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>("editor" + rowIndex));
}
use of org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridRow in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testCanvasCommandUndoWithRows.
@Test
public void testCanvasCommandUndoWithRows() {
relation.getRow().add(new List());
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(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();
}
Aggregations