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.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setAlignTicksWithAxis(Integer axisNumber) {
    put("alignTicksWithAxis", axisNumber == null ? null : new JSONNumber(axisNumber));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setAutoscaleMargin(int percent) {
    put("autoscaleMargin", new JSONNumber(percent));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setMin(Integer min) {
    put("min", min == null ? null : new JSONNumber(min));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setTickDecimals(Integer no) {
    put("tickDecimals", no == null ? null : new JSONNumber(no));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setTickLength(int i) {
    put("tickLength", new JSONNumber(i));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setTickSize(int i) {
    put("tickSize", new JSONNumber(i));
}

From source file:com.horaz.client.widgets.charting.BaseAxisOptions.java

License:Open Source License

public void setTickSize(int i, String unit) {
    JSONArray a = new JSONArray();
    a.set(0, new JSONNumber(i));
    a.set(1, new JSONString(unit));
    put("tickSize", a);
}

From source file:com.horaz.client.widgets.charting.Point.java

License:Open Source License

public Point(double x, double y) {
    set(0, new JSONNumber(x));
    set(1, new JSONNumber(y));
}

From source file:com.horaz.client.widgets.charting.Series.java

License:Open Source License

public void setYaxis(int n) {
    put("yaxis", new JSONNumber(n));
}

From source file:com.hunchee.haystack.client.utils.JsonConverter.java

License:Open Source License

protected static JSONValue encodeValue(Object value) {
    if (value == null) {
        return JSONNull.getInstance();
    } else if (value instanceof Date) {
        double date = ((Date) value).getTime();
        return new JSONNumber(date);
    } else if (value instanceof Integer || int.class.getName().equals(value.getClass().getName())) {
        int i = (Integer) value;
        double d = i;
        return new JSONNumber(Double.valueOf(d));
    } else if (value instanceof Long || long.class.getName().equals(value.getClass().getName())) {
        long l = (Long) value;
        double d = l;
        return new JSONNumber(Double.valueOf(d));
    } else if (value instanceof Double || double.class.getName().equals(value.getClass().getName())) {
        return new JSONNumber(Double.valueOf((Double) value));
    } else if (value instanceof Float || float.class.getName().equals(value.getClass().getName())) {
        float f = (Float) value;
        double d = f;
        return new JSONNumber(Double.valueOf(d));
    } else if (value instanceof Boolean || value.getClass().getName().equals(boolean.class)) {
        return JSONBoolean.getInstance((Boolean) value);
    }//from  ww  w .  j  av  a2s. c  o m
    return new JSONString(value.toString());
}