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:gov.nist.spectrumbrowser.admin.Threshold.java

License:Open Source License

public Threshold() {
    this.threshold = new JSONObject();
    this.threshold.put("systemToDetect", new JSONString("UNKNOWN"));
    this.threshold.put("maxFreqHz", new JSONNumber(-1));
    this.threshold.put("minFreqHz", new JSONNumber(-1));
    this.threshold.put("thresholdDbmPerHz", new JSONNumber(-1));
    this.threshold.put("channelCount", new JSONNumber(-1));
    this.threshold.put("active", JSONBoolean.getInstance(false));
}

From source file:n3phele.client.model.ExecuteCommandRequest.java

License:Open Source License

@Override
public String toString() {
    JSONObject builder = new JSONObject();
    builder.put("name", new JSONString(name));
    builder.put("notify", JSONBoolean.getInstance(notify));
    builder.put("user", new JSONString(user));
    builder.put("command", new JSONString(command));
    builder.put("profileId", new JSONNumber(profileId));
    builder.put("account", new JSONString(account));
    builder.put("parameters", nameValueArray(parameters));
    builder.put("inputFiles", fileSpecificationArray(inputFiles));
    builder.put("outputFiles", fileSpecificationArray(outputFiles));
    return builder.toString();
}

From source file:name.alexdeleon.lib.gwtblocks.client.place.PlaceState.java

License:Open Source License

protected void put(String key, Number value) {
    JSONValue val = JSONNull.getInstance();
    if (value != null) {
        val = new JSONNumber(value.doubleValue());
    }/*from  www .j  a  v a 2s. com*/
    put(key, val);
}

From source file:net.easysmarthouse.ui.webui.client.view.widget.Slider.java

public static JSONObject getOptions(double min, double max, double[] defaultValues) {
    JSONObject options = new JSONObject();
    options.put(SliderOption.MIN.toString(), new JSONNumber(min));
    options.put(SliderOption.MAX.toString(), new JSONNumber(max));

    JSONArray vals = doubleArrayToJSONArray(defaultValues);
    options.put(SliderOption.VALUES.toString(), vals);

    return options;
}

From source file:net.easysmarthouse.ui.webui.client.view.widget.Slider.java

private static JSONArray doubleArrayToJSONArray(double[] values) {
    JSONArray vals = new JSONArray();
    for (int i = 0, len = values.length; i < len; i++) {
        vals.set(i, new JSONNumber(values[i]));
    }/*from w w w.ja va2  s .  co  m*/
    return vals;
}

From source file:next.celebs.JsoUtils.java

License:Apache License

public static void putNumber(JSONObject jso, Object key, Double val) {
    String _key = (String) key;
    jso.put(_key, new JSONNumber(val));
}

From source file:org.celstec.arlearn2.gwtcommonlib.client.datasource.desktop.RunParticipateDataSource.java

License:Open Source License

public void loadDataFromWeb() {
    ((RunClient) getHttpClient())/*from   w  w  w  .  j  a va 2  s.c o m*/
            .runsParticipate(new JsonObjectListCallback(getBeanType(), this.getDataSourceModel()) {
                public void onJsonObjectReceived(JSONObject jsonObject) {
                    jsonObject.put("accessRights", new JSONNumber(3));
                    getDataSourceModel().addJsonObject(jsonObject);
                }

            });
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Materials.java

License:Apache License

public void applyBumpMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));

    JSONObject diffuseMaterial = new JSONObject();
    diffuseMaterial.put("type", new JSONString("DiffuseMap"));
    diffuseMaterial.put("uniforms", uniforms);

    uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));
    uniforms.put("strength", new JSONNumber(0.8));

    JSONObject bumpMaterial = new JSONObject();
    bumpMaterial.put("type", new JSONString("BumpMap"));
    bumpMaterial.put("uniforms", uniforms);

    JSONObject materials = new JSONObject();
    materials.put("diffuseMaterial", diffuseMaterial);
    materials.put("bumpMaterial", bumpMaterial);

    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("diffuseMaterial.diffuse"));
    components.put("specular", new JSONNumber(0.01));
    components.put("normal", new JSONString("bumpMaterial.normal"));

    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);

    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Materials.java

License:Apache License

public void applyEmissionMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/Cesium_Logo_Color.jpg"));

    JSONObject diffuseMaterial = new JSONObject();
    diffuseMaterial.put("type", new JSONString("DiffuseMap"));
    diffuseMaterial.put("uniforms", uniforms);

    JSONObject repeat = new JSONObject();
    repeat.put("x", new JSONNumber(1));
    repeat.put("y", new JSONNumber(0.5));

    uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/checkerboard.png"));
    uniforms.put("repeat", repeat);

    JSONObject emissionMaterial = new JSONObject();
    emissionMaterial.put("type", new JSONString("EmissionMap"));
    emissionMaterial.put("uniforms", uniforms);

    JSONObject materials = new JSONObject();
    materials.put("diffuseMaterial", diffuseMaterial);
    materials.put("emissionMaterial", emissionMaterial);

    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("diffuseMaterial.diffuse"));
    components.put("emission", new JSONString("emissionMaterial.emission * 0.2"));

    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);

    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}

From source file:org.cleanlogic.cesiumjs4gwt.showcase.examples.Materials.java

License:Apache License

public void applyNormalMapMaterial(Primitive primitive) {
    JSONObject uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/bumpmap.png"));

    JSONObject diffuseMaterial = new JSONObject();
    diffuseMaterial.put("type", new JSONString("DiffuseMap"));
    diffuseMaterial.put("uniforms", uniforms);

    uniforms = new JSONObject();
    uniforms.put("image", new JSONString(GWT.getModuleBaseURL() + "images/normalmap.png"));
    uniforms.put("strength", new JSONNumber(0.6));

    JSONObject normalMap = new JSONObject();
    normalMap.put("type", new JSONString("NormalMap"));
    normalMap.put("uniforms", uniforms);

    JSONObject materials = new JSONObject();
    materials.put("diffuseMaterial", diffuseMaterial);
    materials.put("normalMap", normalMap);

    JSONObject components = new JSONObject();
    components.put("diffuse", new JSONString("diffuseMaterial.diffuse"));
    components.put("specular", new JSONNumber(0.01));
    components.put("normal", new JSONString("normalMap.normal"));

    JSONObject fabric = new JSONObject();
    fabric.put("materials", materials);
    fabric.put("components", components);

    MaterialOptions materialOptions = new MaterialOptions();
    materialOptions.fabric = JsonUtils.safeEval(fabric.toString());
    primitive.appearance.material = new Material(materialOptions);
}