Package org.w3c.dom.css

Examples of org.w3c.dom.css.CSSValue


        CSSValueList border = (CSSValueList)cssDec.getPropertyCSSValue("border");
        int len = border.getLength();
        String cssText = "";
        for(int i = 0; i < len; i++)
        {
            CSSValue value = border.item(i);
            if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)
            {
                CSSPrimitiveValue primValue = (CSSPrimitiveValue)value;
                if (primValue.getPrimitiveType() == CSSPrimitiveValue.CSS_RGBCOLOR)
                {
                    RGBColor rgb = primValue.getRGBColorValue();
                    log("Current border color: rgb(" + rgb.getRed().getCssText() + "," + rgb.getGreen().getCssText() + "," + rgb.getBlue().getCssText() + ")");
                }
                else cssText += primValue.getCssText() + " ";
            }
            else cssText += value.getCssText() + " ";
        }
        cssDec.setProperty("border",cssText,null); // Removed border color

        CSS2Properties cssDec2 = (CSS2Properties)styleElem.getStyle();
        String newColor = "rgb(255,100,150)";
View Full Code Here


    }

    public static void selectDecoration(ElementCSSInlineStyle elemStyle)
    {
        CSSStyleDeclaration style = elemStyle.getStyle();
        CSSValue cssValue = style.getPropertyCSSValue("color"); // Usar el CSSValue es la forma m�s lenta pero es para testear
        if (cssValue == null)
            style.setProperty("color","red","");
        else
            cssValue.setCssText("red");
    }
View Full Code Here

                CSSValueList border = (CSSValueList)cssDec.getPropertyCSSValue("border");
                int len = border.getLength();
                String cssText = "";
                for(int i = 0; i < len; i++)
                {
                    CSSValue value = border.item(i);
                    if (value.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE)
                    {
                        CSSPrimitiveValue primValue = (CSSPrimitiveValue)value;
                        if (primValue.getPrimitiveType() == CSSPrimitiveValue.CSS_RGBCOLOR)
                        {
                            RGBColor rgb = primValue.getRGBColorValue();
                            System.out.println("Current border color: rgb(" + rgb.getRed().getCssText() + "," + rgb.getGreen().getCssText() + "," + rgb.getBlue().getCssText() + ")");
                        }
                        else cssText += primValue.getCssText() + " ";
                    }
                    else cssText += value.getCssText() + " ";
                }
                cssDec.setProperty("border",cssText,null); // Removed border color

                CSS2Properties cssDec2 = (CSS2Properties)styleElem.getStyle();
                String newColor = "rgb(255,100,150)";
View Full Code Here

        TestUtil.checkError(color.getStringValue().equals("red"));
        color.setStringValue(CSSPrimitiveValue.CSS_IDENT," blue ");
        TestUtil.checkError(color.getStringValue().equals("blue"));
        color.setCssText(" red "); // Restauramos el valor original

        CSSValue border = props.getPropertyCSSValue("border");
        TestUtil.checkError(border.getCssValueType() == CSSValue.CSS_VALUE_LIST);
        CSSValueList borderList = (CSSValueList)border;
        TestUtil.checkError(borderList.getLength() == 2);

        CSSPrimitiveValue borderType = (CSSPrimitiveValue)borderList.item(0);
        TestUtil.checkError(borderType.getPrimitiveType() == CSSPrimitiveValue.CSS_IDENT);
        TestUtil.checkError(borderType.getStringValue().equals("solid"));
        borderType.setStringValue(CSSPrimitiveValue.CSS_IDENT,"dotted");
        TestUtil.checkError(borderType.getStringValue().equals("dotted"));
        TestUtil.checkError(body.getAttribute("style").equals("color: red ;border:dotted 1.5px;clip: rect( 1px 2in 3cm 4 );border-color: #aabbcc;width: 50%;anytext: \"hello guy\" "));
        borderType.setStringValue(CSSPrimitiveValue.CSS_IDENT,"solid"); // restaurar

        CSSPrimitiveValue borderWidth = (CSSPrimitiveValue)borderList.item(1);
        TestUtil.checkError(borderWidth.getPrimitiveType() == CSSPrimitiveValue.CSS_PX);
        TestUtil.checkError(borderWidth.getFloatValue(CSSPrimitiveValue.CSS_PX) == 1.5);
        borderWidth.setFloatValue(CSSPrimitiveValue.CSS_IN,(float)2.5);
        TestUtil.checkError(borderWidth.getPrimitiveType() == CSSPrimitiveValue.CSS_IN);
        TestUtil.checkError(borderWidth.getFloatValue(CSSPrimitiveValue.CSS_IN) == 2.5);
        borderWidth.setFloatValue(CSSPrimitiveValue.CSS_PX,(float)1.5); // Restaurar

        CSSValue clip = props.getPropertyCSSValue("clip");
        TestUtil.checkError(clip.getCssValueType() == CSSValue.CSS_PRIMITIVE_VALUE);
        CSSPrimitiveValue clipValue = (CSSPrimitiveValue)clip;
        Rect clipRect = clipValue.getRectValue();
        CSSPrimitiveValue top = clipRect.getTop();
        TestUtil.checkError(top.getPrimitiveType() == CSSPrimitiveValue.CSS_PX);
        TestUtil.checkError(top.getFloatValue(CSSPrimitiveValue.CSS_PX) == 1);
View Full Code Here

    /**
     * <b>DOM</b>: Implements {@link
     * org.w3c.dom.css.CSSStyleDeclaration#getPropertyCSSValue(String)}.
     */
    public CSSValue getPropertyCSSValue(String propertyName) {
        CSSValue result = (CSSValue)values.get(propertyName);
        if (result == null) {
            int idx = cssEngine.getPropertyIndex(propertyName);
            if (idx != -1) {
                result = createCSSValue(idx);
                values.put(propertyName, result);
View Full Code Here

    /**
     * Gets the CSS value associated with the given property.
     */
    protected CSSValue getCSSValue(String name) {
        CSSValue result = null;
        if (values != null) {
            result = (CSSValue)values.get(name);
        }
        if (result == null) {
            result = createCSSValue(name);
View Full Code Here

    /**
     * <b>DOM</b>: Implements {@link
     * org.w3c.dom.svg.SVGStylable#getPresentationAttribute(String)}.
     */
    public CSSValue getPresentationAttribute(String name) {
        CSSValue result = (CSSValue)getLiveAttributeValue(null, name);
        if (result != null)
            return result;

        CSSEngine eng = ((SVGOMDocument)getOwnerDocument()).getCSSEngine();
        int idx = eng.getPropertyIndex(name);
View Full Code Here

    public static
        Rectangle2D convertEnableBackground(Element e,
                                            UnitProcessor.Context uctx) {

        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSValue v
            = decl.getPropertyCSSValueInternal(CSS_ENABLE_BACKGROUND_PROPERTY);
        if (v.getCssValueType() != v.CSS_VALUE_LIST) {
            return null; // accumulate
        }
        CSSValueList l = (CSSValueList)v;
        int length = l.getLength();
        switch (length) {
View Full Code Here

     *
     * @param e the element
     */
    public static boolean convertDisplay(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSValue v = decl.getPropertyCSSValueInternal(CSS_DISPLAY_PROPERTY);
        return (((CSSPrimitiveValue)v).getStringValue().charAt(0) != 'n');
    }
View Full Code Here

     *
     * @param e the element
     */
    public static boolean convertVisibility(Element e) {
        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
        CSSValue v = decl.getPropertyCSSValueInternal(CSS_VISIBILITY_PROPERTY);
        if (v.getCssValueType() == CSSValue.CSS_INHERIT) {
            // workaround for the CSS2 spec which indicates that the
            // initial value is 'inherit'. So if we get 'inherit' it
            // means that we are on the outermost svg element and we
            // always return true.
            return true;
View Full Code Here

TOP

Related Classes of org.w3c.dom.css.CSSValue

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.