use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class DeleteContextEntryCommandTest method setupRowNumbers.
private void setupRowNumbers() {
uiModel.appendRow(new BaseGridRow());
uiModel.appendRow(new BaseGridRow());
uiModel.setCellValue(0, 0, new BaseGridCellValue<>(1));
uiModel.setCellValue(1, 0, new BaseGridCellValue<>(2));
uiModel.setCellValue(2, 0, null);
assertEquals(3, uiModel.getRowCount());
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class DeleteContextEntryCommandTest method addContextEntries.
private void addContextEntries(final int entriesCount) {
final int originalRowCount = uiModel.getRowCount();
for (int i = 0; i < originalRowCount; i++) {
uiModel.deleteRow(0);
}
context.getContextEntry().clear();
for (int i = 0; i < entriesCount; i++) {
context.getContextEntry().add(new ContextEntry());
uiModel.appendRow(new BaseGridRow());
}
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow 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.impl.BaseGridRow 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.impl.BaseGridRow 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