/** * Sets the new positions of the cells in the graph based on the information * from the interal tree nodes. Note this doesn't apply the position to the * actual graph, only stores the bounds values to be applied later * * @param treeLayoutNodes * the nodes of the internal tree structure that describe the new * tree layout */ protected void dispatchResult(Collection treeLayoutNodes) { Iterator it = treeLayoutNodes.iterator(); while (it.hasNext()) { CompactTreeNode node = (CompactTreeNode) it.next(); graph.setLocation(node.getCell(), node.x, node.y); } }
/** * 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); } }