Package net.sourceforge.jpowergraph

Examples of net.sourceforge.jpowergraph.Edge


            }
        }
        if (edges != null) {
            Iterator iterator = edges.iterator();
            while (iterator.hasNext()) {
                Edge edge = (Edge) iterator.next();
                if (!m_edges.contains(edge)) {
                    m_edges.add(edge);
                    ((DefaultNode) edge.getFrom()).notifyEdgeAdded(edge);
                    ((DefaultNode) edge.getTo()).notifyEdgeAdded(edge);
                }
            }
        }
        fireElementsAdded(nodes, edges);
    }
View Full Code Here


                }
            }
        }
        if (edges != null) {
            for (Iterator i = m_edges.iterator(); i.hasNext();) {
                Edge cedge = (Edge) i.next();
                if (edges.contains(cedge)) {
                    edges.remove(cedge);
                }
                else {
                    edgesToRemove.add(cedge);
View Full Code Here

    public void mouseDoubleClick(JPowerGraphMouseEvent e) {
        if (getGraphPane().isEnabled() && e.getButton() == JPowerGraphMouseEvent.LEFT && doubleClickListener != null) {
            Legend legend = getGraphPane().getLegendAtPoint(e.getPoint());
            Node node = getGraphPane().getNodeAtPoint(e.getPoint());
            Edge edge = getGraphPane().getNearestEdge(e.getPoint());

            if (legend != null) {
                doubleClickListener.doubleClick(e, legend);
            }
            else if (node != null) {
View Full Code Here

                setHighlightedNode(nodeAtPoint);
                setHighlightedEdge(null);
            }
            else {
                setHighlightedNode(null);
                Edge edgeAtPoint=getGraphPane().getNearestEdge(e.getPoint());
                setHighlightedEdge(edgeAtPoint);
            }
        }
        else {
            setHighlightedNode(null);
View Full Code Here

        return m_highlightedEdge;
    }
   
    public void setHighlightedEdge(Edge highlightedEdge) {
        if (highlightedEdge != m_highlightedEdge) {
            Edge oldHighlightedEdge = m_highlightedEdge;
            if (oldHighlightedEdge != null){
                getGraphPane().repaintEdge(oldHighlightedEdge);
            }
            m_highlightedEdge = highlightedEdge;
            if (m_highlightedEdge != null){
View Full Code Here

            public void doStuff(){
                ArrayList <Node> nodes = new ArrayList <Node> ();
                nodes.add(theNode);
                ArrayList <Edge> edges = new ArrayList <Edge> ();
                for (Iterator i = graph.getVisibleEdges().iterator(); i.hasNext();) {
                    Edge edge = (Edge) i.next();
                    if (edge.getFrom().equals(theNode) || edge.getTo().equals(theNode)){
                        edges.add(edge);
                    }
                }
                graph.deleteElements(nodes, edges);
            }
View Full Code Here

        if (m_graph != null){
            synchronized (m_graph) {
                JPowerGraphRectangle bounds = new JPowerGraphRectangle(0, 0, 0, 0);
                Iterator iterator = m_graph.getVisibleEdges().iterator();
                while (iterator.hasNext()) {
                    Edge edge = (Edge) iterator.next();
                    getEdgeScreenBounds(edge, bounds);
                    if (clipRectangle.intersects(bounds)){
                        paintEdge(buffer, edge);
                    }
                }
View Full Code Here

     *            the screen point
     * @return the edge at given point (or <code>null</code> if there is no
     *         such edge)
     */
    public Edge getNearestEdge(JPowerGraphPoint point) {
        Edge nearestEdge = null;
        double minDistance = 4;
        synchronized (m_graph) {
            List edges = m_graph.getVisibleEdges();
            ListIterator iterator = edges.listIterator(edges.size());
            while (iterator.hasPrevious()) {
                Edge edge = (Edge) iterator.previous();
                EdgePainter edgePainter = getPainterForEdge(edge);
                double distance = edgePainter.screenDistanceFromEdge(this, edge, point);
                if (distance < minDistance) {
                    minDistance = distance;
                    nearestEdge = edge;
View Full Code Here

        final SWTJGraphPane graphPane = (SWTJGraphPane) theGraphPane;

        JPowerGraphPoint point = e.getPoint();
        Legend legend = graphPane.getLegendAtPoint(point);
        Node node = graphPane.getNodeAtPoint(point);
        Edge edge = graphPane.getNearestEdge(point);

        closeRightClickIfNeeded(graphPane);
        rightClick = new Menu(graphPane);
        graphPane.setMenu(rightClick);
        rightClick.addMenuListener(new MenuListener() {
View Full Code Here

            public void doStuff(){
                ArrayList <Node> nodes = new ArrayList <Node> ();
                nodes.add(theNode);
                ArrayList <Edge> edges = new ArrayList <Edge> ();
                for (Iterator i = graph.getVisibleEdges().iterator(); i.hasNext();) {
                    Edge edge = (Edge) i.next();
                    if (edge.getFrom().equals(theNode) || edge.getTo().equals(theNode)){
                        edges.add(edge);
                    }
                }
                graph.deleteElements(nodes, edges);
            }
View Full Code Here

TOP

Related Classes of net.sourceforge.jpowergraph.Edge

Copyright © 2018 www.massapicom. 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.