@Override
    public void paint(final Graphics2D g) {
        g.setPaint(getEdge().getFgColor());
        g.setStroke(getEdge().getFgStroke());
        g.drawLine(this.edge.getSourceX(), this.edge.getSourceY(), this.edge.getTargetX(), this.edge.getTargetY());

        final Integer x1 = getEdge().getSourceX();
        final Integer y1 = getEdge().getSourceY();
        final Integer x2 = getEdge().getTargetX();
        final Integer y2 = getEdge().getTargetY();

        Double angle = null;

        if (x1 == x2) {
            if (y2 > y1) {
                angle = -Math.PI / 2;
            } else if (y1 > y2) {
                angle = Math.PI / 2;
            } else {
                angle = 0d;
            }
        }
        if (y1 == y2 && angle == null) {
            if (x1 > x2) {
                angle = Math.PI;
            } else {
                angle = 0d;
            }
        }
        if (angle == null) {
            angle = Math.atan(((double) (y1 - y2)) / ((double) (x2 - x1)));
            if (x1 > x2)
                angle += Math.PI;
        }

        final AffineTransform oldTransform = g.getTransform();

        g.translate(x2, y2);

        g.rotate(-angle);

        g.draw(getEdge().getEndShape());
        g.fill(getEdge().getEndShape());

        if (this.edge.getEdgeType() == BPEdge.CONDITIONAL_EDGE) {
            g.setTransform(oldTransform);

            g.translate(x1, y1);
            g.rotate(-angle);

            g.setPaint(getEdge().getFgColor());
            g.setStroke(getEdge().getFgStroke());
            g.draw(getEdge().getStartShape());

            g.setPaint(getEdge().getBgColor());
            g.setStroke(getEdge().getBgStroke());
            g.fill(getEdge().getStartShape());
        }

        g.setTransform(oldTransform);

    }