Logo Search packages:      
Sourcecode: libjgrapht-java version File versions  Download package

void org::_3pq::jgrapht::ext::JGraphModelAdapter::handleJGraphInsertedEdge ( org.jgraph.graph.Edge  jEdge  )  [inline, package]

Adds to the underlying JGraphT graph an edge that corresponds to the specified JGraph edge. If the specified JGraph edge is a dangling edge, it is NOT added to the underlying JGraphT graph.

This method is to be called only for edges that have already been added to the JGraph graph.

jEdge the JGraph edge that has been added.

Definition at line 500 of file JGraphModelAdapter.java.

References org::_3pq::jgrapht::ext::JGraphModelAdapter::ShieldedGraph::addEdge(), org::_3pq::jgrapht::EdgeFactory::createEdge(), org::_3pq::jgrapht::ext::JGraphModelAdapter::ShieldedGraph::getEdgeFactory(), internalRemoveCell(), isDangling(), m_cellToEdge, m_cellToVertex, and m_edgeToCell.

Referenced by handleJGraphChangedEdge().

        if( isDangling( jEdge ) ) {
            // JGraphT forbid dangling edges so we cannot add the edge yet.
            // If later the edge becomes connected, we will add it.
        else {
            Object                jSource = getSourceVertex( this, jEdge );
            Object                jTarget = getTargetVertex( this, jEdge );

            Object                jtSource = m_cellToVertex.get( jSource );
            Object                jtTarget = m_cellToVertex.get( jTarget );

            org._3pq.jgrapht.Edge jtEdge =
                m_jtGraph.getEdgeFactory(  ).createEdge( jtSource, jtTarget );

            boolean added = m_jtGraph.addEdge( jtEdge );

            if( added ) {
                m_cellToEdge.put( jEdge, jtEdge );
                m_edgeToCell.put( jtEdge, jEdge );
            else {
                // Adding failed because user is using a JGraphT graph the
                // forbids parallel edges.
                // For consistency, we remove the edge from the JGraph too.
                internalRemoveCell( jEdge );
                    "Warning: an edge was deleted because the underlying "
                    + "JGraphT graph refused to create it. "
                    + "This situation can happen when a constraint of the "
                    + "underlying graph is violated, e.g., an attempt to add "
                    + "a parallel edge or a self-loop to a graph that forbids "
                    + "them. To avoid this message, make sure to use a "
                    + "suitable underlying JGraphT graph." );

Generated by  Doxygen 1.6.0   Back to index