/** To implement {@link org.w3c.dom.svg.SVGLocatable#getBBox()}. */ public static SVGRect getBBox(Element elt) { final SVGOMElement svgelt = (SVGOMElement) elt; SVGContext svgctx = svgelt.getSVGContext(); if (svgctx == null) return null; if (svgctx.getBBox() == null) return null; return new SVGRect() { public float getX() { return (float) svgelt.getSVGContext().getBBox().getX(); } public void setX(float x) throws DOMException { throw svgelt.createDOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getY() { return (float) svgelt.getSVGContext().getBBox().getY(); } public void setY(float y) throws DOMException { throw svgelt.createDOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getWidth() { return (float) svgelt.getSVGContext().getBBox().getWidth(); } public void setWidth(float width) throws DOMException { throw svgelt.createDOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } public float getHeight() { return (float) svgelt.getSVGContext().getBBox().getHeight(); } public void setHeight(float height) throws DOMException { throw svgelt.createDOMException( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.rect", null); } }; }