Package com.volantis.mcs.dom2theme.impl.optimizer

Examples of com.volantis.mcs.dom2theme.impl.optimizer.ShorthandAnalyzer


        BorderAnalyzer analyzer = (BorderAnalyzer) shorthandAnalyzer;

        int cost = 0;

        for (int i = 0; i < PropertyGroups.EDGE_COUNT; i += 1) {
            ShorthandAnalyzer edgeAnalyzer = analyzer.getEdgeAnalyzer(i);

            if (edgeAnalyzer.canUseShorthand()) {
                cost += edgeAnalyzer.getShorthandCost(requiredForIndividual, requiredForShorthand);
            }
        }

        cost += individualStrategy.cost(analyzer, inputValues, requiredForIndividual, requiredForShorthand);
View Full Code Here


            MutableStylePropertySet requiredForShorthand) {

        BorderAnalyzer analyzer = (BorderAnalyzer) shorthandAnalyzer;

        for (int i = 0; i < PropertyGroups.EDGE_COUNT; i += 1) {
            ShorthandAnalyzer edgeAnalyzer = analyzer.getEdgeAnalyzer(i);

            if (edgeAnalyzer.canUseShorthand()) {
                edgeAnalyzer.updateShorthand(outputValues, requiredForIndividual, requiredForShorthand);
            }
        }

        individualStrategy.update(shorthandAnalyzer, outputValues, requiredForIndividual, requiredForShorthand);
    }
View Full Code Here

     * @param analyzers The analyzers to invoke.
     */
    protected void analyze(ShorthandAnalyzer[] analyzers) {

        for (int i = 0; i < analyzers.length; i++) {
            ShorthandAnalyzer analyzer = analyzers[i];
            analyzer.analyze(target, inputValues, deviceValues);

            Priority priority = analyzer.getShorthandPriority();
            if (priority.isGreaterThan(shorthandPriority)) {
                shorthandPriority = priority;
            }
        }
    }
View Full Code Here

     */
    protected void updateRequiredSets(ShorthandAnalyzer[] analyzers) {
        requiredForShorthand.clear();
        requiredForIndividual.clear();
        for (int i = 0; i < analyzers.length; i++) {
            ShorthandAnalyzer analyzer = analyzers[i];
            analyzer.addRequired(requiredForIndividual, requiredForShorthand);
        }
    }
View Full Code Here

    // Javadoc inherited.
    public int getIndividualCost(MutableStylePropertySet required) {
       
        int cost = 0;
        for (int c = 0; c < CHARACTERISTIC_COUNT; c += 1) {
            ShorthandAnalyzer analyzer = characteristicAnalyzers[c];
            cost += analyzer.getIndividualCost(required);
        }
        return cost;
    }
View Full Code Here

    public void copyIndividualValues(
            MutableStyleProperties properties,
            MutableStylePropertySet required) {

        for (int c = 0; c < CHARACTERISTIC_COUNT; c += 1) {
            ShorthandAnalyzer analyzer = characteristicAnalyzers[c];
            analyzer.copyIndividualValues(properties, required);
        }
    }
View Full Code Here

        BorderAnalyzer analyzer = (BorderAnalyzer) shorthandAnalyzer;

        int cost = 0;

        for (int c = 0; c < BorderAnalyzer.CHARACTERISTIC_COUNT; c += 1) {
            ShorthandAnalyzer characteristicAnalyzer =
                    analyzer.getCharacteristicAnalyzer(c);

            if (characteristicAnalyzer.canUseShorthand()) {
                cost += characteristicAnalyzer.getShorthandCost(
                        requiredForIndividual, requiredForShorthand);
            }
        }

        cost += individualStrategy.cost(analyzer, inputValues,
View Full Code Here

            MutableStylePropertySet requiredForShorthand) {

        BorderAnalyzer analyzer = (BorderAnalyzer) shorthandAnalyzer;

        for (int c = 0; c < BorderAnalyzer.CHARACTERISTIC_COUNT; c += 1) {
            ShorthandAnalyzer characteristicAnalyzer =
                    analyzer.getCharacteristicAnalyzer(c);

            if (characteristicAnalyzer.canUseShorthand()) {
                characteristicAnalyzer.updateShorthand(outputValues,
                        requiredForIndividual, requiredForShorthand);
            }
        }

        individualStrategy.update(shorthandAnalyzer, outputValues,
View Full Code Here

                PropertyStatus.REQUIRED);

        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandAnalyzer analyzer = new BasicShorthandAnalyzer(
                StyleShorthands.BORDER_LEFT, checkerMock, shorthandSetMock);
        analyzer.analyze(TargetEntity.ELEMENT, inputValues, deviceValuesMock);
        analyzer.updateShorthand(outputValues);

        assertTrue("Should be able to use shorthand",
                analyzer.canUseShorthand());

        // red should be the color overide
        // none was specified
        // initial value was got for width as style is none
        assertEquals("Shorthand should match:",
View Full Code Here

                PropertyStatus.REQUIRED);

        MutableStyleProperties outputValues =
            ThemeFactory.getDefaultInstance().createMutableStyleProperties();

        ShorthandAnalyzer analyzer = new BasicShorthandAnalyzer(
                StyleShorthands.BORDER_LEFT, checkerMock, shorthandSetMock);
        analyzer.analyze(TargetEntity.ELEMENT, inputValues, deviceValuesMock);

        assertTrue("Should be able to use shorthand",
                analyzer.canUseShorthand());

        analyzer.updateShorthand(outputValues);

        assertEquals("Shorthand should match:",
                "border-left:red dashed thick !important",
                outputValues.getShorthandValue(
                StyleShorthands.BORDER_LEFT).getStandardCSS());
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom2theme.impl.optimizer.ShorthandAnalyzer

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.