Search in sources :

Example 1 with NodeDragEndHandler

use of com.ait.lienzo.client.core.event.NodeDragEndHandler in project kie-wb-common by kiegroup.

the class ButtonGridItemImplTest method testDrag.

@Test
public void testDrag() {
    NodeDragStartHandler startHandler = mock(NodeDragStartHandler.class);
    NodeDragMoveHandler moveHandler = mock(NodeDragMoveHandler.class);
    NodeDragEndHandler endHandler = mock(NodeDragEndHandler.class);
    tested.onDragStart(startHandler);
    tested.onDragMove(moveHandler);
    tested.onDragEnd(endHandler);
    verify(button, times(1)).onDragStart(eq(startHandler));
    verify(button, times(1)).onDragMove(eq(moveHandler));
    verify(button, times(1)).onDragEnd(eq(endHandler));
}
Also used : NodeDragStartHandler(com.ait.lienzo.client.core.event.NodeDragStartHandler) NodeDragMoveHandler(com.ait.lienzo.client.core.event.NodeDragMoveHandler) NodeDragEndHandler(com.ait.lienzo.client.core.event.NodeDragEndHandler) Test(org.junit.Test)

Example 2 with NodeDragEndHandler

use of com.ait.lienzo.client.core.event.NodeDragEndHandler in project kie-wb-common by kiegroup.

the class ButtonItemImplTest method testDragEmd.

@Test
public void testDragEmd() {
    NodeDragEndHandler handler = mock(NodeDragEndHandler.class);
    final ButtonItemImpl cascade = tested.onDragEnd(handler);
    assertEquals(tested, cascade);
    ;
    verify(groupItemPrim, times(1)).setDraggable(eq(true));
    verify(groupItemPrim, times(1)).addNodeDragEndHandler(eq(handler));
    verify(registrations, times(1)).register(eq(dragEndReg));
    tested.destroy();
    verify(dragEndReg, times(1)).removeHandler();
}
Also used : NodeDragEndHandler(com.ait.lienzo.client.core.event.NodeDragEndHandler) Test(org.junit.Test)

Example 3 with NodeDragEndHandler

use of com.ait.lienzo.client.core.event.NodeDragEndHandler in project lienzo-core by ahome-it.

the class WiresContainer method ensureHandlers.

private void ensureHandlers() {
    if (!m_drag_initialized && (null != m_container)) {
        m_registrationManager.register(m_container.addNodeDragStartHandler(new NodeDragStartHandler() {

            @Override
            public void onNodeDragStart(final NodeDragStartEvent event) {
                WiresContainer.this.m_dragging = true;
                m_events.fireEvent(new WiresDragStartEvent(WiresContainer.this, event));
            }
        }));
        m_registrationManager.register(m_container.addNodeDragMoveHandler(new NodeDragMoveHandler() {

            @Override
            public void onNodeDragMove(final NodeDragMoveEvent event) {
                WiresContainer.this.m_dragging = true;
                m_events.fireEvent(new WiresDragMoveEvent(WiresContainer.this, event));
            }
        }));
        m_registrationManager.register(m_container.addNodeDragEndHandler(new NodeDragEndHandler() {

            @Override
            public void onNodeDragEnd(final NodeDragEndEvent event) {
                WiresContainer.this.m_dragging = false;
                m_events.fireEvent(new WiresDragEndEvent(WiresContainer.this, event));
            }
        }));
        m_container.setAttributesChangedBatcher(m_attributesChangedBatcher);
        final AttributesChangedHandler handler = new AttributesChangedHandler() {

            @Override
            public void onAttributesChanged(final AttributesChangedEvent event) {
                if (!WiresContainer.this.m_dragging && event.evaluate(XYWH_OP)) {
                    fireMove();
                }
            }
        };
        // Attribute change handlers.
        m_registrationManager.register(m_container.addAttributesChangedHandler(Attribute.X, handler));
        m_registrationManager.register(m_container.addAttributesChangedHandler(Attribute.Y, handler));
        m_drag_initialized = true;
    }
}
Also used : NodeDragStartEvent(com.ait.lienzo.client.core.event.NodeDragStartEvent) NodeDragEndEvent(com.ait.lienzo.client.core.event.NodeDragEndEvent) NodeDragStartHandler(com.ait.lienzo.client.core.event.NodeDragStartHandler) NodeDragMoveHandler(com.ait.lienzo.client.core.event.NodeDragMoveHandler) NodeDragMoveEvent(com.ait.lienzo.client.core.event.NodeDragMoveEvent) WiresDragEndEvent(com.ait.lienzo.client.core.shape.wires.event.WiresDragEndEvent) AttributesChangedHandler(com.ait.lienzo.client.core.event.AttributesChangedHandler) AttributesChangedEvent(com.ait.lienzo.client.core.event.AttributesChangedEvent) NodeDragEndHandler(com.ait.lienzo.client.core.event.NodeDragEndHandler) WiresDragStartEvent(com.ait.lienzo.client.core.shape.wires.event.WiresDragStartEvent) WiresDragMoveEvent(com.ait.lienzo.client.core.shape.wires.event.WiresDragMoveEvent)

Aggregations

NodeDragEndHandler (com.ait.lienzo.client.core.event.NodeDragEndHandler)3 NodeDragMoveHandler (com.ait.lienzo.client.core.event.NodeDragMoveHandler)2 NodeDragStartHandler (com.ait.lienzo.client.core.event.NodeDragStartHandler)2 Test (org.junit.Test)2 AttributesChangedEvent (com.ait.lienzo.client.core.event.AttributesChangedEvent)1 AttributesChangedHandler (com.ait.lienzo.client.core.event.AttributesChangedHandler)1 NodeDragEndEvent (com.ait.lienzo.client.core.event.NodeDragEndEvent)1 NodeDragMoveEvent (com.ait.lienzo.client.core.event.NodeDragMoveEvent)1 NodeDragStartEvent (com.ait.lienzo.client.core.event.NodeDragStartEvent)1 WiresDragEndEvent (com.ait.lienzo.client.core.shape.wires.event.WiresDragEndEvent)1 WiresDragMoveEvent (com.ait.lienzo.client.core.shape.wires.event.WiresDragMoveEvent)1 WiresDragStartEvent (com.ait.lienzo.client.core.shape.wires.event.WiresDragStartEvent)1