Package org.primefaces.json

Examples of org.primefaces.json.JSONArray


  @Override
  public Trip loadGoogleData(Trip trip, JSONObject json) throws IOException,
      JSONException {
    List<Point> points = new ArrayList<Point>();
    if ("OK".equals(json.getString("status"))) {
      JSONArray routes = json.getJSONArray("routes");
      // routes contains// routes contains possible routes; use the
      // first one?
      if (routes.length() > 0) {
        // a route contains legs from start to endpoint
        JSONObject route = routes.getJSONObject(0);

        JSONArray legs = route.getJSONArray("legs");
        int order = 1;
        for (int l = 0; l < legs.length(); l++) {
          // a leg contains steps between waypoints
          JSONObject leg = legs.getJSONObject(l);
          JSONArray steps = leg.getJSONArray("steps");

          if (steps.length() < 0)
            continue;

          for (int s = 0; s < steps.length(); s++) {
            JSONObject step = steps.getJSONObject(s);
            JSONObject poly = step.getJSONObject("polyline");
            if (!points.isEmpty())
              order = points.get(points.size() - 1).getOrder();

            List<Point> polyline = decode(poly.getString("points"),
View Full Code Here


    if (StringUtils.isEmpty(jsonSelection))
      return;

    try {
      // data comes in: [ [row, col, oldValue, newValue] ... ]
      JSONArray array = new JSONArray(jsonSelection);
      sheet.setSelectedRow(array.getInt(0));
      sheet.setSelectedColumn(sheet.getMappedColumn(array.getInt(1)));
      sheet.setSelectedLastRow(array.getInt(2));
      sheet.setSelectedLastColumn(array.getInt(3));
      sheet.setSelection(jsonSelection);
    } catch (JSONException e) {
      LOG.error("Failed parsing Ajax JSON message for cell selection: {}", e.getMessage(), e);
    }
  }
View Full Code Here

      @SuppressWarnings("unchecked")
      Iterator<String> keys = obj.keys();
      while (keys.hasNext()) {
        final String key = keys.next();
        // data comes in: [row, col, oldValue, newValue]
        JSONArray update = obj.getJSONArray(key);
        final int row = update.getInt(0);
        final int col = sheet.getMappedColumn(update.getInt(1));
        final String newValue = update.getString(3);
        sheet.setSubmittedValue(context, row, col, newValue);
      }
    } catch (JSONException e) {
      LOG.error("Failed parsing Ajax JSON message for cell change event: {}", e.getMessage(), e);
    }
View Full Code Here

TOP

Related Classes of org.primefaces.json.JSONArray

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.