Package org.apache.batik.util

Examples of org.apache.batik.util.ParsedURL


        setImageSize(docWidth, docHeight);

        // compute the preserveAspectRatio matrix
        AffineTransform Px;
        String ref = new ParsedURL(uri).getRef();

        try {
            Px = ViewBox.getViewTransform(ref, root, width, height);
           
        } catch (BridgeException ex) {
View Full Code Here


            throw new BridgeException(e, ERR_ATTRIBUTE_MISSING,
                                      new Object[] {"xlink:href"});
        }

        String baseURI = XMLBaseSupport.getCascadedXMLBase(e);
        ParsedURL purl;
        if (baseURI == null) purl = new ParsedURL(uriStr);
        else                 purl = new ParsedURL(baseURI, uriStr);

        dims.add(d);
        uris.add(purl);
    }
View Full Code Here

        if (uri == null) {
            throw new CSSException(formatMessage("empty.source", null));
        }

        try {
            ParsedURL purl = new ParsedURL(uri);
            is = purl.openStreamRaw(CSSConstants.CSS_MIME_TYPE);
            return new Scanner(is, source.getEncoding());
        } catch (IOException e) {
            throw new CSSException(e);
        }
    }
View Full Code Here

        if (xslStyleSheetURI == null) {
            // Assume that the input file is a literal result template
            xslStyleSheetURI = uri;
        }

        ParsedURL parsedXSLStyleSheetURI
            = new ParsedURL(uri, xslStyleSheetURI);

        Transformer transformer
            = tFactory.newTransformer
            (new StreamSource(parsedXSLStyleSheetURI.toString()));

        // Set the URIResolver to properly handle document() and xsl:include
        transformer.setURIResolver
            (new DocumentURIResolver(parsedXSLStyleSheetURI.toString()));

        // Now, apply the transformation to the input document.
        DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
        String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
View Full Code Here

        public Source resolve(String href, String base) {
            if (base == null || "".equals(base)) {
                base = documentURI;
            }

            ParsedURL purl = new ParsedURL(base, href);

            return new StreamSource(purl.toString());
        }
View Full Code Here

    ParsedURL purl;
    String name;

    public SVGConverterURLSource(String url) throws SVGConverterException{
        this.purl = new ParsedURL(url);

        // Get the path portion
        String path = this.purl.getPath();
        if (path == null ||
            !(path.toLowerCase().endsWith(SVG_EXTENSION) ||
View Full Code Here

        public void actionPerformed(ActionEvent e) {
            if (svgDocument == null) {
                return;
            }

            final ParsedURL u = new ParsedURL(svgDocument.getURL());
           
            final JFrame fr = new JFrame(u.toString());
            fr.setSize(resources.getInteger("ViewSource.width"),
                       resources.getInteger("ViewSource.height"));
            final JTextArea ta  = new JTextArea();
            ta.setLineWrap(true);
            ta.setFont(new Font("monospaced", Font.PLAIN, 12));

            JScrollPane scroll = new JScrollPane();
            scroll.getViewport().add(ta);
            scroll.setVerticalScrollBarPolicy
                (JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            fr.getContentPane().add(scroll, BorderLayout.CENTER);

            new Thread() {
                public void run() {
                    char [] buffer = new char[4096];

                    try {
                        Document  doc = new PlainDocument();

                        ParsedURL purl = new ParsedURL(svgDocument.getURL());
                        InputStream is
                            = u.openStream(getInputHandler(purl).
                                           getHandledMimeTypes());
                        // u.openStream(MimeTypeConstants.MIME_TYPES_SVG);
View Full Code Here

                return "";
            }
            SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument();
            String baseURI = ((SVGOMDocument)svgDoc).getURL();

            ParsedURL purl = new ParsedURL(baseURI, uriStr);
            if (!purl.complete())
                throw new BridgeException(e, ERR_URI_MALFORMED,
                                          new Object[] {uriStr});

            Iterator iter = refs.iterator();
            while (iter.hasNext()) {
                if (purl.equals(iter.next()))
                    throw new BridgeException
                        (e, ERR_XLINK_HREF_CIRCULAR_DEPENDENCIES,
                         new Object[] {uriStr});
            }

            try {
                URIResolver resolver = new URIResolver(svgDoc, loader);
                e = resolver.getElement(purl.toString(), e);
                refs.add(purl);
            } catch(IOException ex) {
                throw new BridgeException(e, ERR_URI_IO,
                                          new Object[] {uriStr});
            } catch(SecurityException ex) {
View Full Code Here

   
    /**
     * Resolves an URI.
     */
    protected static String resolveURI(URL base, String value) {
        return new ParsedURL(base, value).toString();
    }
View Full Code Here

            throw new DOMException(DOMException.SYNTAX_ERR, s);
        }

  try {
            // Check that access to the uri is allowed
             ParsedURL pDocURL = null;
             if (documentURI != null) {
                 pDocURL = new ParsedURL(documentURI);
             }
             ParsedURL pURL = null;
                 pURL = new ParsedURL(uri);
             cssContext.checkLoadExternalResource(pURL, pDocURL);
            
             parseStyleSheet(ss, new InputSource(uri.toString()), uri);
  } catch (SecurityException e) {
            throw e;
View Full Code Here

TOP

Related Classes of org.apache.batik.util.ParsedURL

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.