use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class DeleteListRowCommandTest method testCanvasCommandExecuteRemoveMiddle.
@Test
public void testCanvasCommandExecuteRemoveMiddle() {
final GridRow firstRow = new BaseGridRow();
final GridRow lastRow = new BaseGridRow();
uiModel.insertRow(0, firstRow);
uiModel.appendRow(lastRow);
list.getExpression().add(0, HasExpression.wrap(list, null));
list.getExpression().add(HasExpression.wrap(list, null));
makeCommand(1);
final Command<AbstractCanvasHandler, CanvasViolation> cc = command.newCanvasCommand(handler);
assertEquals(CanvasCommandResultBuilder.SUCCESS, cc.execute(handler));
assertEquals(2, uiModel.getRowCount());
assertEquals(firstRow, uiModel.getRow(0));
assertEquals(lastRow, uiModel.getRow(1));
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 DeleteListRowCommandTest method testCanvasCommandUndo.
@Test
public void testCanvasCommandUndo() {
final GridRow existingGridRow = uiModel.getRow(0);
makeCommand(0);
// Delete row 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.getRowCount());
assertEquals(existingGridRow, uiModel.getRow(0));
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 MoveRowsCommandTest method addUiModelRow.
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<>("name" + rowIndex));
uiModel.setCellValue(rowIndex, 2, new BaseGridCellValue<>("editor" + rowIndex));
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefault.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefault() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT + 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowLowerThanDefault.
@Test
@SuppressWarnings("unchecked")
public void testRowLowerThanDefault() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT - 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isBetween(0D, DEFAULT_HEIGHT);
}
Aggregations