Example usage for com.google.gwt.dom.client Element getPropertyDouble

List of usage examples for com.google.gwt.dom.client Element getPropertyDouble

Introduction

In this page you can find the example usage for com.google.gwt.dom.client Element getPropertyDouble.

Prototype

@Override
    public double getPropertyDouble(String name) 

Source Link

Usage

From source file:com.cgxlib.xq.client.impl.DocumentStyleImpl.java

License:Apache License

/**
 * Returns the numeric value of a css property.
 * <p/>//from w  w w .  ja  va 2  s .c  om
 * The parameter force has a special meaning:
 * - When force is false, returns the value of the css property defined
 * in the set of style attributes.
 * - Otherwise it returns the real computed value.
 */
public double cur(Element elem, String prop, boolean force) {
    if (JsUtils.isWindow(elem)) {
        if ("width".equals(prop)) {
            return getContentDocument(elem).getClientWidth();
        }
        if ("height".equals(prop)) {
            return getContentDocument(elem).getClientHeight();
        }
        elem = XQ.body;
    }

    if (force && sizeRegex.test(prop)) {
        // make curCSS below resolve width and height (issue #145) when force is true
    } else if (elem.getPropertyString(prop) != null
            && (elem.getStyle() == null || elem.getStyle().getProperty(prop) == null)) {
        // cases where elem.prop exists instead of elem.style.prop
        return elem.getPropertyDouble(prop);
    }
    String val = curCSS(elem, prop, force);
    if ("thick".equalsIgnoreCase(val)) {
        return (5);
    } else if ("medium".equalsIgnoreCase(val)) {
        return (3);
    } else if ("thin".equalsIgnoreCase(val)) {
        return (1);
    }
    if (!val.matches("^[\\d\\.]+.*$")) {
        val = curCSS(elem, prop, false);
    }
    val = val.trim().replaceAll("[^\\d\\.\\-]+.*$", "");
    return val.isEmpty() ? 0 : Double.parseDouble(val);
}

From source file:org.vaadin.addon.gwtgraphics.client.impl.VMLImpl.java

License:Apache License

@Override
public double getFillOpacity(Element element) {
    return element.getPropertyDouble("_fill-opacity");
}

From source file:org.vaadin.addon.gwtgraphics.client.impl.VMLImpl.java

License:Apache License

@Override
public double getStrokeOpacity(Element element) {
    return element.getPropertyDouble("_stroke-opacity");
}