Package com.volantis.mcs.themes

Examples of com.volantis.mcs.themes.StyleLength


     * Test public void addMarinerLineGap ( Element,String ) method.
     */
    public void testAddMarinerLineGap() throws Exception {
        privateSetUp();

        StyleLength marinerLineGap = styleValueFactory.getLength(null, 10,
                LengthUnit.PX);

        properties.setComputedValue(
                StylePropertyDetails.MCS_LINE_GAP, marinerLineGap);

View Full Code Here


     * Test public void addParagraph ( Element,String ) method.
     */
    public void testAddMarinerParagraphGap() throws Exception {
        privateSetUp();

        StyleLength marinerParagraphGap = styleValueFactory.getLength(null, 10,
                LengthUnit.PX);

        properties.setComputedValue(
                StylePropertyDetails.MCS_PARAGRAPH_GAP, marinerParagraphGap);

View Full Code Here

        assertNull("Method addPosition should not have added a value as " +
                "only Lengths with pixel units are valid", position);

        // Test with StyleLength values.
        StyleLength styleTopLength = styleValueFactory.getLength(null, 50.0, LengthUnit.PX);
        properties.setComputedValue(StylePropertyDetails.TOP, styleTopLength);

        StyleLength styleLeftLength = styleValueFactory.getLength(null, 25.0, LengthUnit.PX);
        properties.setComputedValue(StylePropertyDetails.LEFT, styleLeftLength);

        element = domFactory.createElement();
        style.addPosition(element, "pos");
View Full Code Here

        //
        // Test public void addPosition ( Element,String ) method.
        //
        privateSetUp();

        StyleLength styleX = styleValueFactory.getLength(null, 25.0, LengthUnit.PX);

        StyleLength styleY = styleValueFactory.getLength(null, 50.0, LengthUnit.PX);

        StylePair pair = styleValueFactory.
                getPair(styleX, styleY);
        properties.setComputedValue(
                StylePropertyDetails.BACKGROUND_POSITION, pair);
View Full Code Here

    private String convertToCharCount(StyleValue value) {
        String pixels = null;

        if (value != null) {
            if (value instanceof StyleLength) {
                StyleLength length = (StyleLength)value;

                pixels = convertToCharCount(length.pixels());
            } else if (value instanceof StylePercentage) {
                StylePercentage percent = (StylePercentage)value;
                validatePercentageValue(percent);
            } else if (value instanceof StylePair) {
                StylePair stylePair = (StylePair) value;
View Full Code Here

            final String attributeName) {

        PropertyValues propertyValues = styles.getPropertyValues();
        StyleValue styleValue = propertyValues.getComputedValue(property);
        if (styleValue instanceof StyleLength) {
            StyleLength length = (StyleLength) styleValue;
            if (length.getUnit() == LengthUnit.PX) {
                int value = (int) length.getNumber();
                element.setAttribute(attributeName, convertToCharCount(value));
            }
        }
    }
View Full Code Here

        depth -= 1;
    }

    private int getPixelLength(StyleValue value) {
        if (value instanceof StyleLength) {
            StyleLength length = (StyleLength) value;
            LengthUnit units = length.getUnit();
            if (units == LengthUnit.PX) {
                int number = (int) length.getNumber();
                if (number > 0) {
                    return number;
                }
            }
        }
View Full Code Here

TOP

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

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.