@Test public void testLayout() throws Exception { final double height = 2.5d; final double delta = 0.00000001d; final WiresShape parent = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); final WiresShape child1 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); parent.add(child1); final WiresShape grandchild11 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); final WiresShape grandchild12 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); parent.add(grandchild11); parent.add(grandchild12); final WiresShape child2 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); parent.add(child2); final WiresShape grandchild21 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); final WiresShape grandchild22 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); parent.add(grandchild21); parent.add(grandchild22); final WiresShape child3 = new WiresShape(new MultiPath().rect(0.0d, 0.0d, 1.0d, height)); parent.add(child3); this.getLayoutHandler().layout(parent); assertEquals(child1.getLocation().getX(), PADDING_X, delta); assertEquals(child2.getLocation().getX(), PADDING_X, delta); assertEquals(child3.getLocation().getX(), PADDING_X, delta); assertEquals(child1.getLocation().getY(), (PADDING_Y + height), delta); assertEquals(child2.getLocation().getY(), (PADDING_Y + height) * 4, delta); assertEquals(child3.getLocation().getY(), (PADDING_Y + height) * 7, delta); }
@Override public void layout(final WiresContainer container) { double y = PADDING_Y; if (container instanceof WiresShape) { y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight(); } for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(PADDING_X, y)); y = y + getTotalHeight(ws) + PADDING_Y; } }
VerticalStackLayoutManager extends AbstractNestedLayoutHandler { @Override public void layout(final WiresContainer container) { double y = PADDING_Y; if (container instanceof WiresShape) { y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight(); } for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(PADDING_X, y)); y = y + getTotalHeight(ws) + PADDING_Y; } } }
VerticalStackLayoutManager extends AbstractNestedLayoutHandler { @Override public void layout(final WiresContainer container) { double y = PADDING_Y; if (container instanceof WiresShape) { y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight(); } for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(PADDING_X, y)); y = y + getTotalHeight(ws) + PADDING_Y; } }  }
VerticalStackLayoutManager extends AbstractNestedLayoutHandler { @Override public void layout(final WiresContainer container) { double y = PADDING_Y; if (container instanceof WiresShape) { y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight(); } for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(PADDING_X, y)); y = y + getTotalHeight(ws) + PADDING_Y; } }  @Override void layout(final WiresContainer container); }
VerticalStackLayoutManager extends AbstractNestedLayoutHandler { @Override public void layout(final WiresContainer container) { double y = PADDING_Y; if (container instanceof WiresShape) { y = y + ((WiresShape) container).getPath().getBoundingBox().getHeight(); } for (WiresShape ws : container.getChildShapes()) { ws.setLocation(new Point2D(PADDING_X, y)); y = y + getTotalHeight(ws) + PADDING_Y; } }  @Override void layout(final WiresContainer container);  }