public Rectangle2D.Double layout( CompositeFigure compositeFigure, Point2D.Double anchor, Point2D.Double lead) { Rectangle2D.Double bounds = null; for (Figure child : compositeFigure.getChildren()) { Locator locator = getLocator(child); Rectangle2D.Double r; if (locator == null) { r = child.getBounds(); } else { Point2D.Double p = locator.locate(compositeFigure, child); Dimension2DDouble d = child.getPreferredSize(); r = new Rectangle2D.Double(p.x, p.y, d.width, d.height); } child.willChange(); child.setBounds( new Point2D.Double(r.getMinX(), r.getMinY()), new Point2D.Double(r.getMaxX(), r.getMaxY())); child.changed(); if (!r.isEmpty()) { if (bounds == null) { bounds = r; } else { bounds.add(r); } } } return (bounds == null) ? new Rectangle2D.Double() : bounds; }
public Rectangle2D.Double calculateLayout( CompositeFigure compositeFigure, Point2D.Double anchor, Point2D.Double lead) { Rectangle2D.Double bounds = null; for (Figure child : compositeFigure.getChildren()) { Locator locator = getLocator(child); Rectangle2D.Double r; if (locator == null) { r = child.getBounds(); } else { Point2D.Double p = locator.locate(compositeFigure); Dimension2DDouble d = child.getPreferredSize(); r = new Rectangle2D.Double(p.x, p.y, d.width, d.height); } if (!r.isEmpty()) { if (bounds == null) { bounds = r; } else { bounds.add(r); } } } return (bounds == null) ? new Rectangle2D.Double() : bounds; }
/** Gets the display box of the connector. */ @Override public Rectangle2D.Double getBounds() { Point2D.Double p = locator.locate(getOwner()); return new Rectangle2D.Double(p.x - SIZE / 2, p.y - SIZE / 2, SIZE, SIZE); }
protected Point2D.Double locate(ConnectionFigure connection) { return locator.locate(getOwner()); }