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

void org::_3pq::jgrapht::ext::JGraphModelAdapter::JGraphListener::graphChanged ( GraphModelEvent  e  )  [inline]

This method is called for all JGraph changes.

Parameters:
e 

Definition at line 862 of file JGraphModelAdapter.java.

References filterEdges(), and filterVertices().

                                                      {
            // We first remove edges that have to be removed, then we
            // remove vertices, then we add vertices and finally we add
            // edges. Otherwise, things might go wrong: for example, if we
            // would first remove vertices and then edges, removal of the
            // vertices might induce 'automatic' removal of edges. If we
            // later attempt to re-remove these edges, we get confused.
            GraphModelChange change = e.getChange(  );

            Object[]         removedCells = change.getRemoved(  );

            if( removedCells != null ) {
                handleRemovedEdges( filterEdges( removedCells ) );
                handleRemovedVertices( filterVertices( removedCells ) );
            }

            Object[] insertedCells = change.getInserted(  );

            if( insertedCells != null ) {
                handleInsertedVertices( filterVertices( insertedCells ) );
                handleInsertedEdges( filterEdges( insertedCells ) );
            }

            // Now handle edges that became 'dangling' or became connected.
            Object[] changedCells = change.getChanged(  );

            if( changedCells != null ) {
                handleChangedEdges( filterEdges( changedCells ) );
            }
        }


Generated by  Doxygen 1.6.0   Back to index