Package com.volantis.mcs.themes

Examples of com.volantis.mcs.themes.Rule


        // ==================================================================

        RuleBuilder ruleBuilder = new RuleBuilder();
        ruleBuilder.addSequence(sequenceBuilderMock);
        ruleBuilder.setProperties(stylePropertiesMock);
        Rule rule = ruleBuilder.getRule();

        assertEquals("", rule.getSelectors().size(), 1);

        assertEquals("", rule.getSelectors().get(0), sequenceMock);

        assertEquals("", rule.getProperties(), stylePropertiesMock);

    }
View Full Code Here


        // Iterate over the rules.
        List rules = styleSheet.getRules();
        for (int i=0; i< rules.size(); i++) {
            // Extract each rule.
            Rule rule = (Rule) rules.get(i);

            Selector selector = (Selector) rule.getSelectors().get(0);
            visitor.addStyles(styles, selector, rule.getProperties());
        }
    }
View Full Code Here

        }

        List stylers = new ArrayList();
        List rules = styleSheet.getRules();
        for (Iterator i = rules.iterator(); i.hasNext();) {
            Rule rule = (Rule) i.next();
            List selectors = rule.getSelectors();
            StyleProperties properties = rule.getProperties();

            if (properties != null) {
                addStylers(properties, selectors, source, stylers);
            }
        }
View Full Code Here

        // ==================================================================

        Map propertiesToRule = new HashMap();
        Iterator rules = styleSheet.getRules().iterator();
        while (rules.hasNext()) {
            Rule rule = (Rule) rules.next();
            StyleProperties properties = rule.getProperties();
            // If the theme already has a rule with this properties ...
            Rule existingRule = (Rule) propertiesToRule.get(properties);
            if (existingRule != null) {
                // ... then we should add this rule's selectors to the existing
                // rule with those properties and throw this rule away.
                existingRule.getSelectors().addAll(rule.getSelectors());
                rules.remove();
            } else {
                // ,,, else we leave this rule alone, and add it into the
                // mapping we use to check for existance.
                propertiesToRule.put(properties, rule);
View Full Code Here

                    }
                    sequenceBuilder.addPseudoSelectors(
                            selectorSequence.getPath());
                    ruleBuilder.addSequence(sequenceBuilder);
                    ruleBuilder.setProperties(commonProperties);
                    Rule rule = ruleBuilder.getRule();

                    // Add the created rule to the rule set.
                    styleSheet.addRule(rule);

                    // Remove the common properties we have created a rule for
View Full Code Here

                ruleBuilderFactory.createSequenceBuilder();
        sequenceBuilder.addClassSelector(className);
        sequenceBuilder.addPseudoSelectors(pseudoPath);
        ruleBuilder.addSequence(sequenceBuilder);
        ruleBuilder.setProperties(styles.getPathProperties(pseudoPath));
        Rule rule = ruleBuilder.getRule();
        styleSheet.addRule(rule);
    }
View Full Code Here

    }

    public void activate(StyleSheet styleSheet) {
        List rules = styleSheet.getRules();
        for (Iterator i = rules.iterator(); i.hasNext();) {
            Rule rule = (Rule) i.next();
            MutableStyleProperties properties = (MutableStyleProperties)
                    rule.getProperties();

            // Although it is a little stupid it is allowed, at least for now
            // to have no properties for a selector.
            if (properties != null) {
                Iterator p = properties.propertyValueIterator();
View Full Code Here

        super(converter, factory);
    }

    // Javadoc inherited.
    public void addRules(StyleSheet styleSheet, Format format) {
        Rule rule = createRuleWithoutProperties(format);

        StyleProperties styleProperties = createStyleProperties(format);
        rule.setProperties(styleProperties);

        styleSheet.addRule(rule);
    }
View Full Code Here

     * @param format
     * @return
     */
    protected Rule createRuleWithoutProperties(StyleableFormat format) {

        Rule rule = ThemeFactory.getDefaultInstance().createRule();

        SelectorSequence sequence = createSelectorSequence(format);
        List selectors = new ArrayList();
        selectors.add(sequence);

        rule.setSelectors(selectors);

        return rule;
    }
View Full Code Here

        super(converter, factory);
    }

    public void addRules(StyleSheet styleSheet, Format format) {

        Rule rule = createRuleWithoutProperties(format);

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

        // At the moment a spatial is equivalent to a CSS table but there is
        // really no reason why it could not also be a block.
        initialiseCommonProperties(styleProperties, format,
                DisplayKeywords.TABLE);

        rule.setProperties(styleProperties);
        styleSheet.addRule(rule);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.themes.Rule

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.