Package com.volantis.styling.properties

Examples of com.volantis.styling.properties.StyleProperty


                    .getStylePropertyDefinitions();

            boolean firstProperty = true;

            for (int index = 0; index < definitions.count(); index++) {
                StyleProperty property = definitions.getStyleProperty(index);

                String propertyName = property.getName();

                // Filter out all non-CSS standard properties.
                // At this moment the only solution I can see is to filter out
                // all properties starting with "mcs-".
                // TODO: Find better solution
                if (propertyName.startsWith("mcs-"))
                    continue;

                StyleValue value = values.getSpecifiedValue(property);

                if (value != null) {
                    // Render comma before all properties except the first one
                    if (firstProperty) {
                        firstProperty = false;
                    } else {
                        buffer.append(", ");
                    }

                    // Render property name and value
                    buffer.append("'");
                    buffer.append(property.getName());
                    buffer.append("': '");
                    buffer.append(value.getStandardCSS());
                    buffer.append("'");
                }
            }
View Full Code Here


     *
     * @throws Exception
     */
    public void testRender() throws Exception {
        PropertyRenderer renderer = new RuntimeWapInputFormatRenderer();
        StyleProperty property = StylePropertyDetails.MCS_INPUT_FORMAT;
        String expected = "-wap-input-format:\"N*\";";
        StyleValue value =
            StyleValueFactory.getDefaultInstance().getString(null, "N:N*");


 
View Full Code Here

     *
     * @throws Exception
     */
    public void testRenderNoneKeyword() throws Exception {
        PropertyRenderer renderer = new RuntimeWapInputFormatRenderer();
        StyleProperty property = StylePropertyDetails.MCS_INPUT_FORMAT;
        String expected = "";
        StyleValue value = MCSInputFormatKeywords.NONE;


        checkRender(context, renderer, property, value, expected);
View Full Code Here

        // =====================================================================
        //   Create Mocks
        // =====================================================================

        final StyleProperty normalProperty = StylePropertyDetails.COLOR;

        final StyleValue normalValue = StyleColorNames.RED;

        final StyleProperty importantProperty = StylePropertyDetails.BACKGROUND_IMAGE;

        final StyleValue importantValue =
            StyleValueFactory.getDefaultInstance().getLength(
                null, 10, LengthUnit.CM);
View Full Code Here

        values.setComputedAndSpecifiedValue(
                StylePropertyDetails.BACKGROUND_COLOR, StyleColorNames.WHITE);       
       
        Iterator i = Arrays.asList(StyleShorthands.MARGIN.getStandardProperties()).iterator();
        while (i.hasNext()) {
            StyleProperty property = (StyleProperty)i.next();
            values.setComputedAndSpecifiedValue(property, svf.getLength(null, 5, LengthUnit.PX));
        }
        i = Arrays.asList(StyleShorthands.PADDING.getStandardProperties()).iterator();
        while (i.hasNext()) {
            StyleProperty property = (StyleProperty)i.next();
            values.setComputedAndSpecifiedValue(property, svf.getLength(null, 0.5, LengthUnit.EM));
        }
        i = Arrays.asList(StyleShorthands.BORDER_WIDTH.getStandardProperties()).iterator();
        while (i.hasNext()) {
            StyleProperty property = (StyleProperty)i.next();
            values.setComputedAndSpecifiedValue(property, svf.getLength(null, 1, LengthUnit.PX));
        }
        i = Arrays.asList(StyleShorthands.BORDER_STYLE.getStandardProperties()).iterator();
        while (i.hasNext()) {
            StyleProperty property = (StyleProperty)i.next();
            values.setComputedAndSpecifiedValue(property, StyleKeywords.SOLID);
        }
        i = Arrays.asList(StyleShorthands.BORDER_COLOR.getStandardProperties()).iterator();
        while (i.hasNext()) {
            StyleProperty property = (StyleProperty)i.next();
            values.setComputedAndSpecifiedValue(property, StyleColorNames.BLACK);
        }
       
        return styles;
    }
View Full Code Here

            // Make sure that all the computed properties for pseudo classes
            // are set.
            // todo Optimise this when PropertyValues are made lazy.
            Iterator i = values.stylePropertyIterator();
            while (i.hasNext()) {
                StyleProperty property = (StyleProperty) i.next();
                StyleValue specified = values.getSpecifiedValue(property);
                if (specified != null) {
                    values.setComputedValue(property, specified);
                }
            }
View Full Code Here

        Styles styles = attributes.getStyles();
        MutablePropertyValues propertyValues = styles.getPropertyValues();

        for (int i = 0; i < styleProperties.length; i++) {
            StyleProperty prop = styleProperties[i];

            StyleValue styleValue = propertyValues.getComputedValue(prop);

            if (protocolConfiguration.isElementAttributeDefaultStyle(
                                                            elementType,
View Full Code Here

        Map nonNulls = new HashMap();

        for (Iterator iterator = styleProperties.stylePropertyIterator();
             iterator.hasNext(); ) {
            StyleProperty styleProperty = (StyleProperty) iterator.next();
            CapabilitySupportLevel supportType = getSupportType(styleProperty);

            if (supportType != null) {
                nonNulls.put(styleProperty, supportType);
            }
View Full Code Here

        this.significantUpdater = significantUpdater;
    }

    public boolean isSignificant(PropertyValues propertyValues) {
        for (int i = 0; i < properties.length; i++) {
            StyleProperty property = properties[i];
            StyleValue value = propertyValues.getComputedValue(property);
            if (valueHandler.isSignificant(value)) {
                return true;
            }
        }
View Full Code Here

    }

    public String getAsString(MutablePropertyValues propertyValues) {
        String string = null;
        for (int i = 0; i < properties.length; i++) {
            StyleProperty property = properties[i];
            StyleValue value = propertyValues.getComputedValue(property);
            string = valueHandler.getAsString(value);
            if (string != null) {
                break;
            }
        }

        // If the value is significant then update the property.
        if (string != null) {
            for (int i = 0; i < properties.length; i++) {
                StyleProperty property = properties[i];
                significantUpdater.update(property, propertyValues);
            }
        }
       
        return string;
View Full Code Here

TOP

Related Classes of com.volantis.styling.properties.StyleProperty

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.