Examples of CSSEngine


Examples of org.apache.batik.css.engine.CSSEngine

    builder = new GVTBuilder();

    builder.build(ctx, doc);

    StyleSheet ss = null;
    CSSEngine engine = ((SVGOMDocument) doc).getCSSEngine();
    try {
      if (inlineCss != null) {
        InputSource source = new InputSource(new StringReader(inlineCss));
        ss = engine.parseStyleSheet(source, new URL("http://www.timepedia.org"),
            "screen");
        engine.setUserAgentStyleSheet(ss);
      } else if (altCss != null) {
        ss = engine.parseStyleSheet(new InputSource(altCss),
            new URL("http://www.timepedia.org"), "screen");
        engine.setUserAgentStyleSheet(ss);
      } else {
        InputStream asStream = getClass().getClassLoader().getResourceAsStream(
            "org/timepedia/chronoscope/public/Chronoscope.css");
        InputSource source = new InputSource(new InputStreamReader(asStream));
        ss = engine.parseStyleSheet(source, new URL("http://www.timepedia.org"),
            "screen");
        engine.setUserAgentStyleSheet(ss);
      }
    } catch (MalformedURLException e) {
      e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
    }
  }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

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

        CSSEngine engine = CSSUtilities.getCSSEngine(localRefElement);
        CSSEngine refEngine = CSSUtilities.getCSSEngine(refElement);
       
        engine.importCascadedStyleMaps(refElement, refEngine, localRefElement);
    }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

     */
    public StyleSheet getCSSStyleSheet() {
        if (styleSheet == null) {
            if (getType().equals("text/css")) {
                SVGOMDocument doc = (SVGOMDocument)getOwnerDocument();
                CSSEngine e = doc.getCSSEngine();
                String text = "";
                Node n = getFirstChild();
                if (n != null) {
                    StringBuffer sb = new StringBuffer();
                    while (n != null) {
                        sb.append(n.getNodeValue());
                        n = n.getNextSibling();
                    }
                    text = sb.toString();
                }
                URL burl = null;
                try {
                    String bu = XMLBaseSupport.getCascadedXMLBase(this);
                    if (bu != null) {
                        burl = new URL(bu);
                    }
                } catch (MalformedURLException ex) {
                    // !!! TODO
                    ex.printStackTrace();
                    throw new InternalError();
                }
                String  media = getAttributeNS(null, SVG_MEDIA_ATTRIBUTE);
                styleSheet = e.parseStyleSheet(text, burl, media);
                addEventListener("DOMCharacterDataModified",
                                 domCharacterDataModifiedListener,
                                 false);
            }
        }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

    /**
     * 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);
                    eng.setUserAgentStyleSheet
                        (eng.parseStyleSheet(url, "all"));
                } catch (MalformedURLException e) {
                    userAgent.displayError(e);
                }
            }
            eng.setAlternateStyleSheet(userAgent.getAlternateStyleSheet());
        }
    }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine


        focusManager = new FocusManager(document);

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

Examples of org.apache.batik.css.engine.CSSEngine

        evtTarget.removeEventListener("DOMCharacterDataModified",
                                      domCharacterDataModifiedListener,
                                      true);

        SVGOMDocument svgDocument = (SVGOMDocument)document;
        CSSEngine cssEngine = svgDocument.getCSSEngine();
        if (cssEngine != null) {
            cssEngine.removeCSSEngineListener(cssPropertiesChangedListener);
            cssEngine.dispose();
        }
        if (focusManager != null) {
            focusManager.dispose();
        }
    }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

    /**
     * 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);
                    eng.setUserAgentStyleSheet
                        (eng.parseStyleSheet(url, "all"));
                } catch (MalformedURLException e) {
                    userAgent.displayError(e);
                }
            }
            eng.setAlternateStyleSheet(userAgent.getAlternateStyleSheet());
        }
    }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

                                   true);

        focusManager = new FocusManager(document);

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

Examples of org.apache.batik.css.engine.CSSEngine

        evtTarget.removeEventListener("DOMCharacterDataModified",
                                      domCharacterDataModifiedListener,
                                      true);

        SVGOMDocument svgDocument = (SVGOMDocument)document;
        CSSEngine cssEngine = svgDocument.getCSSEngine();
        if (cssEngine != null) {
            cssEngine.removeCSSEngineListener(cssPropertiesChangedListener);
            cssEngine.dispose();
        }
        if (focusManager != null) {
            focusManager.dispose();
        }
    }
View Full Code Here

Examples of org.apache.batik.css.engine.CSSEngine

                URL burl = durl;
                try {
                    burl = new URL(durl, href);
                } catch (Exception ex) {
                }
                CSSEngine e = doc.getCSSEngine();
                styleSheet = e.parseStyleSheet
                    (new InputSource(new ParsedURL(durl, href).toString()),
                     burl,
                     media);
                styleSheet.setAlternate("yes".equals(alternate));
                styleSheet.setTitle(title);
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.