Search in sources :

Example 1 with DragObject

use of org.opennms.features.topology.app.internal.gwt.client.handler.DragObject in project opennms by OpenNMS.

the class VTopologyComponent method vertexDragStartHandler.

private Handler<GWTVertex> vertexDragStartHandler() {
    return new Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            NativeEvent event = D3.getEvent();
            Element draggableElement = Element.as(event.getEventTarget()).getParentElement();
            D3 selection = null;
            boolean isSelected = draggableElement.getAttribute("class").equals("vertex selected");
            if (isSelected) {
                selection = D3.d3().selectAll(GWTVertex.SELECTED_VERTEX_CLASS_NAME);
            } else {
                selection = D3.d3().select(Element.as(event.getEventTarget()).getParentElement());
            }
            m_dragObject = new DragObject(VTopologyComponent.this.m_topologyView, draggableElement, m_topologyView.getSVGViewPort(), selection);
            D3.getEvent().preventDefault();
            D3.getEvent().stopPropagation();
        }
    };
}
Also used : SVGGElement(org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement) Element(com.google.gwt.dom.client.Element) DragObject(org.opennms.features.topology.app.internal.gwt.client.handler.DragObject) MarqueeSelectHandler(org.opennms.features.topology.app.internal.gwt.client.handler.MarqueeSelectHandler) PanHandler(org.opennms.features.topology.app.internal.gwt.client.handler.PanHandler) Handler(org.opennms.features.topology.app.internal.gwt.client.d3.D3Events.Handler) NativeEvent(com.google.gwt.dom.client.NativeEvent) D3(org.opennms.features.topology.app.internal.gwt.client.d3.D3)

Aggregations

Element (com.google.gwt.dom.client.Element)1 NativeEvent (com.google.gwt.dom.client.NativeEvent)1 D3 (org.opennms.features.topology.app.internal.gwt.client.d3.D3)1 Handler (org.opennms.features.topology.app.internal.gwt.client.d3.D3Events.Handler)1 DragObject (org.opennms.features.topology.app.internal.gwt.client.handler.DragObject)1 MarqueeSelectHandler (org.opennms.features.topology.app.internal.gwt.client.handler.MarqueeSelectHandler)1 PanHandler (org.opennms.features.topology.app.internal.gwt.client.handler.PanHandler)1 SVGGElement (org.opennms.features.topology.app.internal.gwt.client.svg.SVGGElement)1