Search in sources :

Example 1 with ZyInfoEdge

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;
}
Also used : ZyEdgeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyEdgeRealizer) ZyInfoEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge) ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) ZyEdgeData(com.google.security.zynamics.zylib.gui.zygraph.edges.ZyEdgeData) ZyInfoEdge(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge) Edge(y.base.Edge)

Aggregations

ZyEdgeData (com.google.security.zynamics.zylib.gui.zygraph.edges.ZyEdgeData)1 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)1 ZyInfoEdge (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.edges.ZyInfoEdge)1 ZyEdgeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyEdgeRealizer)1 Edge (y.base.Edge)1