public Surface find(String fullId) { if (fullId.equals(getFullId())) return this; for (Surface child : children) { Surface result = child.find(fullId); if (result != null) return result; } return null; }
public String getFullId() { StringBuffer sbuf = new StringBuffer(getId()); Surface curr = getParent(); while (curr != null) { sbuf.insert(0, curr.getId() + "."); curr = curr.getParent(); } return sbuf.toString(); }
public Rectangle2D getBoundingBox() { if (worldGeometry != null) return (Rectangle2D) worldGeometry.clone(); Rectangle2D bbox = null; for (Surface child : children) { if (bbox == null) bbox = child.getBoundingBox(); else bbox = bbox.createUnion(child.getBoundingBox()); } return bbox; }
public void removeChild(Surface child) { if (children.remove(child)) { child.setParent(null); } }
public void addChild(Surface child) { children.add(child); child.setParent(this); }