Package com.volantis.mcs.css.parser

Examples of com.volantis.mcs.css.parser.CSSParser


            return null;
        }

        StyleValue value;
        try {
            CSSParser parser =
                    CSSParserFactory.getDefaultInstance().createStrictParser();
            value = parser.parseStyleValue(styleProperty, textValue);
        } catch (IllegalStateException ise) {
            value = STYLE_VALUE_FACTORY.getInvalid(textValue);
        }

        return value;
View Full Code Here


            return null;
        }

        StyleValue value;
        try {
            CSSParser parser = CSSParserFactory.getDefaultInstance().
                    createStrictParser();
            value = parser.parseStyleValue(styleProperty, textValue);
        } catch (IllegalStateException ise) {
            value = STYLE_VALUE_FACTORY.getInvalid(textValue);
        }

        if (value != null) {
View Full Code Here

        };
        return attributes;
    }

    private StylingEngine createStylingEngine(String css) {
        CSSParser parser =
                CSSParserFactory.getDefaultInstance().createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(new StringReader(css),
                null);

        StylingFactory factory = StylingFactory.getDefaultInstance();

        CompilerConfiguration configuration = factory.createCompilerConfiguration();
View Full Code Here

    private StylingEngine createStylingEngine(
            Reader reader,
            final FunctionResolver functionResolverMock) {

        CSSParserFactory factory = CSSParserFactory.getDefaultInstance();
        CSSParser parser = factory.createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(reader, null);

        StylingFactory stylingFactory = StylingFactory.getDefaultInstance();
        CompilerConfiguration configuration =
                stylingFactory.createCompilerConfiguration();
        configuration.setSource(StyleSheetSource.THEME);
View Full Code Here

     * @param property The property whose value is required.
     * @param css The css representation of the value.
     * @return The style value.
     */
    public static StyleValue getStyleValue(StyleProperty property, String css) {
        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        return parser.parseStyleValue(property, css);
    }
View Full Code Here

     * @param property The property whose value is required.
     * @param css The css representation of the value.
     * @return The style value.
     */
    public static PropertyValue getPropertyValue(StyleProperty property, String css) {
        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        return parser.parsePropertyValue(property, css);
    }
View Full Code Here

     *
     * @deprecated Use {@link #getCompleteStyles(String)}
     */
    public static Styles getStyles(String cssValues, boolean specified) {

        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();

        // Create a new styled element.
        Styles styles = new StylesImpl();
        if (cssValues != null) {

            String selectorBlock = null;
            String pseudoSelectorBlock = null;
            // Determine if there are multiple selector rules to be
            // parsed and what type they are (i.e. pseudo or standard)
            if (cssValues.indexOf('{') == -1) {
                // No pseudoselector rules were specified
                selectorBlock = cssValues;
            } else if ('{' == cssValues.charAt(0)) {
                // Both standard and pseudoselector rules were specified
                int index = cssValues.indexOf("}");
                selectorBlock = cssValues.substring(1, index);
                pseudoSelectorBlock = cssValues.substring(index + 1);
            } else {
                // No standard selector rules were specified
                pseudoSelectorBlock = cssValues;
            }

            // Put the standard selector rules onto the styled element
            if (selectorBlock != null) {
                // Parse the values into a properties object.
                StyleProperties properties = parser.parseDeclarations(
                        selectorBlock);

                // Translate that to a property values object.
                setComputedValuesFromProperties(styles, properties, specified);
            }
View Full Code Here


        // Parse the expected selectors (to canonicalise them).
        List expectedSelectorList = null;
        try {
            CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
            expectedSelectorList = parser.parseSelectorGroup(
                            expectedSelectors);
        } catch (IllegalArgumentException e) {
            Assert.fail("Error occurred during parsing: " + expectedSelectors);
        }
View Full Code Here

     */
    protected RuntimeDeviceTheme createRuntimeDeviceTheme() {

        String css = getCSS();

        CSSParser parser = CSS_PARSER_FACTORY.createStrictParser();
        StyleSheet styleSheet = parser.parseStyleSheet(new StringReader(css), null);

        return RuntimeDeviceLayoutTestHelper.activate(styleSheet);

    }
View Full Code Here

        // Paul said it's not much good in the other modes - no error recovery.
        // Each CSS compiler needs it's own CSS parser as the CSS parser is
        // not thread safe.
        CSSParserFactory parserFactory = CSSParserFactory.getDefaultInstance();

        CSSParser cssParser = parserFactory.createParser(parserMode);           

        // Create a style sheet compiler to compile style sheets into compiled
        // style sheets.
        // Each CSS compiler needs it's own style sheet compiler since the
        // style sheet compiler is not thread safe.
View Full Code Here

TOP

Related Classes of com.volantis.mcs.css.parser.CSSParser

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.