public class BasicEdgeRenderer implements EdgeRenderer {
/**
* Render a visual representation of the given edge.
*/
public Connector render(Object edge, Site tailSite, Site headSite) {
AbstractConnector c;
Figure tf = tailSite.getFigure();
Figure hf = headSite.getFigure();
//if the edge is a self loop, create an ArcConnector instead!
if ((tf != null) && (hf != null) && (tf == hf)) {
c = new ArcConnector(tailSite, headSite);
} else {
c = new StraightConnector(tailSite, headSite);
}
Arrowhead arrow = new Arrowhead(headSite.getX(), headSite.getY(),
headSite.getNormal());
c.setHeadEnd(arrow);
return c;
}