Examples of PickedState


Examples of edu.uci.ics.jung.visualization.PickedState

                isInVV = true;
            }
            Point2D ip = vv.inverseViewTransform(p);

            PickSupport picksupport = vv.getPickSupport();
            final PickedState pickedstate = vv.getPickedState();
            Vertex v = picksupport.getVertex(ip.getX(), ip.getY());
            if (v != null && info.hasSomethingToDisplay(v)) {
                info.refreshInfo(v);
                info.moveTo(v);
                info.setVisible(true);
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

   
    public void mousePressed(MouseEvent e) {
        down = e.getPoint();
        VisualizationViewer vv = (VisualizationViewer)e.getSource();
        PickSupport pickSupport = vv.getPickSupport();
        PickedState pickedState = vv.getPickedState();

        if(pickSupport != null && pickedState != null) {
            Layout layout = vv.getGraphLayout();
            if(e.getModifiers() == getModifiers()) {
                vv.addPostRenderPaintable(lensPaintable);
                rect.setFrameFromDiagonal(down,down);
                // p is the screen point for the mouse event
                Point2D p = e.getPoint();
                // take away the view transform
                Point2D ip = vv.inverseViewTransform(p);
               
                vertex = pickSupport.getVertex(ip.getX(), ip.getY());
                if(vertex != null) {
                    if(pickedState.isPicked(vertex) == false) {
                        pickedState.clearPickedVertices();
                        pickedState.pick(vertex, true);
                        vv.fireStateChanged();
                    }
                    // layout.getLocation applies the layout transformer so
                    // q is transformed by the layout transformer only
                    Point2D q = layout.getLocation(vertex);
                    // transform the mouse point to graph coordinate system
                    Point2D gp = vv.inverseLayoutTransform(ip);

                    offsetx = (float) (gp.getX()-q.getX());
                    offsety = (float) (gp.getY()-q.getY());
                } else if(isPickingEdges() &&
                        (edge = pickSupport.getEdge(ip.getX(), ip.getY())) != null) {
                    pickedState.clearPickedEdges();
                    pickedState.pick(edge, true);
                } else {
                    pickedState.clearPickedEdges();
                    pickedState.clearPickedVertices();
                    vv.fireStateChanged();
                }
               
            } else if(e.getModifiers() == (addToSelectionModifiers)) {
                vv.addPostRenderPaintable(lensPaintable);
                rect.setFrameFromDiagonal(down,down);
                Point2D p = e.getPoint();
                // remove view transform
                Point2D ip = vv.inverseViewTransform(p);
                vertex = pickSupport.getVertex(ip.getX(), ip.getY());
                if(vertex != null) {
                    boolean wasThere = pickedState.pick(vertex, !pickedState.isPicked(vertex));
                    if(wasThere) {
                        vertex = null;
                    } else {
                        // layout.getLocation applies the layout transformer so
                        // q is transformed by the layout transformer only
                        Point2D q = layout.getLocation(vertex);
                        // translate mouse point to graph coord system
                        Point2D gp = vv.inverseLayoutTransform(ip);

                        offsetx = (float) (gp.getX()-q.getX());
                        offsety = (float) (gp.getY()-q.getY());
                    }
                } else if(isPickingEdges() &&
                        (edge = pickSupport.getEdge(ip.getX(), ip.getY())) != null) {
                    pickedState.pick(edge, !pickedState.isPicked(edge));
                }
            }
        }
       if(vertex != null) e.consume();
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

                Point2D graphPoint = vv.inverseTransform(p);
                Point2D graphDown = vv.inverseTransform(down);
                Layout layout = vv.getGraphLayout();
                double dx = graphPoint.getX()-graphDown.getX();
                double dy = graphPoint.getY()-graphDown.getY();
                PickedState ps = vv.getPickedState();
               
                for(Iterator iterator=ps.getPickedVertices().iterator(); iterator.hasNext(); ) {
                    Vertex v = (Vertex)iterator.next();
                    Point2D vp = layout.getLocation(v);
                    if (!layout.isLocked(v)) {
                        layout.forceMove(v, vp.getX()+dx, vp.getY()+dy);
                    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

            final VisualizationViewer vv = (VisualizationViewer)e.getSource();
            final Graph graph = vv.getGraphLayout().getGraph();
            Point2D ip = vv.inverseViewTransform(p);

            PickSupport picksupport = vv.getPickSupport();
            final PickedState pickedstate = vv.getPickedState();
            Vertex v = picksupport.getVertex(ip.getX(), ip.getY());
            if (v != null && hasSomethingToDisplay(v, vv)) {
                String hostname = getGraphManager().getLabel(v);
               
                // open the new window
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

     *
     * @param key The name of the view in which to locate the host
     * @param host The name of the host to locate
     */
    public void locateHost(String key, String host)  {
        PickedState pickedstate = getVV(key).getPickedState();
        int searchtype = 0;
        String theHost = host.trim();
       
        if (theHost.startsWith("*")) {
            searchtype = 1;
        }
        if (theHost.endsWith("*")) {
            searchtype = 2;
        }
        if (searchtype == 0 ||
                theHost.startsWith("*") && theHost.endsWith("*")) {
            searchtype = 3;
        }
           
        theHost = theHost.replace(Character.toString('*'), "");
        Set verts = _myGraph.getVertices();
        pickedstate.clearPickedVertices();
        for (Object o: verts) {
            if (o instanceof Vertex) {
                switch (searchtype) {
                    case 1:
                        if (getLabel((Vertex)o).endsWith(theHost))
                            pickedstate.pick((Vertex)o, true);
                        break;
                    case 2:
                        if (getLabel((Vertex)o).startsWith(theHost))
                            pickedstate.pick((Vertex)o, true);
                        break;
                    case 3:
                        if (getLabel((Vertex)o).contains(theHost))
                            pickedstate.pick((Vertex)o, true);                       
                        break;
                }
            }
        }
        pickedVertices = pickedstate.getPickedVertices();
        pickedVerticesIt = pickedVertices.iterator();
        moveToNextHost(key);
    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

     *
     * @param key The view name to deselect the hosts from
     * @see PickedState
     */
    public void clearSelectedHosts(String key) {
        PickedState pickedstate = getVV(key).getPickedState();
        pickedstate.clearPickedVertices();
    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

            //graphMouse.setConsumer(NexsmEditingModalGraphMouse.Consumer.);
        }
    }
   
    public void lockSelectedVertices(String key) {
        PickedState pickedstate = getVV(key).getPickedState();
        Set vertices = pickedstate.getPickedVertices();
        if (!vertices.isEmpty()) {
            for (Object o : vertices) {
                if (o instanceof Vertex) {
                    lockVertex((Vertex)o, key);
                }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

            clearSelectedHosts(key);
        }
    }
   
    public void unLockSelectedVertices(String key) {
        PickedState pickedstate = getVV(key).getPickedState();
        Set vertices = pickedstate.getPickedVertices();
        if (!vertices.isEmpty()) {
            for (Object o : vertices) {
                if (o instanceof Vertex) {
                    unLockVertex((Vertex)o, key);
                }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

            clearSelectedHosts(key);
        }
    }
   
    public void selectAllVertices(String key) {
        PickedState pickedstate = getVV(key).getPickedState();
        Set vertices = _myGraph.getVertices();
        for (Object o: vertices) {
            if (o instanceof Vertex) {
                pickedstate.pick((Vertex)o, true);
            }
        }
    }
View Full Code Here

Examples of edu.uci.ics.jung.visualization.PickedState

            }
        }
    }
   
    public void alignSelectedVertices(String key, Location loc) {
        PickedState pickedstate = getVV(key).getPickedState();
        Set vertices = pickedstate.getPickedVertices();
        Layout l = getVV(key).getGraphLayout();
        Vertex v = null;
        if (!vertices.isEmpty()) {
            Iterator it = vertices.iterator();
            v = (Vertex)it.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.