Search in sources :

Example 26 with DomainObjectSelectionEvent

use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.

the class ExpressionContainerGridTest method testSelectCellWithPoint.

@Test
public void testSelectCellWithPoint() {
    final Point2D point = mock(Point2D.class);
    final LiteralExpression domainObject = mock(LiteralExpression.class);
    when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(domainObject);
    grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName), false);
    grid.selectCell(point, false, true);
    verify(gridLayer).select(eq(grid));
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
    assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(domainObject);
    verify(cellSelectionManager).selectCell(eq(point), eq(false), eq(true));
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 27 with DomainObjectSelectionEvent

use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.

the class ExpressionContainerGridTest method testSelectCellWithCoordinatesNonDomainObject.

@Test
public void testSelectCellWithCoordinatesNonDomainObject() {
    final int uiRowIndex = 0;
    final int uiColumnIndex = 1;
    grid.setExpression(NODE_UUID, hasExpression, Optional.of(hasName), false);
    grid.selectCell(uiRowIndex, uiColumnIndex, false, true);
    verify(gridLayer).select(eq(grid));
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
    assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
    verify(cellSelectionManager).selectCell(eq(uiRowIndex), eq(uiColumnIndex), eq(false), eq(true));
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 28 with DomainObjectSelectionEvent

use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.

the class ContextGridTest method assertDomainObjectSelection.

private void assertDomainObjectSelection(final DomainObject domainObject) {
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(domainObject);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent)

Example 29 with DomainObjectSelectionEvent

use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.

the class BaseExpressionGridGeneralTest method testSetTypeRefConsumerWhenNotNested.

@Test
@SuppressWarnings("unchecked")
public void testSetTypeRefConsumerWhenNotNested() {
    grid.fireDomainObjectSelectionEvent(decision);
    reset(domainObjectSelectionEvent);
    doTestSetTypeRefConsumer();
    verify(gridLayer).batch();
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(decision);
    assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 30 with DomainObjectSelectionEvent

use of org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent in project kie-wb-common by kiegroup.

the class BaseExpressionGridGeneralTest method testClearValueConsumerWhenNotNested.

@Test
@SuppressWarnings("unchecked")
public void testClearValueConsumerWhenNotNested() {
    grid.fireDomainObjectSelectionEvent(decision);
    reset(domainObjectSelectionEvent);
    doTestClearValueConsumer(false, DeleteHasValueCommand.class);
    verify(gridLayer).batch();
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(decision);
    assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Aggregations

DomainObjectSelectionEvent (org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent)47 Test (org.junit.Test)33 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)4 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)4 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)3 AbstractCanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.AbstractCanvasHandler)3 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)3 Point2D (com.ait.lienzo.client.core.types.Point2D)2 HasName (org.kie.workbench.common.dmn.api.definition.HasName)2 NOPDomainObject (org.kie.workbench.common.dmn.api.definition.NOPDomainObject)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)2 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)2 CanvasClearSelectionEvent (org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasClearSelectionEvent)2 DomainObject (org.kie.workbench.common.stunner.core.domainobject.DomainObject)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Optional (java.util.Optional)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Supplier (java.util.function.Supplier)1