// inform the bridge context the builder to use
ctx.setGVTBuilder(this);
// build the GVT tree
DocumentBridge dBridge = ctx.getDocumentBridge();
RootGraphicsNode rootNode = null;
try {
// create the root node
rootNode = dBridge.createGraphicsNode(ctx, document);
Element svgElement = document.getDocumentElement();
GraphicsNode topNode = null;
// get the appropriate bridge according to the specified element
Bridge bridge = ctx.getBridge(svgElement);
if (bridge == null || !(bridge instanceof GraphicsNodeBridge)) {
return null;
}
// create the associated composite graphics node
GraphicsNodeBridge gnBridge = (GraphicsNodeBridge)bridge;
topNode = gnBridge.createGraphicsNode(ctx, svgElement);
if (topNode == null) {
return null;
}
rootNode.getChildren().add(topNode);
buildComposite(ctx, svgElement, (CompositeGraphicsNode)topNode);
gnBridge.buildGraphicsNode(ctx, svgElement, topNode);
// finally, build the root node