Package org.zkoss.json

Examples of org.zkoss.json.JSONArray


        getInt(data.get(3)), getInt(data.get(4)),
        getInt(data.get(5)),getInt(data.get(6)));
  }
 
  public static Event getClickEvent(AuRequest request, String cmd) {
    final JSONArray data = (JSONArray) request.getData().get("data");
    final Calendars cmp = verifyEvent(request, data, 1);   
   
    return new Event(cmd, cmp, Util.fixDSTTime(cmp.getDefaultTimeZone(), new Date(getLong(data.get(0)))));
  }
View Full Code Here


    final Range range = Ranges.range(worksheet, cellRangeAddr);
   
    if (selectAll) {
      range.autoFilter(field, null, AutoFilter.FILTEROP_VALUES, null, null);
    } else { //partial selection
      JSONArray ary = (JSONArray) data.get("criteria");
      range.autoFilter(field, ary.toArray(new String[ary.size()]), AutoFilter.FILTEROP_VALUES, null, null);
    }
  }
View Full Code Here

    private JSONObject getHeaderAttrs(Worksheet sheet, boolean isRow, int start, int end) {
      JSONObject attrs = new JSONObject();
      attrs.put("s", start);
      attrs.put("e", end);
     
      JSONArray headers = new JSONArray();
      attrs.put("hs", headers);
      if (isRow) {
        attrs.put("t", "r"); //type: row
        for (int row = start; row <= end; row++) {
          headers.add(getRowHeaderAttrs(sheet, row));
        }
      } else { //column header
        attrs.put("t", "c"); //type: column
        for (int col = start; col <= end; col++) {
          headers.add(getColumnHeaderAttrs(sheet, col));
        }
      }
      return attrs;
    }
View Full Code Here

      attrs.put("t", top);
      attrs.put("r", right);
      attrs.put("b", bottom);
      attrs.put("at", type);
     
      JSONArray rows = new JSONArray();
      attrs.put("rs", rows);
     
      StringAggregation styleAggregation = new StringAggregation();
      StringAggregation textAggregation = new StringAggregation();
      MergeAggregation mergeAggregation = new MergeAggregation(getMergeMatrixHelper(sheet));
      for (int row = top; row <= bottom; row++) {
        JSONObject r = getRowAttrs(row);
        rows.add(r);
       
        JSONArray cells = new JSONArray();
        r.put("cs", cells);
        for (int col = left; col <= right; col++) {
          cells.add(getCellAttr(sheet, type, row, col, styleAggregation, textAggregation, mergeAggregation));
        }
      }
     
      attrs.put("s", textAggregation.getJSONArray());
      attrs.put("st", styleAggregation.getJSONArray());
View Full Code Here

   * Returns {@link JSONArray} representation of aggregation
   *
   * @return JSONArray
   */
  public JSONArray getJSONArray() {
    JSONArray strs = new JSONArray();
   
    Iterator<String> iter = _values.keySet().iterator();
    while (iter.hasNext()) {
      strs.add(iter.next());
    }
    return strs;
  }
View Full Code Here

    result.put("cs", getMergeCSS());
    return result;
  }
 
  private JSONArray getMerge() {
    JSONArray ary = new JSONArray();
   
    Iterator<Integer> iter = _mergeIds.keySet().iterator();
    while (iter.hasNext()) {
      Integer id = iter.next(); //merge id
      ary.add(newMergeAttributes(_helper.getMergedRect(id)));
    }
   
    return ary;
  }
View Full Code Here

  public static double[] getLatlngByAddress (String address, boolean sensor, String language)
    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

  public static double[] getBoundsByAddress (String address, boolean sensor, String language)
    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();
 
View Full Code Here

  public static String getAddressByLatlng (double lat, double lng, boolean sensor, String language)
    throws ParseException, UnsupportedEncodingException, MalformedURLException, IOException {
    StringBuilder sb = getGeocodeJsonResult(lat, lng, sensor, language);
    String address = null;
   
    JSONArray results = (JSONArray)((JSONObject)new JSONParser().parse(sb.toString())).get("results");
    address = (String)((JSONObject)results.get(1)).get("formatted_address");
    return address;
  }
View Full Code Here

    String[] validationList = BookHelper.getValidationList(getSelectedSheet(), dv);
    if (validationList != null) {
      //ZSS-197: the method is useful only list validation objects
      validMap.put("showButton", dv.getSuppressDropDownArrow()); //whether show dropdown button
     
      JSONArray jsonAry = new JSONArray();
      for (String v : validationList) {
        jsonAry.add(v);
      }
      validMap.put("validationList", jsonAry);
    }
   
    return validMap;
View Full Code Here

TOP

Related Classes of org.zkoss.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.