Package org.apache.batik.dom.svg

Examples of org.apache.batik.dom.svg.SVGOMDocument


        Filter           img = reg.readURL(purl, extractColorSpace(e, ctx));
        Object           obj = img.getProperty
            (SVGBrokenLinkProvider.SVG_BROKEN_LINK_DOCUMENT_PROPERTY);
        if ((obj != null) && (obj instanceof SVGDocument)) {
            // Ok so we are dealing with a broken link.
            SVGOMDocument doc = (SVGOMDocument)obj;
            ctx.initializeDocument(doc);
            return createSVGImageNode(ctx, e, doc);
        }
        node.setImage(img);
        Rectangle2D imgBounds = img.getBounds2D();
View Full Code Here


        if (uri.length() == 0)
            throw new BridgeException(e, ERR_URI_MALFORMED,
                                      new Object[] {uri});
           
        Element refElement = ctx.getReferencedElement(e, uri);
        SVGOMDocument document
            = (SVGOMDocument)e.getOwnerDocument();
        SVGOMDocument refDocument
            = (SVGOMDocument)refElement.getOwnerDocument();
        boolean isLocal = (refDocument == document);
        // import or clone the referenced element in current document
        Element localRefElement = (isLocal)
            ? (Element)refElement.cloneNode(true)
View Full Code Here

            throw new TranscoderException(
                Messages.formatMessage("notsvg", null));
        }

        BridgeContext ctx = new BridgeContext(userAgent);
        SVGOMDocument svgDoc = (SVGOMDocument)document;
        SVGSVGElement root = svgDoc.getRootElement();

        // build the GVT tree
        GVTBuilder builder = new GVTBuilder();
        ImageRendererFactory rendFactory = new ConcreteImageRendererFactory();
        // flag that indicates if the document is dynamic
View Full Code Here

                    URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
                    URL newURI = null;
                    try {
      // if the anchor element is in an external resource
      if (elt.getOwnerDocument() != svgDocument) {
          SVGOMDocument doc =
        (SVGOMDocument)elt.getOwnerDocument();
          href = new URL(doc.getURLObject(), href).
                                toString();
      }
                        newURI = new URL(oldURI, href);
                    } catch (MalformedURLException e) {
                        userAgent.displayError(e);
                        return;
                    }

                    href = newURI.toString();
                    svgUserAgent.openLink(href, true);
                } else {
                    JSVGComponent.this.loadSVGDocument(href);
                }
                return;
            }

            // Avoid reloading if possible.
            if (svgDocument != null) {
                URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
                URL newURI = null;
                try {
        // if the anchor element is in an external resource
        if (elt.getOwnerDocument() != svgDocument) {
      SVGOMDocument doc =
          (SVGOMDocument)elt.getOwnerDocument();
      href = new URL(doc.getURLObject(), href).toString();
        }
                    newURI = new URL(oldURI, href);
                } catch (MalformedURLException e) {
                    displayError(e);
                    return;
View Full Code Here

                    }

                    if (st != null) {
                        if (svgDocument != null) {
                            try {
                                SVGOMDocument doc = (SVGOMDocument)svgDocument;
                                URL docURL = doc.getURLObject();
                                URL url = new URL(docURL, st);
                                String fi = svgCanvas.getFragmentIdentifier();
                                fi = (fi == null) ? "" : fi;
                                if (docURL.equals(url) && t.equals(fi)) {
                                    return;
View Full Code Here

     */
    public void linkActivated(LinkActivationEvent e) {
        String s = e.getReferencedURI();
        if (svgDocument != null) {
            try {
                SVGOMDocument doc = (SVGOMDocument)svgDocument;
                URL docURL = doc.getURLObject();
                URL url = new URL(docURL, s);
                if (!url.sameFile(docURL)) {
                    return;
                }
            } catch (MalformedURLException ex) {
View Full Code Here

            String uri = XLinkSupport.getXLinkHref(paintElement);
            if (uri.length() == 0) {
                return null; // no xlink:href found, exit
            }
            // check if there is circular dependencies
            SVGOMDocument doc = (SVGOMDocument)paintElement.getOwnerDocument();
            ParsedURL purl = new ParsedURL(doc.getURL(), uri);
            if (!purl.complete())
                throw new BridgeException(paintElement,
                                          ERR_URI_MALFORMED,
                                          new Object[] {uri});
View Full Code Here

                        }
                    }
                    if (s != null) {
                        if (svgDocument != null) {
                            try {
                                SVGOMDocument doc = (SVGOMDocument)svgDocument;
                                URL docURL = doc.getURLObject();
                                URL url = new URL(docURL, s);
                                String fi = svgCanvas.getFragmentIdentifier();
                                if (docURL.equals(url) && t.equals(fi)) {
                                    return;
                                }
View Full Code Here

    /**
     * Initializes the given document.
     */
    protected void initializeDocument(Document document) {
        SVGOMDocument doc = (SVGOMDocument)document;
        CSSEngine eng = doc.getCSSEngine();
        if (eng == null) {
            SVGDOMImplementation impl;
            impl = (SVGDOMImplementation)doc.getImplementation();
            eng = impl.createCSSEngine(doc, this);
            doc.setCSSEngine(eng);
            eng.setMedia(userAgent.getMedia());
            String uri = userAgent.getUserStyleSheetURI();
            if (uri != null) {
                try {
                    URL url = new URL(uri);
View Full Code Here

                                   domCharacterDataModifiedListener,
                                   true);

        focusManager = new FocusManager(document);

        SVGOMDocument svgDocument = (SVGOMDocument)document;
        CSSEngine cssEngine = svgDocument.getCSSEngine();
        cssPropertiesChangedListener = new CSSPropertiesChangedListener();
        cssEngine.addCSSEngineListener(cssPropertiesChangedListener);
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.dom.svg.SVGOMDocument

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.