/** * If the first argument is an Edge in the referenced GraphPerspective, sets * its selected state to the value of the second argument. An event will be * fired iff the new state is different from the old state. * * @return true if an actual change was made, false otherwise */ public boolean setSelected(final Edge edge, final boolean newState) { boolean setChanged; if (newState == true) { // set flag to on // don'tflagthe edge if it's not in the graph if (!graph.containsEdge(edge)) { return false; } setChanged = selectedEdges.add(edge); if (setChanged) { fireEvent(edge, true); } } else { // set flag to off // an edge can't be selected unless it's in the graph setChanged = selectedEdges.remove(edge); if (setChanged) { fireEvent(edge, false); } } return setChanged; }
if (!graph.containsEdge(edge)) { continue;
if (!persp.containsEdge(twoEdges[1])) throw new IllegalStateException("GraphPersp does not contain edge"); if (persp.containsEdge(root2Edge)) throw new IllegalStateException("GraphPersp contains edge from other"); if (persp.containsEdge(edge1NotInPersp) || persp.containsEdge(edge2NotInPersp) || !(persp.getRootGraph().containsEdge(edge1NotInPersp) && persp.getRootGraph().containsEdge(edge2NotInPersp))) if (persp.containsEdge(edge1NotInPersp, false)) throw new IllegalStateException("GraphPersp should not contains edge"); if (!persp.containsEdge(edge1NotInPersp, true)) throw new IllegalStateException("GraphPersp should contain edge recur.");