use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class AddRelationColumnCommandTest method testCanvasCommandUndoWithRows.
@Test
public void testCanvasCommandUndoWithRows() {
relation.getRow().add(new List());
uiModel.appendRow(new BaseGridRow());
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);
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(undoCanvasOperation).execute();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method testGraphCommandExecuteRemoveMiddleWithColumns.
@Test
public void testGraphCommandExecuteRemoveMiddleWithColumns() {
uiModel.appendRow(new BaseGridRow());
uiModel.appendRow(new BaseGridRow());
final List firstRow = new List();
final List lastRow = new List();
relation.getRow().add(0, firstRow);
relation.getRow().add(lastRow);
relation.getColumn().add(new InformationItem());
relation.getRow().get(0).getExpression().add(HasExpression.wrap(rowList, new LiteralExpression()));
makeCommand(1);
final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler);
assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce));
assertEquals(2, relation.getRow().size());
assertEquals(firstRow, relation.getRow().get(0));
assertEquals(lastRow, relation.getRow().get(1));
assertEquals(1, relation.getColumn().size());
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthNoCellsInMiddleWithPadding.
/**
* (10)[100](10)
* (10)-(10)
* (10)[50][60](10)
*/
@Test
public void testMinimalWidthNoCellsInMiddleWithPadding() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCellsWithPadding(0, 0, PADDING, 100);
mockCellsWithPadding(1, 0, PADDING);
mockCellsWithPadding(2, 0, PADDING, 50, 60);
assertThat(column.getMinimumWidth()).isEqualTo(130);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthTwoCellsSumWithPadding.
/**
* (10)[100](10)
* (10)[50][60](10)
* (10)[105](10)
*/
@Test
public void testMinimalWidthTwoCellsSumWithPadding() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCellsWithPadding(0, 0, PADDING, 100);
mockCellsWithPadding(1, 0, PADDING, 50, 60);
mockCellsWithPadding(2, 0, PADDING, 105);
assertThat(column.getMinimumWidth()).isEqualTo(130);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorColumnTest method testMinimalWidthTwoCellsSum.
/**
* [100]
* [50][60]
* [105]
*/
@Test
public void testMinimalWidthTwoCellsSum() {
gridData.appendColumn(column);
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
gridData.appendRow(new BaseGridRow());
mockCells(0, 0, 100);
mockCells(1, 0, 50, 60);
mockCells(2, 0, 105);
assertThat(column.getMinimumWidth()).isEqualTo(110);
}
Aggregations