Examples of SVGDocument


Examples of org.w3c.dom.svg.SVGDocument

        sw.flush();
        sw.close();

        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
        SVGDocument outDoc = null;

        try {
            outDoc = f.createSVGDocument
                (uri, new StringReader(sw.toString()));
        } catch (Exception e) {
            System.err.println("======================================");
            System.err.println(sw.toString());
            System.err.println("======================================");
           
            throw new IllegalArgumentException
                (Resources.getString(ERROR_RESULT_GENERATED_EXCEPTION));
        }

        // Patch the result tree to go under the root node
        // checkAndPatch(outDoc);
       
        svgViewerFrame.getJSVGCanvas().setSVGDocument((SVGDocument)outDoc);
        svgViewerFrame.setSVGDocument(outDoc,
                                      uri,
                                      outDoc.getTitle());
    }
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

            if (o != null)
                return (GraphicsNode)o;
        }
       
        try {
            SVGDocument svgDoc = (SVGDocument)loader.loadDocument
                (srcURLs[idx].toString());

            GraphicsNode gn;
            gn = createSVGImageNode(ctx, multiImgElem,
                                    bounds, svgDoc);
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

            }
            String uriStr = XLinkSupport.getXLinkHref(e);
            if (uriStr.length() == 0) { // exit if no more xlink:href
                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,
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

        }

        protected void update() {
            alternateStyleSheet = null;
            Iterator it = components.iterator();
            SVGDocument doc = svgCanvas.getSVGDocument();
            while (it.hasNext()) {
                JComponent stylesheetMenu = (JComponent)it.next();
                stylesheetMenu.removeAll();
                stylesheetMenu.setEnabled(false);

                ButtonGroup buttonGroup = new ButtonGroup();

                for (Node n = doc.getFirstChild();
                     n != null && n.getNodeType() != n.ELEMENT_NODE;
                     n = n.getNextSibling()) {
                    if (n instanceof StyleSheetProcessingInstruction) {
                        StyleSheetProcessingInstruction sspi;
                        sspi = (StyleSheetProcessingInstruction)n;
                        HashTable attrs = sspi.getPseudoAttributes();
                        final String title = (String)attrs.get("title");
                        String alt = (String)attrs.get("alternate");
                        if (title != null && "yes".equals(alt)) {
                            JRadioButtonMenuItem button;
                            button = new JRadioButtonMenuItem(title);

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

Examples of org.w3c.dom.svg.SVGDocument

     */
    public class PrintAction extends AbstractAction {
        public PrintAction() {}
        public void actionPerformed(ActionEvent e) {
            if (svgDocument != null) {
                final SVGDocument doc = svgDocument;
                new Thread() {
                    public void run(){
                        String uri = doc.getURL();
                        String fragment = svgCanvas.getFragmentIdentifier();
                        if (fragment != null) {
                            uri += "#"+fragment;
                        }

View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

                                      new Object[] {"xlink:href", uriStr});
        }

        GraphicsNode node = null;
        // try to load the image as an svg document
        SVGDocument svgDoc = (SVGDocument)e.getOwnerDocument();

        // try to load an SVG document
        DocumentLoader loader = ctx.getDocumentLoader();
        URIResolver resolver = new URIResolver(svgDoc, loader);
        try {
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

           
        } else if (( XLinkSupport.XLINK_NAMESPACE_URI.equals
                     (evtNode.getNamespaceURI()) )
                   && SVG_HREF_ATTRIBUTE.equals(evtNode.getLocalName()) ){
            //reference copy of the imgDocument
            SVGDocument oldSVGDoc = imgDocument;

            //update of the reference of the image.
            GraphicsNode inode = buildImageGraphicsNode(ctx,e);

            if (inode == null) {
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

        this.uri = newURI;
        if (uri != null) {
            loadSVGDocument(uri);
        } else {
            DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
            SVGDocument doc = (SVGDocument)impl.createDocument(SVGConstants.SVG_NAMESPACE_URI,
                                                               SVGConstants.SVG_SVG_TAG, null);
            setSVGDocument(doc);
        }

        pcs.firePropertyChange("URI", oldValue, uri);
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

     * @param e the element referencing
     * @param uri the uri of the referenced element
     */
    public Element getReferencedElement(Element e, String uri) {
        try {
            SVGDocument document = (SVGDocument)e.getOwnerDocument();
            URIResolver ur = new URIResolver(document, documentLoader);
            Element ref = ur.getElement(uri, e);
            if (ref == null) {
                throw new BridgeException(e, ERR_URI_BAD_TARGET,
                                          new Object[] {uri});
View Full Code Here

Examples of org.w3c.dom.svg.SVGDocument

                if (svgUserAgent != null) {
                    String oldURI = svgDocument.getURL();
                    ParsedURL newURI = null;
                    // if the anchor element is in an external resource
                    if (elt.getOwnerDocument() != svgDocument) {
                        SVGDocument doc = (SVGDocument)elt.getOwnerDocument();
                        href = new ParsedURL(doc.getURL(), href).toString();
                    }
                    newURI = new ParsedURL(oldURI, href);
                    href = newURI.toString();
                    svgUserAgent.openLink(href, true);
                } else {
                    JSVGComponent.this.loadSVGDocument(href);
                }
                return;
            }

            // Avoid reloading if possible.
            if (svgDocument != null) {

                // if the anchor element is in an external resource
                if (elt.getOwnerDocument() != svgDocument) {
                    SVGDocument doc = (SVGDocument)elt.getOwnerDocument();
                    href = new ParsedURL(doc.getURL(), href).toString();
                }
                ParsedURL oldURI = new ParsedURL(svgDocument.getURL());
                ParsedURL newURI = new ParsedURL(oldURI, href);

                String s = newURI.getRef();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.