Package com.volantis.styling.values

Examples of com.volantis.styling.values.MutablePropertyValues


            .createInheritedStyles(
                    protocol.getMarinerPageContext()
                            .getStylingEngine().getStyles(),
                    DisplayKeywords.NONE);

        MutablePropertyValues values = styles.getPropertyValues();
        StyleValueFactory svf = StyleValueFactory.getDefaultInstance();
       
        values.setComputedAndSpecifiedValue(
                StylePropertyDetails.POSITION, StyleKeywords.FIXED);
        values.setComputedAndSpecifiedValue(
                StylePropertyDetails.TOP, svf.getLength(null, 0, LengthUnit.PX));
        values.setComputedAndSpecifiedValue(
                StylePropertyDetails.LEFT, svf.getLength(null, 0, LengthUnit.PX));
        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


     * @param source The source for the property
     * @param destination The destination for the property
     * @param property The style property to move
     */
    private void moveProperty(Styles source, Styles destination, StyleProperty property) {
        MutablePropertyValues sourceValues = source.getPropertyValues();
        StyleValue specifiedValue = sourceValues.getSpecifiedValue(property);
        StyleValue computedValue = sourceValues.getComputedValue(property);
        MutablePropertyValues dstValues = destination.getPropertyValues();
        if (specifiedValue != null) {
            dstValues.setSpecifiedValue(property, specifiedValue);
        }
        if (computedValue != null) {
            dstValues.setComputedValue(property, computedValue);
        }

        // todo: should probably set this to the inferred value, i.e. the
        // todo: inherited or initial value.
        sourceValues.clearPropertyValue(property);
View Full Code Here

            if (styles != null) {
                // Set the computed and specified value as otherwise the
                // display:inline property will be removed when generating CSS
                // as it is the initial value.
                MutablePropertyValues propertyValues = styles.getPropertyValues();
                propertyValues.setComputedAndSpecifiedValue(
                        StylePropertyDetails.DISPLAY, display);
            }
        }
View Full Code Here

            // Open our fake pane.
            final DOMOutputBuffer dom = (DOMOutputBuffer) outputBuffer;
            Element element = dom.openElement(
                    VDXMLConstants.PSEUDO_PANE_ELEMENT);
            MutablePropertyValues propertyValues = null;
            if (styles != null) {
                propertyValues = styles.getPropertyValues();
            }
            ctx.addFakePaneAttributes(element, "synthetic fragment pane",
                    propertyValues);
View Full Code Here

     */
    public VDXMLStyleProperties getVDXMLStyle(Styles styles) {

        VDXMLStyleProperties result = null;
        if (styles != null) {
            MutablePropertyValues propertyValues = styles.getPropertyValues();
            if (propertyValues != null) {
                // Prepare the underline and blink values by visiting the text
                // decoration value - text decoration can be a bitset which is
                // why we can get 2 output values for 1 input value.
                StyleValue blinkStyle = propertyValues.getComputedValue(
                        StylePropertyDetails.MCS_TEXT_BLINK);
                VDXMLBinaryValue blink = getBinaryValue(
                        blinkStyle, MCSTextBlinkKeywords.BLINK);
                StyleValue underlineStyle = propertyValues.getComputedValue(
                        StylePropertyDetails.MCS_TEXT_UNDERLINE_STYLE);
                VDXMLBinaryValue underline = getBinaryValue(
                        underlineStyle, MCSTextUnderlineStyleKeywords.SOLID);

                //
                // Area Display
                //

                // Background Color
                StyleValue backgroundValue = propertyValues.getComputedValue(
                                        StylePropertyDetails.BACKGROUND_COLOR);
                if (backgroundValue instanceof StyleColor) {
                    VDXMLColorValue backgroundColor = getColor(
                            (StyleColor)backgroundValue);
                    if (backgroundColor != null) {
                        result = allocate(result);
                        result.setBackgroundColor(
                            new VDXMLBackgroundColorProperty(backgroundColor));
                    }
                }

                // Underline
                if (underline != null) {
                    result = allocate(result);
                    result.setUnderline(
                            new VDXMLUnderlineStyleProperty(underline));
                }

                //
                // Character Display
                //

                // Font Size
                VDXMLFontSizeValue fontSize = getCharacterSize(propertyValues);
                if (fontSize != null) {
                    result = allocate(result);
                    result.setFontSize(
                            new VDXMLFontSizeProperty(fontSize));
                }

                // Background Color
                VDXMLColorValue fontColor = getColor(
                        (StyleColor)propertyValues.getComputedValue(
                                StylePropertyDetails.COLOR));
                if (fontColor != null) {
                    result = allocate(result);
                    result.setFontColor(
                            new VDXMLFontColorProperty(fontColor));
View Full Code Here

        // resulting object in the styles. The value if specified always
        // overrides the styles.
        StyleValue validate = resolver.resolveQuotedTextExpressionAsStyleValue(
                attributes.getValidate());
        if (validate != null) {
            MutablePropertyValues propertyValues = styles.getPropertyValues();
            propertyValues.setComputedAndSpecifiedValue(
                    MCS_INPUT_FORMAT, validate);
        }

        // Initialise form field event attributes.
        PAPIInternals.initialiseFieldEventAttributes(pageContext, attributes,
View Full Code Here

     * @param inheritable The inheritable values.
     * @return The new set of inheritable values.
     */
    public StyleValues infer(Styles styles, StyleValues inheritable) {

        MutablePropertyValues values = styles.getPropertyValues();

        inheriter.inherit(values, inheritable);

        // Update the counters based on the styles.
        counterEngine.startElement(styles);

        // Evaluate any compiled values in the styles.
        propertyValuesEvaluator.evaluate(values);

        // Create a copy of the evaluated properties in case we need to inherit
        // from them.
        inheritableValues = values.createImmutablePropertyValues();

        styles.iterate(this);

        propertyValueTranslator.translate(values);

View Full Code Here

    }

    // Javadoc inherited.
    public IterationAction next(NestedStyles nestedStyles) {

        MutablePropertyValues values = nestedStyles.getPropertyValues();

        PseudoStyleEntity entity = nestedStyles.getPseudoStyleEntity();
        if (entity instanceof PseudoElement) {
            // Pseudo elements inherit from their superior parent just as
            // elements inherit from their parent.
            inheriter.inherit(values, inheritableValues);
        } else {
            // 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);
                }
            }
        }

        // Evaluate any compiled values in the styles.
        propertyValuesEvaluator.evaluate(values);

        if (nestedStyles.hasNestedStyles()) {

            // Save away the existing inheritable values so they can be
            // restored later.
            StyleValues oldInheritableValues = inheritableValues;

            // Create an immutable set of properties from which any nested
            // pseudo elements will inherit.
            inheritableValues = values.createImmutablePropertyValues();

            // Iterate over the nested styles.
            nestedStyles.iterate(this);

            // Restore the previous inheritable values.
View Full Code Here

                                String elementType,
                                MCSAttributes attributes,
                                StyleProperty[] styleProperties) {

        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,
                                                            prop,
                                                            styleValue)) {
                propertyValues.setComputedValue(prop, null);
            }
        }
    }
View Full Code Here

        // Grid styles.
        // Grid column styles (already handled).
        // Grid row styles.

        // todo add in row group / column group and col styles.
        MutablePropertyValues cellValues = cellStyles.getPropertyValues();
        StyleValue bgColor = cellValues.getStyleValue(
                StylePropertyDetails.BACKGROUND_COLOR);
        if (bgColor == BackgroundColorKeywords.TRANSPARENT) {

            for (int i = 0; i < layers.length; i++) {
                StyleValues layer = layers[i];

                StyleValue layerBgColor = layer.getStyleValue(
                        StylePropertyDetails.BACKGROUND_COLOR);
                StyleValue layerBgImage = layer.getStyleValue(
                        StylePropertyDetails.BACKGROUND_IMAGE);
                if (layerBgImage != BackgroundImageKeywords.NONE) {
                    // Don't set background color if the layer has an image
                    // otherwise it couldn't be seen.
                    break;
                } else
                if (layerBgColor != BackgroundColorKeywords.TRANSPARENT) {
                    cellValues.setComputedValue(
                            StylePropertyDetails.BACKGROUND_COLOR,
                            layerBgColor);
                    break;
                }
            }
View Full Code Here

TOP

Related Classes of com.volantis.styling.values.MutablePropertyValues

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.