Examples of JSONObj


Examples of com.zappos.model.JsonObj

    String apikey = "a73121520492f88dc3d33daf2103d7574f1a3166";
    RestTemplate restTemplate = new RestTemplate();
    ObjectMapper mapper = new ObjectMapper();

    System.out.println("sending request...");
    JsonObj obj = new JsonObj();
    try{
      //This api call retrieves the products with a given cost and sorted by product rating.
      obj = mapper.readValue(restTemplate.getForObject("http://api.zappos.com/Search?limit=100&includes=[\"productRating\"]&excludes=[{excludeterms}]&filters={pricefacet}&sort={productrating}&key={apikey}", String.class, excludeterms, pricefacet, productrating, apikey), JsonObj.class);
    }
    catch(HttpClientErrorException e){
      return null;
    }

    System.out.println("request sent...");
    System.out.println("Status Code: "+obj.getStatusCode());
    if(!obj.getStatusCode().equals("200")){
      return null;
    }
    System.out.println("size of Arraylist with duplicates: " + obj.getResults().size());

    Iterator<Results> itr = obj.getResults().iterator();
    HashSet<Results> hs = new HashSet<Results>();

    //This loop generates a list of products without any duplicates.
    while(itr.hasNext()){
      Results temp = itr.next();
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

     
     
      //remove merge before a new column or row
      removeAffectedMergeRange(sheet,0,col);

      JSONObj result = new JSONObj();
      result.setData("type","column");
      result.setData("col",col);
      result.setData("size",size);
     
      List extnm = new ArrayList();
      int right = size+_loadedRect.getRight();
      for(int i=col;i<=right;i++){
        extnm.add(getColumntitle(i));
      }
      result.setData("extnm", extnm);
     
      HeaderPositionHelper colHelper = Spreadsheet.this.getColumnPositionHelper(sheet);
     
      colHelper.shiftMeta(col,size);
      _maxColumns += size;
      int cf = getColumnfreeze();
      if(cf>=col){
        _colFreeze += size;
      }
     
      result.setData("maxcol", _maxColumns);
      result.setData("colfreeze", _colFreeze);
     
      smartUpdateValues("insertrc_"+Utils.nextUpdateId(),new Object[]{"",Utils.getId(sheet),result.toString()});
     
      _loadedRect.setRight(right);
     
      //update surround cell
      int left = col;
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

      //let client handle it
     
      //remove merge before a new column or row
      removeAffectedMergeRange(sheet,1,row);
     
      JSONObj result = new JSONObj();
      result.setData("type","row");
      result.setData("row",row);
      result.setData("size",size);
     
      List extnm = new ArrayList();
      int bottom = size+_loadedRect.getBottom();
      for(int i=row;i<=bottom;i++){
        extnm.add(getRowtitle(i));
      }
      result.setData("extnm", extnm);
     
      HeaderPositionHelper rowHelper = Spreadsheet.this.getRowPositionHelper(sheet);
      rowHelper.shiftMeta(row,size);
      _maxRows += size;
      int rf = getRowfreeze();
      if(rf>=row){
        _rowFreeze += size;
      }
     
      result.setData("maxrow", _maxRows);
      result.setData("rowfreeze", _rowFreeze);
     
      smartUpdateValues("insertrc_"+Utils.nextUpdateId(),new Object[]{"",Utils.getId(sheet),result.toString()});
     
      _loadedRect.setBottom(bottom);
     
     
      //update surround cell
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

     
     
      //remove merge before a new column or row
      removeAffectedMergeRange(sheet,0,col);
     
      JSONObj result = new JSONObj();
      result.setData("type","column");
      result.setData("col",col);
      result.setData("size",size);
     
      List extnm = new ArrayList();
     
      int right = _loadedRect.getRight() - size;
      if(right<col){
        right = col - 1;
      }
      for(int i=col;i<=right;i++){
        extnm.add(getColumntitle(i));
      }
      result.setData("extnm", extnm);
     
      HeaderPositionHelper colHelper = Spreadsheet.this.getColumnPositionHelper(sheet);
      colHelper.unshiftMeta(col,size);
     
     
      _maxColumns -= size;
      int cf = getColumnfreeze();
      if(cf>-1 && col<=cf){
        if(col+size>cf){
          _colFreeze = col-1;
        }else{
          _colFreeze -=size;
        }
      }
     
      result.setData("maxcol", _maxColumns);
      result.setData("colfreeze", _colFreeze);
     
      smartUpdateValues("removerc_"+Utils.nextUpdateId(),new Object[]{"",Utils.getId(sheet),result.toString()});
     
      _loadedRect.setRight(right);
     
      //update surround cell
      int left = col;
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

      //let client handle it
     
      //remove merge before a new column or row
      removeAffectedMergeRange(sheet,1,row);
     
      JSONObj result = new JSONObj();
      result.setData("type","row");
      result.setData("row",row);
      result.setData("size",size);
     
      List extnm = new ArrayList();
     
      int bottom = _loadedRect.getBottom() - size;
      if(bottom<row){
        bottom = row - 1;
      }
      for(int i=row;i<=bottom;i++){
        extnm.add(getRowtitle(i));
      }
      result.setData("extnm", extnm);
     
      HeaderPositionHelper rowHelper = Spreadsheet.this.getRowPositionHelper(sheet);
      rowHelper.unshiftMeta(row,size);
     
     
      _maxRows -= size;
      int rf = getRowfreeze();
      if(rf>-1 && row<=rf){
        if(row+size>rf){
          _rowFreeze = row-1;
        }else{
          _rowFreeze -=size;
        }
      }
     
      result.setData("maxrow", _maxRows);
      result.setData("rowfreeze", _rowFreeze);
     
      smartUpdateValues("removerc_"+Utils.nextUpdateId(),new Object[]{"",Utils.getId(sheet),result.toString()});
     
      _loadedRect.setBottom(bottom);
     
      //update surround cell
      int top = row;
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

      }
      updateCell(sheet,left>0?left-1:0,top>1?top-1:0,right+1,bottom+1);
    }
   
    private void updateMergeCell0(Sheet sheet,MergedRect block,String type){
      JSONObj result = new JSONObj();
      result.setData("type", type);
      result.setData("id", block.getId());
      int left = block.getLeft();
      int top = block.getTop();
      int right = block.getRight();
      int bottom = block.getBottom();
     
      //don't check range to ignore update case,
      //because I still need to sync merge cell data to client side
     
      result.setData("left", left);
      result.setData("top", top);
      result.setData("right", right);
      result.setData("bottom", bottom);
     
      HeaderPositionHelper helper = Spreadsheet.this.getColumnPositionHelper(sheet);
      int w = helper.getStartPixel(block.getRight()+1)-helper.getStartPixel(block.getLeft());
      result.setData("width",w);
     
      smartUpdateValues("merge_"+Utils.nextUpdateId(),new Object[]{"",Utils.getId(sheet),result.toString()});
    }
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

      updateCell(sheet,left>0?left-1:0,top>1?top-1:0,right+1,bottom+1);
     
    }

    public void setColumnWidth(Sheet sheet, int col, int width,int id) {
      JSONObj result = new JSONObj();
      result.setData("type", "column");
      result.setData("column",col);
      result.setData("width",width);
      result.setData("id",id);
      smartUpdateValues("size_col"+col,new Object[]{"",Utils.getId(sheet),result.toString()});
    }
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

      result.setData("id",id);
      smartUpdateValues("size_col"+col,new Object[]{"",Utils.getId(sheet),result.toString()});
    }

    public void setRowHeight(Sheet sheet, int row, int height,int id) {
      JSONObj result = new JSONObj();
      result.setData("type", "row");
      result.setData("row",row);
      result.setData("height",height);
      result.setData("id",id);
      smartUpdateValues("size_row"+row,new Object[]{"",Utils.getId(sheet),result.toString()});
    }
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

    */

  }
 
  private String ackResult(){
    JSONObj jresult = new JSONObj();
    jresult.setData("type","ack");
    return jresult.toString();
  }
View Full Code Here

Examples of org.zkoss.zss.ui.impl.JSONObj

    jresult.setData("type","ack");
    return jresult.toString();
  }
 
  private String ackError(String message){
    JSONObj jresult = new JSONObj();
    jresult.setData("type","error");
    jresult.setData("message",message);
    return jresult.toString();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.