Package com.volantis.mcs.themes

Examples of com.volantis.mcs.themes.Priority


                StyleValue newValue = newPropertyValue.getValue();
                if (newValue instanceof StylePair) {
                    StylePair pairValue = (StylePair) newValue;
                    updateEditorValue(first, pairValue.getFirst());
                    updateEditorValue(second, pairValue.getSecond());
                    Priority priority = newPropertyValue.getPriority();
                    boolean important = priority == Priority.IMPORTANT;
                    importantCheckbox.setSelection(important);
                    handled = true;
                } else if (newValue instanceof StyleFraction) {
                    StyleFraction fractionValue = (StyleFraction) newValue;
                    updateEditorValue(first, fractionValue.getNumerator());
                    updateEditorValue(second, fractionValue.getDenominator());
                    second.setEnabled(true);
                    Priority priority = newPropertyValue.getPriority();
                    boolean important = priority == Priority.IMPORTANT;
                    importantCheckbox.setSelection(important);
                    handled = true;
                } else if (newValue instanceof StyleKeyword ||
                        newValue instanceof StyleInherit) {
                    updateEditorValue(first, newValue);
                    // The second value should not be enabled in this case.
                    updateEditorValue(second, null);
                    second.setEnabled(false);
                    Priority priority = newPropertyValue.getPriority();
                    boolean important = priority == Priority.IMPORTANT;
                    importantCheckbox.setSelection(important);
                    handled = true;
                }
            }
View Full Code Here


    public int compare(Object o1, Object o2) {

        Styler styler1 = (Styler) o1;
        Styler styler2 = (Styler) o2;

        Priority priority1 = styler1.getPriority();
        Priority priority2 = styler2.getPriority();
        int result = priority1.compareTo(priority2);
        if (result != 0) {
            return result;
        }
View Full Code Here

            }

            for (int i = 0; i < prioritised.length; i++) {
                Prioritised p = prioritised[i];

                Priority priority = p.getPriority();
                PropertyValue[] values = p.getValues();

                if (values != null && values.length > 0) {
                    StylesDelta delta = createStylesDelta(entities, values);
                    if (matcher instanceof CompositeMatcher) {
View Full Code Here

            // Compile the value.
            StyleValue compiledValue = compiler.compile(value);

            // If compiling changed the value then create a new property value.
            Priority priority = propertyValue.getPriority();
            if (compiledValue != value) {
                propertyValue = ThemeFactory.getDefaultInstance().
                    createPropertyValue(propertyValue.getProperty(),
                        compiledValue, priority);
            }

            PropertyValueArray array = (PropertyValueArray)
                    priority2Values.get(priority);
            if (array == null) {
                array = new SparsePropertyValueArray();
                priority2Values.put(priority, array);
            }

            array.setPropertyValue(propertyValue);
        }

        Prioritised[] prioritised = new Prioritised[priority2Values.size()];
        int p = 0;
        for (Iterator i = priority2Values.entrySet().iterator(); i.hasNext();
             p += 1) {

            Map.Entry entry = (Map.Entry) i.next();
            Priority priority = (Priority) entry.getKey();
            PropertyValueArray array = (PropertyValueArray) entry.getValue();
            prioritised[p] = new Prioritised(priority,
                    array.toPropertyValueArray());
        }
        return prioritised;
View Full Code Here

    private StyleProperties addSystemFont(StyleProperties properties) {
        // The mcs-system-font property is equivalent to setting all properties
        // set by the font shorthand to unknown user agent specific values.
        PropertyValue systemFont = properties.getPropertyValue(MCS_SYSTEM_FONT);
        if (systemFont != null) {
            Priority systemFontPriority = systemFont.getPriority();
            MutableStyleProperties copy =
                ThemeFactory.getDefaultInstance().createMutableStyleProperties(
                    properties);

            // The system font is set so make sure that all the other font
            // properties are set with equal or greater priority.
            for (int i = 0; i < UNKNOWN_FONT_PROPERTIES.length; i++) {
                PropertyValue value = UNKNOWN_FONT_PROPERTIES[i];
                StyleProperty property = value.getProperty();

                PropertyValue propertyValue = properties.getPropertyValue(
                        property);
                if (propertyValue == null ||
                        systemFontPriority.isGreaterThan(
                                propertyValue.getPriority())) {

                    propertyValue =
                        ThemeFactory.getDefaultInstance().createPropertyValue(
                            property, UnknownFontValue.INSTANCE,
View Full Code Here

                if (status.isRequiredForIndividual()) {
                    // The property is required for individual properties.
                    requiredForIndividual |= bit;
                }

                Priority devicePriority = deviceValues.getPriority(property);
                if (devicePriority.isGreaterThan(Priority.NORMAL)) {
                    important |= bit;
                }
            }
        }
View Full Code Here

            MutableStylePropertySet requiredForIndividual,
            MutableStylePropertySet requiredForShorthand) {

        StyleValue[] values = getShorthandValues(requiredForIndividual,
                requiredForShorthand);
        Priority priority = getShorthandPriority();
        ShorthandValue shorthandValue = createShorthandValue(values, priority);

        outputValues.setShorthandValue(shorthandValue);
    }
View Full Code Here

        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

        ShorthandValue shorthandValue =
                outputValues.getShorthandValue(StyleShorthands.MARGIN);

        assertNotNull("Shorthand value should be set", shorthandValue);

        Priority priority = shorthandValue.getPriority();
        assertEquals("Priority mismatch", expectedPriority, priority);

        assertEquals("Count mismatch", expectedValues.length,
                shorthandValue.getCount());
View Full Code Here

                StatusUsage.INDIVIDUAL, inputValues, deviceValue);
        if (status.isRequiredForIndividual()) {
            // If the priority that would be used by the device is greater than
            // normal then make this property important to ensure that it has
            // the desired effect.
            Priority devicePriority = deviceValues.getPriority(property);
            if (devicePriority.isGreaterThan(Priority.NORMAL)) {
                return ThemeFactory.getDefaultInstance().createPropertyValue(
                    property, inputValue, Priority.IMPORTANT);
            } else {
                return ThemeFactory.getDefaultInstance().createPropertyValue(
                    property, inputValue);
View Full Code Here

TOP

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

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.