.getVisualObject(origHead);
// Swap the head and the tail if it will improve the
// layout, since LevelLayout only uses directed edges.
if (tailFigure instanceof Terminal) {
Terminal terminal = (Terminal) tailFigure;
Site site = terminal.getConnectSite();
if (site instanceof FixedNormalSite) {
double normal = site.getNormal();
int direction = CanvasUtilities
.getDirection(normal);
if (direction == SwingUtilities.WEST) {
Object temp = origTail;
origTail = origHead;
origHead = temp;
}
}
} else if (headFigure instanceof Terminal) {
Terminal terminal = (Terminal) headFigure;
Site site = terminal.getConnectSite();
if (site instanceof FixedNormalSite) {
double normal = site.getNormal();
int direction = CanvasUtilities
.getDirection(normal);