/** * Lays out all children in a hierarchical decomposition graph. Nodes are arranged using * layoutNode() and edges are updated afterwards. This also updates it's own bounds according to * the placement of the children. */ @Override protected void layoutChildren() { // layout all top nodes (not LinkNodes) double firstX[] = new double[project.getCategorySize() + 2]; for (int i = 0; i < getChildrenCount(); i++) { PNode node = getChild(i); if (!(node instanceof LinkNode)) { layoutNode(node, 0, firstX); } } // Update all LinkNodes for (int i = 0; i < getChildrenCount(); i++) { PNode node = getChild(i); if (node instanceof LinkNode) { ((LinkNode) node).updateLine(); } } // Update bounds double maxX = 0; for (int i = 0; i < firstX.length; i++) { if (firstX[i] > maxX) { maxX = firstX[i]; } else if (firstX[i] == 0) { double height = i * (CategoryNode.HEIGHT + CategoryNode.PADDING_HEIGHT); setBounds(0, 0, maxX, height); break; } } }