*/
public class EdgeViewFactory {
final private static EdgeViewFactory instance = new EdgeViewFactory();
public EdgeView getEdge(final NodeView source, final NodeView target, Component paintedComponent) {
final EdgeStyle edgeStyle = target.getEdgeStyle();
if (source.getMap().getLayoutType() == MapViewLayout.OUTLINE) {
if(edgeStyle.equals(EdgeStyle.EDGESTYLE_HIDDEN))
return new HiddenOutlineEdgeView(source, target, paintedComponent);
return new OutlineEdgeView(source, target, paintedComponent);
}
if (edgeStyle.equals(EdgeStyle.EDGESTYLE_LINEAR)) {
return new LinearEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_BEZIER)) {
return new BezierEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_SUMMARY)) {
return new SummaryEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_SHARP_LINEAR)) {
return new SharpLinearEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_SHARP_BEZIER)) {
return new SharpBezierEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_HORIZONTAL)) {
return new HorizontalEdgeView(source, target, paintedComponent);
}
else if (edgeStyle.equals(EdgeStyle.EDGESTYLE_HIDDEN)) {
return new HiddenEdgeView(source, target, paintedComponent);
}
else {
System.err.println("Unknown Edge Type.");
return new LinearEdgeView(source, target, paintedComponent);