use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class DeleteRelationRowCommandTest method setup.
@Before
public void setup() {
this.relation = new Relation();
this.rowList = new List();
this.relation.getRow().add(rowList);
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModelMapper = new RelationUIModelMapper(() -> uiModel, () -> Optional.of(relation), listSelector, DEFAULT_HEIGHT);
makeCommand(0);
doReturn(ruleManager).when(handler).getRuleManager();
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiModelColumn).getIndex();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class SetKindCommandTest method setup.
@Before
public void setup() {
this.function = new FunctionDefinition();
this.function.setKind(originalKind);
this.function.setExpression(originalExpression);
this.uiModel = new BaseGridData();
this.uiModel.appendColumn(mockColumn);
this.uiModel.appendRow(new BaseGridRow());
this.uiModel.setCellValue(0, 0, new ExpressionCellValue(Optional.of(originalEditor)));
doReturn(uiModel).when(gridWidget).getModel();
doReturn(ruleManager).when(handler).getRuleManager();
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testDeselect.
@Test
public void testDeselect() {
final String expectedUUID = "0000-1111-2222";
doReturn(Optional.of(expectedUUID)).when(grid).getNodeUUID();
grid.getModel().appendRow(new BaseGridRow());
appendColumns(GridColumn.class);
// Select a cell so we can check deselection clears selections
grid.getModel().selectCell(0, 0);
assertFalse(grid.getModel().getSelectedCells().isEmpty());
grid.deselect();
assertTrue(grid.getModel().getSelectedCells().isEmpty());
verify(grid).clearSelectedDomainObject();
verify(editorSelectedEvent).fire(expressionEditorChangedArgumentCaptor.capture());
assertEquals(expectedUUID, expressionEditorChangedArgumentCaptor.getValue().getNodeUUID());
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectFirstCellWithRowAndNonRowNumberColumn.
@Test
public void testSelectFirstCellWithRowAndNonRowNumberColumn() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(GridColumn.class);
grid.selectFirstCell();
assertThat(grid.getModel().getSelectedCells()).isNotEmpty();
assertThat(grid.getModel().getSelectedCells()).contains(new GridData.SelectedCell(0, 0));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectCellWithPoint.
@Test
public void testSelectCellWithPoint() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(RowNumberColumn.class, GridColumn.class);
final Point2D point = mock(Point2D.class);
final double columnOffset = grid.getModel().getColumns().get(0).getWidth();
final double columnWidth = grid.getModel().getColumns().get(1).getWidth() / 2;
final double rowOffset = HEADER_HEIGHT + grid.getModel().getRow(0).getHeight() / 2;
when(point.getX()).thenReturn(columnOffset + columnWidth);
when(point.getY()).thenReturn(rowOffset);
grid.selectCell(point, false, true);
assertThat(grid.getModel().getSelectedCells()).isNotEmpty();
assertThat(grid.getModel().getSelectedCells()).contains(new GridData.SelectedCell(0, 1));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
Aggregations