Example usage for com.google.gwt.json.client JSONNumber JSONNumber

List of usage examples for com.google.gwt.json.client JSONNumber JSONNumber

Introduction

In this page you can find the example usage for com.google.gwt.json.client JSONNumber JSONNumber.

Prototype

public JSONNumber(double value) 

Source Link

Document

Creates a new JSONNumber from the double value.

Usage

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr height(double height) {
    this.put("height", new JSONNumber(height));
    return this;
}

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr strokeOpacity(double strokeOpacity) {
    this.put("stroke-opacity", new JSONNumber(strokeOpacity));
    return this;
}

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr fillOpacity(double fillOpacity) {
    this.put("fill-opacity", new JSONNumber(fillOpacity));
    return this;
}

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr strokeWidth(double strokeWidth) {
    this.put("stroke-width", new JSONNumber(strokeWidth));
    return this;
}

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr strokeMiterLimit(double strokeMiterLimit) {
    this.put("stroke-miterlimit", new JSONNumber(strokeMiterLimit));
    return this;
}

From source file:com.hydro4ge.raphaelgwt.client.Attr.java

License:Apache License

public Attr fontSize(double fontSize) {
    this.put("font-size", new JSONNumber(fontSize));
    return this;
}

From source file:com.java33.vizpres.client.view.visualization.RaphaelCanvas.java

License:Open Source License

@Override
public void setData(final List<PercentValue> values) {
    clear();//ww  w .j a va 2  s .c o  m

    for (int i = 0; i < values.size(); i += 1) {
        final int percent = values.get(i).percentage;
        final String label = Integer.toString(percent);
        final double barWidth = (double) (percent * width) / 100.0;
        final int rowY = i * ROW_HEIGHT;
        final Rect rect = new Rect(0, rowY, 0, BAR_HEIGHT);
        rect.attr("stroke", "none");
        rect.attr("fill", "#ff6600");
        rect.attr("title", label);

        // Is the click handler for the bar.
        rect.addDomHandler(new ClickHandler() {
            @Override
            public void onClick(final ClickEvent event) {
                parent.infoLabel.setText("You selected: " + rect.attrAsString("title"));
            }
        }, ClickEvent.getType());

        // Is the interpolation animation.
        final JSONObject bw = new JSONObject();
        bw.put("width", new JSONNumber(barWidth));
        rect.animate(bw, 1000);

        // Is the text label for a bar.
        final Text text = new Text(10, rowY + TEXT_OFFSET, label);
        text.attr("font", "10px 'Cabin', sans-serif");
        text.attr("fill", "white");
    }
}

From source file:com.kk_electronic.kkportal.core.rpc.converters.ModuleInfoDTO.java

License:Open Source License

public JSONObject toJsonObject() {
    JSONObject jo = new JSONObject();
    jo.put("height", new JSONNumber(height));
    jo.put("type", new JSONNumber(type));
    jo.put("id", new JSONNumber(id));
    return jo;//from w w w. ja  v a 2 s .c om
}

From source file:com.kk_electronic.kkportal.core.rpc.converters.TabInfoDTO.java

License:Open Source License

public JSONObject toJsonObject() {
    JSONObject jo = new JSONObject();
    jo.put("id", new JSONNumber(id));
    jo.put("name", new JSONString(name));
    return jo;/* ww w.  j  av a  2 s .  co  m*/
}

From source file:com.kk_electronic.kkportal.core.util.JsonValueHelper.java

License:Open Source License

public static JSONValue makeJSONValue(Object o) {
    if (o instanceof JavaScriptObject) {
        return new JSONObject((JavaScriptObject) o);
    } else if (o instanceof JsonConvertable) {
        return ((JsonConvertable) o).toJsonObject();
    } else if (o instanceof String) {
        return new JSONString((String) o);
    } else if (o instanceof Double) {
        return new JSONNumber((Double) o);
    } else if (o instanceof Integer) {
        return new JSONNumber(Double.valueOf((Integer) o));
    } else if (o == null) {
        return JSONNull.getInstance();
    } else if (o instanceof Collection<?>) {
        return makeJSONArray(((Collection<?>) o).toArray());
    } else if (o instanceof Map<?, ?>) {
        return makeJSONObject((Map<?, ?>) o);
    } else if (o instanceof Object[]) {
        return makeJSONArray((Object[]) o);
    } else {/*from  w  w w.ja  va 2s  . c  o m*/
        GWT.log("Unable to serialize Request", new Exception());
        return null;
    }
}