Package org.zkoss.json

Examples of org.zkoss.json.JSONObject


      updateCell(sheet, left, top, right, bottom);
    }

    //in pixel
    public void setColumnWidth(Worksheet sheet, int col, int width, int id, boolean hidden) {
      JSONObject result = new JSONObject();
      result.put("type", "column");
      result.put("column", col);
      result.put("width", width);
      result.put("id", id);
      result.put("hidden", hidden);
      smartUpdate("columnSize", (Object) new Object[] { "", Utils.getSheetUuid(sheet), result}, true);
    }
View Full Code Here


      smartUpdate("columnSize", (Object) new Object[] { "", Utils.getSheetUuid(sheet), result}, true);
    }

    //in pixels
    public void setRowHeight(Worksheet sheet, int row, int height, int id, boolean hidden) {
      JSONObject result = new JSONObject();
      result.put("type", "row");
      result.put("row", row);
      result.put("height", height);
      result.put("id", id);
      result.put("hidden", hidden);
      smartUpdate("rowSize", (Object) new Object[] { "", Utils.getSheetUuid(sheet), result}, true);
    }
View Full Code Here

      throw x;
    }
  }

  private void processCancelEditing0(String token, Worksheet sheet, int row, int col, boolean skipMove, String editingType) {
    JSONObject result = new JSONObject();
    result.put("r", row);
    result.put("c", col);
    result.put("type", "canceledit");
    result.put("val", "");
    result.put("sk", skipMove);
    result.put("et", editingType);
    smartUpdate("dataUpdateCancel", new Object[] { token, Utils.getSheetUuid(sheet), result});
  }
View Full Code Here

  }

  private void processRetryEditing0(String token, Worksheet sheet, int row, int col, Object value, String editingType) {
    try {
      processCancelEditing0(token, sheet, row, col, true, editingType);
      JSONObject result = new JSONObject();
      result.put("r", row);
      result.put("c", col);
      result.put("type", "retryedit");
      result.put("val", value);
      result.put("et", editingType);
      smartUpdate("dataUpdateRetry", new Object[] { "", Utils.getSheetUuid(sheet), result});
    } catch (RuntimeException x) {
      processCancelEditing0(token, sheet, row, col, false, editingType);
      throw x;
    }
View Full Code Here

   * </ul>
   *
   * @return
   */
  public JSONObject getJSONObject() {
    JSONObject result = new JSONObject();
    result.put("r", getMerge());
    result.put("cs", getMergeCSS());
    return result;
  }
View Full Code Here

    throws ParseException, UnsupportedEncodingException, MalformedURLException, IOException {
    StringBuilder sb = getGeocodeJsonResult(address, sensor, language);
    double[] latlng = new double[2];

    JSONArray results = (JSONArray)((JSONObject)new JSONParser().parse(sb.toString())).get("results");
    JSONObject location = (JSONObject)((JSONObject)((JSONObject)results.get(0)).get("geometry")).get("location");
    latlng[0] = ((Double)location.get("lat")).doubleValue();
    latlng[1] = ((Double)location.get("lng")).doubleValue();
    return latlng;
  }
View Full Code Here

    throws ParseException, UnsupportedEncodingException, MalformedURLException, IOException {
    StringBuilder sb = getGeocodeJsonResult(address, sensor, language);
    double[] bounds = new double[4];
 
    JSONArray results = (JSONArray)((JSONObject)new JSONParser().parse(sb.toString())).get("results");
    JSONObject boundsInfo = (JSONObject)((JSONObject)((JSONObject)results.get(0)).get("geometry")).get("bounds");
    bounds[0] = ((Double)((JSONObject)boundsInfo.get("southwest")).get("lat")).doubleValue();
    bounds[1] = ((Double)((JSONObject)boundsInfo.get("southwest")).get("lng")).doubleValue();
    bounds[2] = ((Double)((JSONObject)boundsInfo.get("northeast")).get("lat")).doubleValue();
    bounds[3] = ((Double)((JSONObject)boundsInfo.get("northeast")).get("lng")).doubleValue();
 
    return bounds;
  }
View Full Code Here

    response(row + "_" + col + "_" + _updateCellId.next(), new AuDataUpdate(this, "", sheetId, result));
  }
 
  private void responseUpdateCell(Worksheet sheet, String sheetId, int left, int top, int right, int bottom) {
    SpreadsheetCtrl spreadsheetCtrl = ((SpreadsheetCtrl) this.getExtraCtrl());
    JSONObject result = spreadsheetCtrl.getRangeAttrs(sheet, SpreadsheetCtrl.Header.NONE, CellAttribute.ALL, left, top, right, bottom);
    result.put("type", "udcell");
    response(top + "_" + left + "_" + _updateCellId.next(),
        new AuDataUpdate(this, "", sheetId, result));
  }
View Full Code Here

      )) {
        return;
      }

      //JSONObj result = new JSONObj();
      JSONObject result = new JSONObject();
      result.put("r", rowIdx);
      result.put("c", colIdx);
      result.put("type", "stopedit");
      result.put("val", "");
      result.put("et", editingType);

      smartUpdate("dataUpdateStop", new Object[] { token,  Utils.getSheetUuid(sheet), result});
    } catch (RuntimeException x) {
      processCancelEditing0(token, sheet, rowIdx, colIdx, false, editingType);
      if (x instanceof FormulaParseException) {
View Full Code Here

    }
  }

  private void processStartEditing0(String token, Worksheet sheet, int row, int col, Object value, boolean useEditValue, String editingType) {
    try {
      JSONObject result = new JSONObject();
      result.put("r", row);
      result.put("c", col);
      result.put("type", "startedit");
      result.put("val", value == null ? "" : value.toString());
      result.put("et", editingType);
      if (useEditValue) { //shall use edit value from server
        result.put("server", true);
      }
      smartUpdate("dataUpdateStart", new Object[] { token, Utils.getSheetUuid(sheet), result});
    } catch (RuntimeException x) {
      processCancelEditing0(token, sheet, row, col, false, editingType);
      throw x;
View Full Code Here

TOP

Related Classes of org.zkoss.json.JSONObject

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.