insertEdge(null, null, new Node(null), source, target,
arrow ? SVNRevisionGraph.COPY_OR_MERGE_LINK_STYLE : SVNRevisionGraph.IN_BRANCH_LINK_STYLE);
}
private void layoutGraph() {
mxCell lastCell = null;
Double nextY = null;
int i = 0;
for (String path : revMap.keySet()) {
ArrayList<Revision> revsOnPath = revMap.get(path);
if (i != 0) {
Revision firstRev = revsOnPath.get(0);
lastCell = getLinkedCell(firstRev);
}
int relativePosition = SwingConstants.BOTTOM;
double widestY = 0;
for (Revision rev : revsOnPath) {
mxCell cell = cellMap.get(rev);
if (cell != lastCell) {
lastCell = positionCell(lastCell, relativePosition, nextY, cell);
relativePosition = SwingConstants.RIGHT;
mxRectangle rect = lastCell.getGeometry();
widestY = Math.max(widestY, rect.getY() + rect.getHeight());
}
}
nextY = widestY + SVNRevisionGraph.CELL_SPACING;
i++;
}
//Now adjust x position in order of revision numbers
for (i = 1; i < revisions.size(); i++) {
Revision rev = revisions.get(i);
Revision prevRev = revisions.get(i - 1);
mxCell cell = cellMap.get(rev);
mxCell prevCell = cellMap.get(prevRev);
if (cell != prevCell) {
Rectangle rect = cell.getGeometry().getRectangle();
positionCell(prevCell,
rev.getRevisionNumber() > prevRev.getRevisionNumber() ? SwingConstants.RIGHT : SwingConstants.BOTTOM,
rect.getY(), cell);