Search in sources :

Example 1 with NodeDragMoveEvent

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

the class LienzoHandlerManager method doDragMove.

private final void doDragMove(final INodeXYEvent event) {
    m_dragContext.dragUpdate(event);
    if (m_dragging_dispatch_move) {
        m_drag_node.fireEvent(new NodeDragMoveEvent(m_dragContext));
    }
    if (DragMode.DRAG_LAYER == m_drag_mode) {
        m_lienzo.getDragLayer().draw();
        m_dragContext.drawNodeWithTransforms(m_lienzo.getDragLayer().getContext());
    } else {
        m_drag_node.getLayer().batch();
    }
}
Also used : NodeDragMoveEvent(com.ait.lienzo.client.core.event.NodeDragMoveEvent)

Example 2 with NodeDragMoveEvent

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

the class DecisionServiceSVGShapeViewTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    when(svgPrimitive.get()).thenReturn(shape);
    when(shape.getAttributes()).thenReturn(attributes);
    when(shape.asNode()).thenReturn(shapeNode);
    when(attributes.getDouble(Attribute.WIDTH.getProperty())).thenReturn(WIDTH);
    when(attributes.getDouble(Attribute.HEIGHT.getProperty())).thenReturn(HEIGHT);
    this.nodeDragStartEvent = new NodeDragStartEvent(dragContext);
    this.nodeDragMoveEvent = new NodeDragMoveEvent(dragContext);
    this.nodeDragEndEvent = new NodeDragEndEvent(dragContext);
    this.view = new DecisionServiceSVGShapeView("name", svgPrimitive, WIDTH, HEIGHT, true);
}
Also used : NodeDragStartEvent(com.ait.lienzo.client.core.event.NodeDragStartEvent) NodeDragEndEvent(com.ait.lienzo.client.core.event.NodeDragEndEvent) NodeDragMoveEvent(com.ait.lienzo.client.core.event.NodeDragMoveEvent) Before(org.junit.Before)

Example 3 with NodeDragMoveEvent

use of com.ait.lienzo.client.core.event.NodeDragMoveEvent in project drools-wb by kiegroup.

the class RadarMenuViewImpl method setup.

@PostConstruct
public void setup() {
    radarCanvas.add(radarLayer);
    radarMenuDropdown.setTitle(translationService.getTranslation(GuidedDecisionTableErraiConstants.RowContextMenuViewImpl_Title));
    visibleBounds.setDraggable(true);
    visibleBounds.addNodeDragMoveHandler(new NodeDragMoveHandler() {

        @Override
        public void onNodeDragMove(final NodeDragMoveEvent event) {
            presenter.onDragVisibleBounds(visibleBounds.getX(), visibleBounds.getY());
        }
    });
    visibleBounds.setFillColor(ColorName.GRAY);
    visibleBounds.setAlpha(0.25);
    visibleBounds.setLocation(new Point2D((RADAR_WIDTH - visibleBounds.getWidth()) / 2, (RADAR_HEIGHT - visibleBounds.getHeight()) / 2));
    radarLayer.add(visibleBounds);
    radarCanvas.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            if (eventTargetsPopup(event.getNativeEvent(), radarMenu)) {
                event.stopPropagation();
                event.preventDefault();
            }
        }

        private boolean eventTargetsPopup(final NativeEvent event, final Element element) {
            final EventTarget target = event.getEventTarget();
            if (Element.is(target)) {
                return element.isOrHasChild(Element.as(target));
            }
            return false;
        }
    });
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Point2D(com.ait.lienzo.client.core.types.Point2D) NodeDragMoveHandler(com.ait.lienzo.client.core.event.NodeDragMoveHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ButtonElement(com.google.gwt.dom.client.ButtonElement) LIElement(com.google.gwt.dom.client.LIElement) Element(com.google.gwt.dom.client.Element) NodeDragMoveEvent(com.ait.lienzo.client.core.event.NodeDragMoveEvent) EventTarget(com.google.gwt.dom.client.EventTarget) NativeEvent(com.google.gwt.dom.client.NativeEvent) PostConstruct(javax.annotation.PostConstruct)

Example 4 with NodeDragMoveEvent

use of com.ait.lienzo.client.core.event.NodeDragMoveEvent 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

NodeDragMoveEvent (com.ait.lienzo.client.core.event.NodeDragMoveEvent)4 NodeDragEndEvent (com.ait.lienzo.client.core.event.NodeDragEndEvent)2 NodeDragMoveHandler (com.ait.lienzo.client.core.event.NodeDragMoveHandler)2 NodeDragStartEvent (com.ait.lienzo.client.core.event.NodeDragStartEvent)2 AttributesChangedEvent (com.ait.lienzo.client.core.event.AttributesChangedEvent)1 AttributesChangedHandler (com.ait.lienzo.client.core.event.AttributesChangedHandler)1 NodeDragEndHandler (com.ait.lienzo.client.core.event.NodeDragEndHandler)1 NodeDragStartHandler (com.ait.lienzo.client.core.event.NodeDragStartHandler)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 Point2D (com.ait.lienzo.client.core.types.Point2D)1 ButtonElement (com.google.gwt.dom.client.ButtonElement)1 Element (com.google.gwt.dom.client.Element)1 EventTarget (com.google.gwt.dom.client.EventTarget)1 LIElement (com.google.gwt.dom.client.LIElement)1 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)1 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)1 PostConstruct (javax.annotation.PostConstruct)1