Search in sources :

Example 31 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 testSetValueConsumerWhenNotNested.

@Test
@SuppressWarnings("unchecked")
public void testSetValueConsumerWhenNotNested() {
    grid.fireDomainObjectSelectionEvent(decision);
    reset(domainObjectSelectionEvent);
    doTestSetValueConsumer(false, SetHasValueCommand.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)

Example 32 with DomainObjectSelectionEvent

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

the class DomainObjectAwareLienzoMultipleSelectionControlTest method testSelectDomainObjectThenElement.

@Test
public void testSelectDomainObjectThenElement() {
    final DomainObjectSelectionEvent domainObjectEvent = new DomainObjectSelectionEvent(canvasHandler, domainObject);
    control.handleDomainObjectSelectedEvent(domainObjectEvent);
    assertDomainObjectSelected();
    final CanvasSelectionEvent elementEvent = new CanvasSelectionEvent(canvasHandler, ELEMENT_UUID);
    control.handleCanvasElementSelectedEvent(elementEvent);
    assertElementSelected();
}
Also used : CanvasSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.CanvasSelectionEvent) DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 33 with DomainObjectSelectionEvent

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

the class DomainObjectAwareLienzoMultipleSelectionControlTest method testSelectDomainObjectThenDestroy.

@Test
public void testSelectDomainObjectThenDestroy() {
    final DomainObjectSelectionEvent domainObjectEvent = new DomainObjectSelectionEvent(canvasHandler, domainObject);
    control.handleDomainObjectSelectedEvent(domainObjectEvent);
    assertDomainObjectSelected();
    control.destroy();
    assertThat(control.getSelectedItemDefinition()).isNotPresent();
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) Test(org.junit.Test)

Example 34 with DomainObjectSelectionEvent

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

the class DomainObjectAwareLienzoMultipleSelectionControlTest method testSelectNullDomainObjectWithEvent.

@Test
@SuppressWarnings("unchecked")
public void testSelectNullDomainObjectWithEvent() {
    final DomainObjectSelectionEvent event = new DomainObjectSelectionEvent(canvasHandler, null);
    control.handleDomainObjectSelectedEvent(event);
    final Optional<Object> selectedItemDefinition = control.getSelectedItemDefinition();
    assertThat(selectedItemDefinition).isNotPresent();
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) DomainObject(org.kie.workbench.common.stunner.core.domainobject.DomainObject) Test(org.junit.Test)

Example 35 with DomainObjectSelectionEvent

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

the class PropertiesPanelNotifierTest method testOnDomainObjectSelectionEvent.

@Test
public void testOnDomainObjectSelectionEvent() {
    final DomainObjectSelectionEvent selectionEvent = mock(DomainObjectSelectionEvent.class);
    final DomainObject domainObject = mock(DomainObject.class);
    final String uuid = "uuid";
    when(selectionEvent.getDomainObject()).thenReturn(domainObject);
    when(domainObject.getDomainObjectUUID()).thenReturn(uuid);
    notifier.onDomainObjectSelectionEvent(selectionEvent);
    verify(notifier).setSelectedElementUUID(uuid);
}
Also used : DomainObjectSelectionEvent(org.kie.workbench.common.stunner.core.client.canvas.event.selection.DomainObjectSelectionEvent) DomainObject(org.kie.workbench.common.stunner.core.domainobject.DomainObject) 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