Package org.apache.batik.dom.svg

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


                            button = new JRadioButtonMenuItem(title);

                            button.addActionListener
                                (new java.awt.event.ActionListener() {
                                    public void actionPerformed(ActionEvent e) {
                                        SVGOMDocument doc;
                                        doc = (SVGOMDocument)svgCanvas.getSVGDocument();
                                        doc.enableAlternateStyleSheet(title);
                                        doc.clearViewCSS();
                                        svgCanvas.setSVGDocument(doc);
                                    }
                                });

                            buttonGroup.add(button);
View Full Code Here


                            // get the referenced element
                            String uri = XLinkSupport.getXLinkHref(fontFaceUriElement);
                            Element refElement = ctx.getReferencedElement(fontFaceUriElement, uri);
                            // make sure its a font element
                            if (refElement.getTagName().equals(SVG_FONT_TAG)) {
                                SVGOMDocument document
                                    = (SVGOMDocument)fontFaceUriElement.getOwnerDocument();
                                SVGOMDocument refDocument
                                    = (SVGOMDocument)refElement.getOwnerDocument();
                                boolean isLocal = (refDocument == document);
                                // import or clone the referenced element in current document
                                fontElement = (isLocal) ? refElement
                                    : (Element)document.importNode(refElement, true);
View Full Code Here

            uri = uri.substring(0, n);
        }
        DocumentState state = (DocumentState)cacheMap.get(uri);
        if (state == null) {
            Document document = documentFactory.createDocument(uri);
            SVGOMDocument svgDoc = (SVGOMDocument)document;
            DefaultSVGContext ctx = (DefaultSVGContext)svgDoc.getSVGContext();
            ctx.setUserStyleSheetURI(userAgent.getUserStyleSheetURI());
            DocumentDescriptor desc = documentFactory.getDocumentDescriptor();
            state = new DocumentState(uri, document, desc);
            cacheMap.put(uri, state);
        }
View Full Code Here

            String uri = XLinkSupport.getXLinkHref(patternElement);
            if (uri.length() == 0) {
                return null; // no xlink:href found, exit
            }
            // check if there is circular dependencies
            SVGOMDocument doc =
                (SVGOMDocument)patternElement.getOwnerDocument();
            URL url;
            try {
                url = new URL(doc.getURLObject(), uri);
            } catch (MalformedURLException ex) {
                throw new BridgeException(patternElement,
                                          ERR_URI_MALFORMED,
                                          new Object[] {uri});
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

                    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

            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();
            URL url;
            try {
                url = new URL(doc.getURLObject(), uri);
            } catch (MalformedURLException ex) {
                throw new BridgeException(paintElement,
                                          ERR_URI_MALFORMED,
                                          new Object[] {uri});
View Full Code Here

        }
        localRefElement.setAttributeNS(XML_NAMESPACE_URI,
                                       "xml:base",
                                       uri);

        SVGOMDocument document
            = (SVGOMDocument)localRefElement.getOwnerDocument();
        AbstractViewCSS view = (AbstractViewCSS)document.getDefaultView();


        SVGOMDocument refDocument
            = (SVGOMDocument)refElement.getOwnerDocument();
        AbstractViewCSS refView = (AbstractViewCSS)refDocument.getDefaultView();

        HiddenChildElementSupport.setStyle(localRefElement,
                                           view,
                                           refElement,
                                           refView);
View Full Code Here

        // else should be an altGlyphDef element
        if (refElement.getTagName().equals(SVG_ALT_GLYPH_DEF_TAG)) {

            // if not local import the referenced altGlyphDef
            // into the current document
            SVGOMDocument document
                = (SVGOMDocument)altGlyphElement.getOwnerDocument();
            SVGOMDocument refDocument
                = (SVGOMDocument)refElement.getOwnerDocument();
            boolean isLocal = (refDocument == document);

            Element localRefElement = (isLocal) ? refElement
                                 : (Element)document.importNode(refElement, true);
View Full Code Here

            // or referenced element not a glyph
            return null;
        }

        // see if the referenced glyph element is local
        SVGOMDocument document
            = (SVGOMDocument)altGlyphElement.getOwnerDocument();
        SVGOMDocument refDocument
            = (SVGOMDocument)refGlyphElement.getOwnerDocument();
        boolean isLocal = (refDocument == document);

        // if not local, import both the glyph and its font-face element
        Element localGlyphElement = null;
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.