Package org.apache.batik.css.engine

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


    protected static Color extractColor(Element paintElement,
                                        float opacity,
                                        BridgeContext ctx) {
        Map refs = new HashMap();
        CSSEngine eng = CSSUtilities.getCSSEngine(paintElement);
        int pidx = eng.getPropertyIndex(BATIK_EXT_SOLID_COLOR_PROPERTY);

        for (;;) {
            Value colorDef =
                CSSUtilities.getComputedStyle(paintElement, pidx);
       
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);
                    eng.setUserAgentStyleSheet
                        (eng.parseStyleSheet(url, "all"));
                } catch (MalformedURLException e) {
                    userAgent.displayError(e);
                }
            }
            eng.setAlternateStyleSheet(userAgent.getAlternateStyleSheet());
        }
    }
View Full Code Here

    public CSSStyleDeclaration getStyle() {
        CSSStyleDeclaration result =
            (CSSStyleDeclaration)getLiveAttributeValue(null,
                                                       SVG_STYLE_ATTRIBUTE);
        if (result == null) {
            CSSEngine eng = ((SVGOMDocument)getOwnerDocument()).getCSSEngine();
            result = new StyleDeclaration(eng);
        }
        return result;
    }
View Full Code Here

     * org.w3c.dom.svg.SVGStylable#getPresentationAttribute(String)}.
     */
    public CSSValue getPresentationAttribute(String name) {
        CSSValue result = (CSSValue)getLiveAttributeValue(null, name);
        if (result == null) {
            CSSEngine eng = ((SVGOMDocument)getOwnerDocument()).getCSSEngine();
            int idx = eng.getPropertyIndex(name);
            if (idx > SVGCSSEngine.WRITING_MODE_INDEX) {
                if (eng.getValueManagers()[idx] instanceof SVGColorManager) {
                    result = new PresentationAttributeColorValue(eng, name);
                }
                if (eng.getValueManagers()[idx] instanceof SVGPaintManager) {
                    result = new PresentationAttributePaintValue(eng, name);
                }
            } else {
                switch (idx) {
                case -1:
View Full Code Here


        focusManager = new FocusManager(document);

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

            evtTarget.removeEventListener("DOMCharacterDataModified",
                                          domCharacterDataModifiedListener,
                                          true);
           
            SVGOMDocument svgDocument = (SVGOMDocument)document;
            CSSEngine cssEngine = svgDocument.getCSSEngine();
            if (cssEngine != null) {
                cssEngine.removeCSSEngineListener
                    (cssPropertiesChangedListener);
                cssEngine.dispose();
                svgDocument.setCSSEngine(null);
            }
        }
        Iterator iter = interpreterMap.values().iterator();
        while (iter.hasNext()) {
View Full Code Here

    /**
     * Returns the computed style of the given property.
     */
    public static Value getComputedStyle(Element e, int property) {
        CSSEngine engine = getCSSEngine(e);
        if (engine == null) return null;
        return engine.getComputedStyle((CSSStylableElement)e,
                                       null, property);
    }
View Full Code Here

        if (uri.length() != 0)
            localRefElement.setAttributeNS(XML_NAMESPACE_URI,
                                           "base",
                                           uri);

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

            throw new DOMException(DOMException.INVALID_ACCESS_ERR,
                                   formatMessage("css.parser.access",
                                                 new Object[] { pn }));
        }
        ExtendedParser ep = ExtendedParserWrapper.wrap(p);
        CSSEngine result = new SVGCSSEngine(doc, doc.getURLObject(), ep, ctx);
        URL url = getClass().getResource("resources/UserAgentStyleSheet.css");
        if (url != null) {
            InputSource is = new InputSource(url.toString());
            result.setUserAgentStyleSheet(result.parseStyleSheet(is, url, "all"));
        }
        doc.setCSSEngine(result);
        return result;
    }
View Full Code Here

    public CSSStyleDeclaration getStyle() {
        CSSStyleDeclaration result =
            (CSSStyleDeclaration)getLiveAttributeValue(null,
                                                       SVG_STYLE_ATTRIBUTE);
        if (result == null) {
            CSSEngine eng = ((SVGOMDocument)getOwnerDocument()).getCSSEngine();
            result = new StyleDeclaration(eng);
        }
        return result;
    }
View Full Code Here

TOP

Related Classes of org.apache.batik.css.engine.CSSEngine

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.