Search in sources :

Example 41 with DomainObjectSelectionEvent

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

the class RelationGridTest method testSelectExpression.

@Test
public void testSelectExpression() {
    setupGrid(0);
    grid.selectCell(0, 1, false, false);
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getDomainObject()).isEqualTo(expression.get().getRow().get(0).getExpression().get(0).getExpression());
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 42 with DomainObjectSelectionEvent

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

the class ListGridTest method assertNOPDomainObjectSelection.

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

Example 43 with DomainObjectSelectionEvent

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

the class UndefinedExpressionGridTest method testSelectFirstCellWhenNested.

@Test
public void testSelectFirstCellWhenNested() {
    setupGrid(1);
    final Decision decision = mock(Decision.class);
    when(hasExpression.asDMNModelInstrumentedBase()).thenReturn(decision);
    grid.selectFirstCell();
    assertThat(grid.getModel().getSelectedCells().size()).isEqualTo(0);
    verify(parentGridUiModel).selectCell(eq(PARENT_ROW_INDEX), eq(PARENT_COLUMN_INDEX));
    verify(gridLayer).select(parentGridWidget);
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionArgumentEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionArgumentEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getCanvasHandler()).isEqualTo(canvasHandler);
    assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Test(org.junit.Test)

Example 44 with DomainObjectSelectionEvent

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

the class UndefinedExpressionGridTest method testOnExpressionTypeChangedWhenNested.

@Test
@SuppressWarnings("unchecked")
public void testOnExpressionTypeChangedWhenNested() {
    assertOnExpressionTypeChanged(1);
    verify(expressionGridCache, never()).getExpressionGrid(Mockito.<String>any());
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionArgumentEventCaptor.capture());
    final DomainObjectSelectionEvent domainObjectSelectionEvent = domainObjectSelectionArgumentEventCaptor.getValue();
    assertThat(domainObjectSelectionEvent.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 45 with DomainObjectSelectionEvent

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

the class RelationGridTest method testSelectMultipleCells.

@Test
@SuppressWarnings("unchecked")
public void testSelectMultipleCells() {
    setupGrid(0);
    addRow(0);
    addColumn(1);
    // DomainObject selected when row added, so reset for this test
    reset(domainObjectSelectionEvent);
    grid.selectCell(0, 1, false, false);
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent event1 = domainObjectSelectionEventCaptor.getValue();
    assertThat(event1.getDomainObject()).isEqualTo(expression.get().getRow().get(0).getExpression().get(0).getExpression());
    // Reset DomainObjectSelectionEvent tested above.
    reset(domainObjectSelectionEvent);
    grid.selectCell(0, 2, false, true);
    verify(domainObjectSelectionEvent).fire(domainObjectSelectionEventCaptor.capture());
    final DomainObjectSelectionEvent event2 = domainObjectSelectionEventCaptor.getValue();
    assertThat(event2.getDomainObject()).isInstanceOf(NOPDomainObject.class);
}
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