use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class MoveRowsCommandTest method addUiModelRow.
@Override
protected void addUiModelRow(final int rowIndex) {
final GridRow uiRow = new BaseGridRow();
uiModel.appendRow(uiRow);
uiModel.setCellValue(rowIndex, 0, new BaseGridCellValue<>(rowIndex + 1));
uiModel.setCellValue(rowIndex, 1, new BaseGridCellValue<>("value" + rowIndex));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class DeleteContextEntryCommandTest method testCanvasCommandUndoWithColumnsMultipleRows.
@Test
public void testCanvasCommandUndoWithColumnsMultipleRows() {
addContextEntries(3);
final GridRow firstRow = uiModel.getRow(0);
final GridRow originalRow = uiModel.getRow(1);
final GridRow lastRow = uiModel.getRow(2);
makeCommand(1);
uiModel.appendColumn(uiModelColumn);
// Delete ContextEntry 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(3, uiModel.getRowCount());
assertEquals(firstRow, uiModel.getRow(0));
assertEquals(originalRow, uiModel.getRow(1));
assertEquals(lastRow, uiModel.getRow(2));
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
verify(canvasOperation).execute();
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class AddDecisionRuleCommandTest method testCanvasCommandExecuteInsertBelow.
@Test
public void testCanvasCommandExecuteInsertBelow() {
// The default behaviour of tests in this class is to "insert above"
final DecisionRule existingRule = new DecisionRule();
final GridRow existingUiRow = new BaseGridRow();
dtable.getRule().add(existingRule);
uiModel.appendRow(existingUiRow);
dtable.getInput().add(new InputClause());
dtable.getOutput().add(new OutputClause());
dtable.getAnnotations().add(new RuleAnnotationClause());
makeCommand(1);
uiModel.appendColumn(uiInputClauseColumn);
uiModel.appendColumn(uiOutputClauseColumn);
uiModel.appendColumn(uiRuleAnnotationClauseColumn);
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler);
graphCommand.execute(graphCommandExecutionContext);
canvasCommand.execute(canvasHandler);
assertEquals(2, uiModel.getRowCount());
assertEquals(existingUiRow, uiModel.getRow(0));
assertEquals(uiModelRow, uiModel.getRow(1));
assertDefaultUiRowValues(1);
verify(command).updateRowNumbers();
verify(command).updateParentInformation();
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class AddDecisionRuleCommandTest method testCanvasCommandExecuteInsertBelowThenUndo.
@Test
public void testCanvasCommandExecuteInsertBelowThenUndo() {
// The default behaviour of tests in this class is to "insert above"
final DecisionRule existingRule = new DecisionRule();
final GridRow existingUiRow = new BaseGridRow();
dtable.getRule().add(existingRule);
uiModel.appendRow(existingUiRow);
makeCommand(1);
uiModel.appendColumn(uiInputClauseColumn);
uiModel.appendColumn(uiOutputClauseColumn);
uiModel.appendColumn(uiRuleAnnotationClauseColumn);
final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler);
final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler);
graphCommand.execute(graphCommandExecutionContext);
canvasCommand.execute(canvasHandler);
canvasCommand.undo(canvasHandler);
assertEquals(1, uiModel.getRowCount());
assertEquals(existingUiRow, uiModel.getRow(0));
// one time in execute(), one time in undo()
verify(canvasOperation, times(2)).execute();
verify(command, times(2)).updateRowNumbers();
verify(command, times(2)).updateParentInformation();
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow 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() {
{
getText().setValue(inValue);
}
});
getOutputEntry().add(new LiteralExpression() {
{
getText().setValue(outValue);
}
});
}
});
final GridRow uiRow = new BaseGridRow();
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);
}
Aggregations