addGVTTreeRendererListener(new GVTTreeRendererAdapter() {
@Override
public void gvtRenderingStarted(final GVTTreeRendererEvent e) {
super.gvtRenderingStarted(e);
final SVGDocument document = getSVGDocument();
final SVGSVGElement rootElement = document.getRootElement();
final SVGLength width = rootElement.getWidth().getBaseVal();
final SVGLength height = rootElement.getHeight().getBaseVal();
float defaultWidth = (float) Math.ceil(width.getValue());
float defaultHeigth = (float) Math.ceil(height.getValue());
if (defaultWidth == 1f && defaultHeigth == 1f) {
defaultWidth = ResourceController.getResourceController().getIntProperty(
"default_external_component_width", 200);
defaultHeigth = ResourceController.getResourceController().getIntProperty(
"default_external_component_height", 200);
}
originalSize = new Dimension((int) defaultWidth, (int) defaultHeigth);
if ("".equals(rootElement.getAttributeNS(null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE))) {
rootElement.setAttributeNS(null, SVGConstants.SVG_VIEW_BOX_ATTRIBUTE, "0 0 " + defaultWidth
+ " " + defaultHeigth);
}
removeGVTTreeRendererListener(this);
}
});