Package com.volantis.mcs.themes

Examples of com.volantis.mcs.themes.StyleLength


    protected void addPixelLength(
            Element element, String attribute,
            StyleValue value) {
        if (value instanceof StyleLength) {
            StyleLength length = (StyleLength) value;
            if (length.getUnit() == LengthUnit.PX) {
                element.setAttribute(attribute,
                        String.valueOf(length.pixels()));
            }
        }
    }
View Full Code Here


     */
    public void addVspace(Element element, String attribute) {
        StyleValue value = styles.getStyleValue(
                StylePropertyDetails.MCS_PARAGRAPH_GAP);
        if (value instanceof StyleLength) {
            StyleLength length = (StyleLength) value;
            if (length.getUnit() == LengthUnit.PX) {
                int result = (length.pixels() + 1) / 2;
                element.setAttribute(attribute, String.valueOf(result));
            }
        }
    }
View Full Code Here

            Element element, String attribute,
            LengthUnit unitConstraint) {
        if (value1 != null && value1 instanceof StyleLength &&
                value2 != null && value2 instanceof StyleLength) {

            StyleLength length1 = (StyleLength) value1;
            StyleLength length2 = (StyleLength) value2;

            if (length1.getUnit() == unitConstraint &&
                    length2.getUnit() == unitConstraint) {
                int unitLength = unitConstraint.toString().length();
                StringBuffer buffer = new StringBuffer();

                String value = context.getRenderValue(length1).toString();
                String number = value.substring(0, value.length() - unitLength);
View Full Code Here

            final StyleValue borderWidthValue =
                propertyValues.getComputedValue(widthProperty);
            boolean result = true;
            if (borderWidthValue != null) {
                if (borderWidthValue instanceof StyleLength) {
                    final StyleLength length = (StyleLength) borderWidthValue;
                    if (length.getNumber() == 0.0) {
                        result = false;
                    }
                }
            }
            if (result) {
View Full Code Here

                element.getStyles().getPropertyValues();
            final StyleValue value = propertyValues.getComputedValue(property);
            boolean result = true;
            if (value != null) {
                if (value instanceof StyleLength) {
                    final StyleLength length = (StyleLength) value;
                    if (length.getNumber() == 0.0) {
                        result = false;
                    }
                } else if (value instanceof StylePercentage) {
                    final StylePercentage percentage = (StylePercentage) value;
                    if (percentage.getPercentage() == 0.0) {
View Full Code Here

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

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

        StyleLength borderVerticalSpacing = styleValueFactory.getLength(null, 20,
                LengthUnit.PX);

        StylePair borderSpacing = styleValueFactory.getPair(
            borderHorizontalSpacing, borderVerticalSpacing);

View Full Code Here

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

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

        StyleLength borderVerticalSpacing = styleValueFactory.getLength(null, 20,
                LengthUnit.PX);

        StylePair borderSpacing = styleValueFactory.getPair(
            borderHorizontalSpacing, borderVerticalSpacing);

View Full Code Here

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

        StyleLength paddingLeft = styleValueFactory.getLength(null, 10,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.PADDING_LEFT, paddingLeft);

        StyleLength paddingRight = styleValueFactory.getLength(null, 20,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.PADDING_RIGHT, paddingRight);

        Element element = domFactory.createElement();
View Full Code Here

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

        StyleLength marginLeft = styleValueFactory.getLength(null, 10,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.MARGIN_LEFT, marginLeft);

        StyleLength marginRight = styleValueFactory.getLength(null, 20,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.MARGIN_RIGHT, marginRight);

        Element element = domFactory.createElement();
View Full Code Here

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

        StyleLength paddingTop = styleValueFactory.getLength(null, 10,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.PADDING_TOP, paddingTop);

        StyleLength paddingBottom = styleValueFactory.getLength(null, 20,
                LengthUnit.PX);
        properties.setComputedValue(
                StylePropertyDetails.PADDING_BOTTOM, paddingBottom);

        Element element = domFactory.createElement();
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.