Search in sources :

Example 1 with ViewEventHandlerManager

use of org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager in project kie-wb-common by kiegroup.

the class LienzoLayer method initialize.

@Override
public LienzoLayer initialize(final Object view) {
    this.layer = (com.ait.lienzo.client.core.shape.Layer) view;
    this.eventHandlerManager = new ViewEventHandlerManager(layer, SUPPORTED_EVENT_TYPES);
    return this;
}
Also used : ViewEventHandlerManager(org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager)

Example 2 with ViewEventHandlerManager

use of org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager in project kie-wb-common by kiegroup.

the class LienzoCanvasTest method testEventHandling.

@Test
public void testEventHandling() {
    CanvasPanel panel = mock(CanvasPanel.class);
    CanvasSettings settings = mock(CanvasSettings.class);
    ViewEventHandlerManager eventHandler = mock(ViewEventHandlerManager.class);
    tested.initialize(panel, settings, eventHandler);
    tested.supports(ViewEventType.DRAG);
    verify(eventHandler, times(1)).supports(eq(ViewEventType.DRAG));
    tested.enableHandlers();
    verify(eventHandler, times(1)).enable();
    tested.disableHandlers();
    verify(eventHandler, times(1)).disable();
    DragHandler dragHandler = mock(DragHandler.class);
    tested.addHandler(ViewEventType.DRAG, dragHandler);
    verify(eventHandler, times(1)).addHandler(eq(ViewEventType.DRAG), eq(dragHandler));
    tested.removeHandler(dragHandler);
    verify(eventHandler, times(1)).removeHandler(eq(dragHandler));
}
Also used : CanvasPanel(org.kie.workbench.common.stunner.core.client.canvas.CanvasPanel) CanvasSettings(org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings) DragHandler(org.kie.workbench.common.stunner.core.client.shape.view.event.DragHandler) ViewEventHandlerManager(org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager) Test(org.junit.Test)

Example 3 with ViewEventHandlerManager

use of org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager in project kie-wb-common by kiegroup.

the class LienzoCanvasTest method testDestroy.

@Test
public void testDestroy() {
    CanvasPanel panel = mock(CanvasPanel.class);
    CanvasSettings settings = mock(CanvasSettings.class);
    ViewEventHandlerManager eventHandler = mock(ViewEventHandlerManager.class);
    tested.initialize(panel, settings, eventHandler);
    tested.destroy();
    verify(eventHandler, times(1)).destroy();
    verify(view, times(1)).destroy();
}
Also used : CanvasPanel(org.kie.workbench.common.stunner.core.client.canvas.CanvasPanel) CanvasSettings(org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings) ViewEventHandlerManager(org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager) Test(org.junit.Test)

Example 4 with ViewEventHandlerManager

use of org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager in project kie-wb-common by kiegroup.

the class WiresConnectorViewExt method init.

protected void init(final ViewEventType[] supportedEventTypes) {
    this.label = createLabel("");
    this.textRotationDegrees = 0;
    this.eventHandlerManager = new ViewEventHandlerManager(getLine().asShape(), getLine().asShape(), supportedEventTypes);
}
Also used : ViewEventHandlerManager(org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager)

Aggregations

ViewEventHandlerManager (org.kie.workbench.common.stunner.client.lienzo.shape.view.ViewEventHandlerManager)4 Test (org.junit.Test)2 CanvasPanel (org.kie.workbench.common.stunner.core.client.canvas.CanvasPanel)2 CanvasSettings (org.kie.workbench.common.stunner.core.client.canvas.CanvasSettings)2 DragHandler (org.kie.workbench.common.stunner.core.client.shape.view.event.DragHandler)1