use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge in project binnavi by google.
the class ProximityNodeCreator method insertProximityEdge.
/**
* Inserts a proximity edge between two nodes. One of the two input nodes must be a proximity
* browsing node or an exception is thrown.
*
* @param graph The graph where the node is inserted.
* @param sourceNode The source node of the edge.
* @param targetNode The target node of the edge.
*
* @return The inserted edge.
*/
public static ZyInfoEdge insertProximityEdge(final Graph2D graph, final ZyGraphNode<?> sourceNode, final ZyGraphNode<?> targetNode) {
Preconditions.checkNotNull(graph, "Graph argument can not be null");
Preconditions.checkNotNull(sourceNode, "Source node argument can not be null");
Preconditions.checkNotNull(targetNode, "Target node argument can not be null");
Preconditions.checkArgument((sourceNode instanceof ZyProximityNode<?>) || (targetNode instanceof ZyProximityNode<?>), "One of the two arguments must be a proximity browsing node");
final ZyEdgeRealizer<ZyInfoEdge> r = new ZyEdgeRealizer<ZyInfoEdge>(new ZyLabelContent(null), null);
r.setLineType(LineType.LINE_2);
final Edge edge = graph.createEdge(sourceNode.getNode(), targetNode.getNode(), r);
final ZyInfoEdge infoEdge = new ZyInfoEdge(sourceNode, targetNode, edge, r);
final ZyEdgeData<ZyInfoEdge> data = new ZyEdgeData<ZyInfoEdge>(infoEdge);
r.setUserData(data);
return infoEdge;
}
Aggregations