use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSetValueConsumerWhenNotNestedAndUpdateStunnerTitle.
@Test
@SuppressWarnings("unchecked")
public void testSetValueConsumerWhenNotNestedAndUpdateStunnerTitle() {
grid.fireDomainObjectSelectionEvent(decision);
reset(domainObjectSelectionEvent);
final String uuid = UUID.uuid();
doReturn(Optional.of(uuid)).when(grid).getNodeUUID();
when(index.get(uuid)).thenReturn(element);
when(canvasCommandFactory.updatePropertyValue(element, NAME_ID, NAME)).thenReturn(updateElementPropertyCommand);
doTestSetValueConsumer(true, SetHasValueCommand.class, UpdateElementPropertyCommand.class);
verify(gridLayer).batch();
verify(updateElementPropertyCommand).execute(eq(canvasHandler));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(decision);
assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testSelectFirstCellWithRowAndRowNumberColumnAndAnotherColumn.
@Test
public void testSelectFirstCellWithRowAndRowNumberColumnAndAnotherColumn() {
grid.getModel().appendRow(new BaseGridRow());
appendColumns(RowNumberColumn.class, GridColumn.class);
grid.selectFirstCell();
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);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseExpressionGridGeneralTest method testClearValueConsumerWhenNotNestedAndUpdateStunnerTitle.
@Test
@SuppressWarnings("unchecked")
public void testClearValueConsumerWhenNotNestedAndUpdateStunnerTitle() {
grid.fireDomainObjectSelectionEvent(decision);
reset(domainObjectSelectionEvent);
final String uuid = UUID.uuid();
final Name name = new Name();
doReturn(Optional.of(uuid)).when(grid).getNodeUUID();
when(index.get(uuid)).thenReturn(element);
when(canvasCommandFactory.updatePropertyValue(element, NAME_ID, name)).thenReturn(updateElementPropertyCommand);
doTestClearValueConsumer(true, DeleteHasValueCommand.class, UpdateElementPropertyCommand.class);
verify(gridLayer).batch();
verify(updateElementPropertyCommand).execute(eq(canvasHandler));
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(decision);
assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class BaseGrid method fireDomainObjectSelectionEvent.
protected void fireDomainObjectSelectionEvent() {
final Optional<CanvasHandler> canvasHandler = getCanvasHandler();
if (!canvasHandler.isPresent()) {
return;
}
final Optional<DomainObject> domainObject = getDomainObject();
if (!domainObject.isPresent()) {
domainObjectSelectionEvent.fire(new DomainObjectSelectionEvent(canvasHandler.get(), new NOPDomainObject()));
return;
}
fireDomainObjectSelectionEvent(domainObject.get());
}
use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.
the class DecisionTableGridTest method assertNOPDomainObjectSelection.
private void assertNOPDomainObjectSelection() {
verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
Aggregations