Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONNumber


        item.setPrice(newBidValue);
        int numberOfBids = item.getNumberOfBids();

        JSONArray array = new JSONArray();
        array.set(0, new JSONNumber(itemId));
        array.set(1, new JSONNumber(newBidValue));
        array.set(2, new JSONNumber(numberOfBids));

        JSONObject container = new JSONObject();
        container.put("value", array);

        streamingService.sendMessage(TOPIC, container);
View Full Code Here


        public void onSuccess(Object result) {

            JSONObject resultObject = (JSONObject) result;
            JSONArray resultArray = (JSONArray) resultObject.get("value");
            JSONNumber itemId = (JSONNumber) resultArray.get(0);
            JSONNumber itemPrice = (JSONNumber) resultArray.get(1);
            JSONNumber numberOfBids = (JSONNumber) resultArray.get(2);

            Integer itemKey = new Integer((int) itemId.getValue());
            ((Label) mapOfItemPrices.get(itemKey)).setText("$ " + itemPrice.toString());
            ((Label) mapOfNumberOfBids.get(itemKey)).setText("" + Double.valueOf(numberOfBids.toString()).intValue());
        }
View Full Code Here

  private JSONArray createData() {
    JSONArray data = new JSONArray();
    JSONObject item;
   
    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-23")));
    item.put("content", new JSONString("<div>Conversation</div><img src='img/comments-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);
   
    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-08-23 23:00:00")));
    item.put("content", new JSONString("<div>Mail from boss</div><img src='img/mail-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-08-24 16:00:00")));
    item.put("content", new JSONString("Report"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-26")));
    item.put("end", new JSONNumber(dateToLong("2010-09-02")));
    item.put("content", new JSONString("Traject A"));
    data.set(data.size(), item);
   
    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-28")));
    item.put("content", new JSONString("<div>Memo</div><img src='img/notes-edit-icon.png' style='width:48px; height:48px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-29")));
    item.put("content", new JSONString("<div>Phone call</div><img src='img/Hardware-Mobile-Phone-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(dateToLong("2010-08-31")));
    item.put("end", new JSONNumber(dateToLong("2010-09-03")));
    item.put("content", new JSONString("Traject B"));
    data.set(data.size(), item);

    item = new JSONObject();
    item.put("start", new JSONNumber(datetimeToLong("2010-09-04 12:00:00")));
    item.put("content", new JSONString("<div>Report</div><img src='img/attachment-icon.png' style='width:32px; height:32px;'>"));
    data.set(data.size(), item);

    return data;
  }
View Full Code Here

    public void put(String key, boolean value) {
        object.put(key, JSONBoolean.getInstance(value));
    }

    public void put(String key, int value) {
        object.put(key, new JSONNumber(value));
    }
View Full Code Here

    public void put(String key, int value) {
        object.put(key, new JSONNumber(value));
    }

    public void put(String key, long value) {
        object.put(key, new JSONNumber(value));
    }
View Full Code Here

        } else if (value instanceof String) {
            return new JSONString((String) value);
        } else if (value instanceof Boolean) {
            return JSONBoolean.getInstance((Boolean) value);
        } else if (value instanceof Byte) {
            return new JSONNumber((Byte) value);
        } else if (value instanceof Character) {
            return new JSONString(String.valueOf(value));
        } else if (value instanceof Object[] && type == null) {
            // Non-legacy arrays handed by generated serializer
            return encodeLegacyObjectArray((Object[]) value, connection);
View Full Code Here

        return new Date((long) ((JSONNumber) jsonValue).doubleValue());
    }

    @Override
    public JSONValue serialize(Date value, ApplicationConnection connection) {
        return new JSONNumber(value.getTime());
    }
View Full Code Here

                ApplicationConstants.CSRF_TOKEN_DEFAULT_VALUE)) {
            payload.put(ApplicationConstants.CSRF_TOKEN, new JSONString(
                    getCsrfToken()));
        }
        payload.put(ApplicationConstants.RPC_INVOCATIONS, reqInvocations);
        payload.put(ApplicationConstants.SERVER_SYNC_ID, new JSONNumber(
                lastSeenServerSyncId));

        VConsole.log("Making UIDL Request with params: " + payload);
        String uri = translateVaadinUri(ApplicationConstants.APP_PROTOCOL_PREFIX
                + ApplicationConstants.UIDL_PATH + '/');
View Full Code Here

   * This is the entry point method.
   */
  public void onModuleLoad() {

    JSONObject n1 = new JSONObject();
    n1.put("id", new JSONNumber(1));
    n1.put("text", new JSONString("Node 1"));

    JSONObject n2 = new JSONObject();
    n2.put("id", new JSONNumber(2));
    n2.put("text", new JSONString("Node 2"));

    JSONObject n3 = new JSONObject();
    n3.put("id", new JSONNumber(3));
    n3.put("text", new JSONString("Node 3"));

    JSONArray nodes = new JSONArray();
    nodes.set(0, n1);
    nodes.set(1, n2);
    nodes.set(2, n3);


    JSONObject l1 = new JSONObject();
    l1.put("from", new JSONNumber(1));
    l1.put("to", new JSONNumber(2));

    JSONObject l2 = new JSONObject();
    l2.put("from", new JSONNumber(1));
    l2.put("to", new JSONNumber(3));

    JSONObject l3 = new JSONObject();
    l3.put("from", new JSONNumber(2));
    l3.put("to", new JSONNumber(3));

    JSONArray links = new JSONArray();
    links.set(0, l1);
    links.set(1, l2);
    links.set(2, l3);


    JSONObject p1 = new JSONObject();
    p1.put("from", new JSONNumber(1));
    p1.put("to", new JSONNumber(2));
    p1.put("duration", new JSONNumber(5));

    JSONObject p2 = new JSONObject();
    p2.put("from", new JSONNumber(1));
    p2.put("to", new JSONNumber(3));
    p2.put("duration", new JSONNumber(3));

    JSONObject p3 = new JSONObject();
    p3.put("from", new JSONNumber(2));
    p3.put("to", new JSONNumber(3));
    p3.put("duration", new JSONNumber(1));

    JSONArray packages = new JSONArray();
    packages.set(0, p1);
    packages.set(1, p2);
    packages.set(2, p3);
View Full Code Here

    //updatePackage();     
  }

  void addPackage() {
    JSONObject p = new JSONObject();
    p.put("from", new JSONNumber(1));
    p.put("to", new JSONNumber(2));

    JSONArray packages = new JSONArray();
    packages.set(0, p);
   
    network.addPackages(packages.getJavaScriptObject());
View Full Code Here

TOP

Related Classes of com.google.gwt.json.client.JSONNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.