Example usage for com.google.gwt.core.client JsArrayInteger cast

List of usage examples for com.google.gwt.core.client JsArrayInteger cast

Introduction

In this page you can find the example usage for com.google.gwt.core.client JsArrayInteger cast.

Prototype

@Override
@SuppressWarnings("unchecked")
public <T extends JavascriptObjectEquivalent> T cast() 

Source Link

Document

A helper method to enable cross-casting from any JavaScriptObject type to any other JavaScriptObject type.

Usage

From source file:org.geowe.client.local.model.style.LeafletStyle.java

License:Open Source License

public static JSObject getStyle(VectorStyleDef def) {

    String fillColor = def.getFill().getNormalColor();
    Double fillOpacity = def.getFill().getOpacity();
    String strokeColor = def.getLine().getNormalColor();
    Double strokeWidth = new Double(def.getLine().getThickness());

    JSObject styleObject = JSObject.createJSObject();
    styleObject.setProperty(FILL_NAME, true);
    styleObject.setProperty(FILL_COLOR_NAME, fillColor);
    styleObject.setProperty(FILL_OPACITY_NAME, fillOpacity);
    styleObject.setProperty(STROKE_COLOR_NAME, strokeColor);
    styleObject.setProperty(STROKE_WIDTH_NAME, strokeWidth);
    styleObject.setProperty(RADIUS_NAME, RADIUS_VALUE);

    //icon/*from ww w. ja  v  a  2  s .c o  m*/
    String iconUrl = def.getPoint().getExternalGraphic();
    if (iconUrl != null) {
        JSObject iconObject = JSObject.createJSObject();
        iconObject.setProperty(ICON_URL_NAME, iconUrl);
        JsArrayInteger iconSize = JSObject.createArray().cast();

        iconSize.push(def.getPoint().getGraphicWidth());
        iconSize.push(def.getPoint().getGraphicHeight());

        JSObject iconSizeObject = iconSize.cast();

        iconObject.setProperty(ICON_SIZE_NAME, iconSizeObject);

        styleObject.setProperty(ICON_NAME, iconObject);
    }

    return styleObject;
}