public SwtUniversalImageSvg( SvgImage svg ) { // get GraphicsNode and size from svg document UserAgentAdapter userAgentAdapter = new UserAgentAdapter(); DocumentLoader documentLoader = new DocumentLoader( userAgentAdapter ); BridgeContext ctx = new BridgeContext( userAgentAdapter, documentLoader ); GVTBuilder builder = new GVTBuilder(); svgGraphicsNode = builder.build( ctx, svg.getDocument() ); svgGraphicsSize = ctx.getDocumentSize(); }
DocumentLoader documentLoader = new DocumentLoader(userAgent); this.svgDocument = documentLoader.loadDocument(new File(fn).toURI().toString()); return this.getClass().getSimpleName() + ": exception loading svgDocument - " + ex.getMessage(); documentLoader.dispose();
final long version = data.getVersion( caller ); final HeadlessSVGUserAgent userAgent = new HeadlessSVGUserAgent(); final DocumentLoader loader = new DocumentLoader( userAgent ); final ResourceKey key = data.getKey(); URL url = caller.toURL( key ); url = new File( "." ).toURI().toURL(); final SVGDocument document = (SVGDocument) loader.loadDocument ( url.toURI().toASCIIString(), data.getResourceAsStream( caller ) ); final BridgeContext ctx = new BridgeContext( userAgent, loader );
String fileName = files[ i ].toURI().toURL().toString(); System.out.println("Reading: " + fileName ); Document svgDoc = loader.loadDocument( fileName ); System.out.println("Building: " + fileName ); gvtRoot = builder.build(ctx, svgDoc);
UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag);
Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc;
/** * Constructs a new <code>BridgeException</code> with the specified parameters. * * @param ctx the bridge context to use for determining the element's * source position * @param e the element on which the error occurred * @param message the error message */ public BridgeException(BridgeContext ctx, Element e, String message) { this.e = e; this.message = message; if (e != null && ctx != null) { this.line = ctx.getDocumentLoader().getLineNumber(e); } }
/** * Returns a document from the specified uri. * @param uri the uri of the document * @exception IOException if an I/O error occured while loading * the document */ public Document loadDocument(String uri, InputStream is) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri, is); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
public Resource create( final ResourceManager caller, final ResourceData data, final ResourceKey context ) throws ResourceLoadingException { try { final long version = data.getVersion( caller ); final HeadlessSVGUserAgent userAgent = new HeadlessSVGUserAgent(); final DocumentLoader loader = new DocumentLoader( userAgent ); final ResourceKey key = data.getKey(); URL url = caller.toURL( key ); if ( url == null ) { url = new File( "." ).toURI().toURL(); } final SVGDocument document = (SVGDocument) loader.loadDocument ( url.toURI().toASCIIString(), data.getResourceAsStream( caller ) ); final BridgeContext ctx = new BridgeContext( userAgent, loader ); final GVTBuilder builder = new GVTBuilder(); final GraphicsNode node = builder.build( ctx, document ); return new SimpleResource( data.getKey(), new SVGDrawable( node ), DrawableWrapper.class, version ); } catch ( IOException e ) { throw new ResourceLoadingException( "Failed to process SVG file", e ); } catch ( URISyntaxException e ) { throw new ResourceLoadingException( "Failed to process SVG file", e ); } }
String fileName = files[ i ].toURI().toURL().toString(); System.out.println("Reading: " + fileName ); Document svgDoc = loader.loadDocument( fileName ); System.out.println("Building: " + fileName ); gvtRoot = builder.build(ctx, svgDoc);
UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag);
Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc;
/** * Constructs a new <code>BridgeException</code> with the specified parameters. * * @param ctx the bridge context to use for determining the element's * source position * @param e the element on which the error occurred * @param message the error message */ public BridgeException(BridgeContext ctx, Element e, String message) { this.e = e; this.message = message; if (e != null && ctx != null) { this.line = ctx.getDocumentLoader().getLineNumber(e); } }
/** * Returns a document from the specified uri. * @param uri the uri of the document * @exception IOException if an I/O error occured while loading * the document */ public Document loadDocument(String uri, InputStream is) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri, is); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }
public SwingUniversalImageSvg( SvgImage svg ) { // get GraphicsNode and size from svg document UserAgentAdapter userAgentAdapter = new UserAgentAdapter(); DocumentLoader documentLoader = new DocumentLoader( userAgentAdapter ); BridgeContext ctx = new BridgeContext( userAgentAdapter, documentLoader ); GVTBuilder builder = new GVTBuilder(); svgGraphicsNode = builder.build( ctx, svg.getDocument() ); svgGraphicsSize = ctx.getDocumentSize(); }
String fileName = file.toURI().toURL().toString(); System.out.println("Reading: " + fileName); Document svgDoc = loader.loadDocument(fileName); System.out.println("Building: " + fileName); gvtRoot = builder.build(ctx, svgDoc);
UserAgent userAgent = documentLoader.getUserAgent(); userAgent.checkLoadExternalResource(purl, pDocURL); Document doc = documentLoader.loadDocument(purlStr); if (frag != null) return doc.getElementById(frag);
Document doc = loader.checkCache(purl.toString()); if (doc != null) { imgDocument = (SVGDocument)doc; Document doc = loader.loadDocument(purl.toString(), reference); reference.release(); imgDocument = (SVGDocument)doc;
/** * Constructs a new <code>BridgeException</code> with the specified parameters. * * @param ctx the bridge context to use for determining the element's * source position * @param e the element on which the error occurred * @param message the error message */ public BridgeException(BridgeContext ctx, Element e, String message) { this.e = e; this.message = message; if (e != null && ctx != null) { this.line = ctx.getDocumentLoader().getLineNumber(e); } }
/** * Returns a document from the specified uri. * @param uri the uri of the document * @exception IOException if an I/O error occured while loading * the document */ public Document loadDocument(String uri) throws IOException { Document ret = checkCache(uri); if (ret != null) return ret; SVGDocument document = documentFactory.createSVGDocument(uri); DocumentDescriptor desc = documentFactory.getDocumentDescriptor(); DocumentState state = new DocumentState(uri, document, desc); synchronized (cacheMap) { cacheMap.put(uri, state); } return state.getDocument(); }