upDownNodeLayout(child, node, node.x, node.y); s = child.sibling; siblingOffset = node.x + child.offsetY; while (s != null) { upDownNodeLayout(s, node, siblingOffset, node.y + child.offsetX); siblingOffset += s.offsetY;
/** * Top-level layout method for Moen * * @param root * the root node of the tree */ protected void layoutTree(CompactTreeNode root) { // kick off Moen's algorithm layout(root); Rectangle2D rect = graph.getBounds(root.getCell()); double rootPositionX = rect.getX(); double rootPositionY = rect.getY(); switch (orientation) { case SwingConstants.WEST: leftRightNodeLayout(root, rootPositionX, rootPositionY); break; case SwingConstants.NORTH: upDownNodeLayout(root, null, rootPositionX, rootPositionY); break; default: leftRightNodeLayout(root, rootPositionX, rootPositionY); } }