Search in sources :

Example 1 with GWTVertex

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

the class DragObject method move.

public void move() {
    final int deltaX = getCurrentX() - getStartX();
    final int deltaY = getCurrentY() - getStartY();
    m_selection.each(new Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            if (m_startPosition.containsKey(vertex.getId())) {
                Point p = m_startPosition.get(vertex.getId());
                vertex.setX((int) (p.getX() + deltaX));
                vertex.setY((int) (p.getY() + deltaY));
            }
        }
    });
}
Also used : GWTVertex(org.opennms.features.topology.app.internal.gwt.client.GWTVertex) Point(com.google.gwt.touch.client.Point) SVGPoint(org.opennms.features.topology.app.internal.gwt.client.svg.SVGPoint) Point(com.google.gwt.touch.client.Point) SVGPoint(org.opennms.features.topology.app.internal.gwt.client.svg.SVGPoint)

Example 2 with GWTVertex

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

the class MarqueeSelectHandler method selectVertices.

private void selectVertices() {
    // We use the svgIconOverlay to determine the selection and ignore the status border, the label
    // and possible invisible elements, such as status badge, navigate to target etc, as the vertex is
    // slightly greater than the svgIconOverlay and the user probably uses the icon itself to make the selection.
    D3 iconOverlay = m_svgTopologyMap.selectAllVertexElements().select(".svgIconOverlay");
    JsArray<JsArray<SVGElement>> selection = iconOverlay.cast();
    final JsArray<SVGElement> elemArray = selection.get(0);
    iconOverlay.each(new Handler<GWTVertex>() {

        @Override
        public void call(GWTVertex vertex, int index) {
            SVGElement elem = elemArray.get(index).cast();
            boolean selected = inSelection(elem);
            vertex.setSelected(selected);
        }
    });
}
Also used : JsArray(com.google.gwt.core.client.JsArray) SVGElement(org.opennms.features.topology.app.internal.gwt.client.svg.SVGElement) GWTVertex(org.opennms.features.topology.app.internal.gwt.client.GWTVertex) D3(org.opennms.features.topology.app.internal.gwt.client.d3.D3)

Aggregations

GWTVertex (org.opennms.features.topology.app.internal.gwt.client.GWTVertex)2 JsArray (com.google.gwt.core.client.JsArray)1 Point (com.google.gwt.touch.client.Point)1 D3 (org.opennms.features.topology.app.internal.gwt.client.d3.D3)1 SVGElement (org.opennms.features.topology.app.internal.gwt.client.svg.SVGElement)1 SVGPoint (org.opennms.features.topology.app.internal.gwt.client.svg.SVGPoint)1