Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Cell


    Sheet sheet = ((Spreadsheet)comp).getSelectedSheet();
    if(!Utils.getId(sheet).equals(sheetId)){
      return;
    }
   
    Cell cell = sheet.getCell(row,col);
    //You can call getEditText(), setEditText(), getText().
   
    String text = cell==null?"":cell.getEditText();
   
    StartEditingEvent event = new StartEditingEvent(org.zkoss.zss.ui.event.Events.ON_START_EDITING, comp, sheet,row,col,text,clienttxt);
    Events.postEvent(event);
    Events.postEvent(new Event("onStartEditingImpl", comp, new Object[]{token,event}));
  }
View Full Code Here


    }
    return count.toString();
  }
 
  public static Cell getCell(Sheet sheet,int row, int col){
    Cell cell = (Cell)sheet.getCell(row,col);
    if(cell==null){
      sheet.setCellValue(row, col, "");
      cell = (Cell)sheet.getCell(row,col);
    }
    if(cell==null){
View Full Code Here

    return cell;
  }
 
 
  public static void setCellText(Sheet sheet,int row,int col,String value){
    Cell cell = getCell(sheet,row,col);
    if(cell!=null){
      cell.setEditText(value);
    }
  }
View Full Code Here

       prepareRowData(jrow,sheet,i);
       List cells = new ArrayList();
       jrow.setData("cells",cells);
       for(int j=left;j<ce;j++){
         jcell = new JSONObj();
         Cell cell = sheet.getCell(i,j);
         cells.add(jcell);
         prepareCellData(jcell,sheet,i,j);
         if(!_hidecolhead && !filltheader){
           jheader = new JSONObj();
           prepareTopHeaderData(jheader,j);
           theaders.add(jheader);
         }
       }
       filltheader = true;
       if(!_hiderowhead){
         jheader = new JSONObj();
         prepareLeftHeaderData(jheader,i);
         lheaders.add(jheader);
       }
    }
   
    _lastleft = left;
    _lastright = right;
    _lasttop = top;
    _lastbottom = bottom;
   
   
    //prepare top frozen cell
    int fzr = _spreadsheet.getRowfreeze();
    if(fzr>-1){
      JSONObj topFrozen = new JSONObj();
      jresult.setData("topfrozen",topFrozen);
     
      List tfrd = new ArrayList();
     
     
      topFrozen.setData("type","jump");
      topFrozen.setData("dir","jump");
      topFrozen.setData("left",left);
      topFrozen.setData("top",0);
      topFrozen.setData("width",w);
      topFrozen.setData("height",fzr+1);
      topFrozen.setData("data",tfrd);
     
      ce = left+w;
      for(int i=0;i<=fzr;i++){
         jrow = new JSONObj();
         tfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=left;j<ce;j++){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
   
   
    //prepare left frozen cell
    int fzc = _spreadsheet.getColumnfreeze();
    if(fzc>-1){
      JSONObj leftFrozen = new JSONObj();
      jresult.setData("leftfrozen",leftFrozen);
     
      List lfrd = new ArrayList();
     
     
      leftFrozen.setData("type","jump");
      leftFrozen.setData("dir","jump");
      leftFrozen.setData("left",0);
      leftFrozen.setData("top",top);
      leftFrozen.setData("width",fzc+1);
      leftFrozen.setData("height",h);
      leftFrozen.setData("data",lfrd);
     
      re = top+h;
      for(int i=top;i<re;i++){
         jrow = new JSONObj();
         lfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=0;j<=fzc;j++){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
View Full Code Here

       List cells = new ArrayList();

       jrow.setData("cells",cells);
       for(int j=cs;j<ce;j++){
         jcell = new JSONObj(); //cell
         Cell cell = sheet.getCell(i,j);
         cells.add(jcell);
         prepareCellData(jcell,sheet,i,j);
         if(!_hidecolhead && !fillheader){
           jheader = new JSONObj();
           prepareTopHeaderData(jheader,j);
           headers.add(jheader);
         }
        
       }
       fillheader = true;
    }
   
   
    _lastleft = blockLeft;
    _lastright = ce-1;
    _lasttop = blockTop;
    _lastbottom = blockBottom;
   
   
    //process frozen row data
    int fzr = _spreadsheet.getRowfreeze();
    if(fzr>-1){
      JSONObj topFrozen = new JSONObj();
      jresult.setData("topfrozen",topFrozen);
     
      List tfrd = new ArrayList();
     
      topFrozen.setData("type","neighbor");
      topFrozen.setData("dir","east");
      topFrozen.setData("width",fetchWidth);
      topFrozen.setData("height",fzr+1);
      topFrozen.setData("data",tfrd);
     
      for(int i=0;i<=fzr;i++){
         jrow = new JSONObj();
         tfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=cs;j<ce;j++){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
View Full Code Here

       prepareRowData(jrow,sheet,i);
       List cells = new ArrayList();
       jrow.setData("cells",cells);
       for(int j=cs;j>ce;j--){
         jcell = new JSONObj();
         Cell cell = sheet.getCell(i,j);
         cells.add(jcell);
         prepareCellData(jcell,sheet,i,j);
        
         if(!_hidecolhead && !fillheader){
           jheader = new JSONObj();
           prepareTopHeaderData(jheader,j);
           headers.add(jheader);
         }
       }
       fillheader = true;
    }
   
    _lastleft = ce+1;
    _lastright = blockRight;
    _lasttop = blockTop;
    _lastbottom = blockBottom;
   
    //process frozen row data
    int fzr = _spreadsheet.getRowfreeze();
    if(fzr>-1){
      JSONObj topFrozen = new JSONObj();
      jresult.setData("topfrozen",topFrozen);
     
      List tfrd = new ArrayList();
     
      topFrozen.setData("type","neighbor");
      topFrozen.setData("dir","west");
      topFrozen.setData("width",fetchWidth);
      topFrozen.setData("height",fzr+1);
      topFrozen.setData("data",tfrd);
     
      for(int i=0;i<=fzr;i++){
         jrow = new JSONObj();
         tfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=cs;j>ce;j--){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
View Full Code Here

       prepareRowData(jrow,sheet,i);
       List cells = new ArrayList();
       jrow.setData("cells",cells);
       for(int j=blockLeft;j<=blockRight;j++){
         jcell = new JSONObj();
         Cell cell = sheet.getCell(i,j);
         cells.add(jcell);
         prepareCellData(jcell,sheet,i,j);
       }
       if(!_hiderowhead){
         jheader = new JSONObj();
         prepareLeftHeaderData(jheader,i);
         headers.add(jheader);
       }
    }
    _lastleft = blockLeft;
    _lastright = blockRight;
    _lasttop = blockTop;
    _lastbottom = re-1;
   
    //process frozen left
    int fzc = _spreadsheet.getColumnfreeze();
    if(fzc>-1){
      JSONObj leftFrozen = new JSONObj();
      jresult.setData("leftfrozen",leftFrozen);
     
      List lfrd = new ArrayList();
     
      leftFrozen.setData("type","neighbor");
      leftFrozen.setData("dir","south");
      leftFrozen.setData("width",fzc+1);
      leftFrozen.setData("height",fetchHeight);
      leftFrozen.setData("data",lfrd);
     
     
     
      rs = blockBottom+1;
      re = rs+fetchHeight;
     
      for(int i=rs;i<re;i++){
         jrow = new JSONObj();
         lfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=0;j<=fzc;j++){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
View Full Code Here

       prepareRowData(jrow,sheet,i);
       List cells = new ArrayList();
       jrow.setData("cells",cells);
       for(int j=blockLeft;j<=blockRight;j++){
         jcell = new JSONObj();
         Cell cell = sheet.getCell(i,j);
         cells.add(jcell);
         prepareCellData(jcell,sheet,i,j);
       }
       if(!_hiderowhead){
         jheader = new JSONObj();
         prepareLeftHeaderData(jheader,i);
         headers.add(jheader);
       }
    }
    _lastleft = blockLeft;
    _lastright = blockRight;
    _lasttop = re+1;
    _lastbottom = blockBottom;
   
   
    //process frozen left
    int frc = _spreadsheet.getColumnfreeze();
    if(frc>-1){
      JSONObj leftFrozen = new JSONObj();
      jresult.setData("leftfrozen",leftFrozen);
     
      List lfrd = new ArrayList();
     
      leftFrozen.setData("type","neighbor");
      leftFrozen.setData("dir","north");
      leftFrozen.setData("width",frc+1);
      leftFrozen.setData("height",fetchHeight);
      leftFrozen.setData("data",lfrd);
     
     
     
      rs = blockTop-1;
      re = rs-fetchHeight;
     
      for(int i=rs;i>re;i--){
         jrow = new JSONObj();
         lfrd.add(jrow);
         prepareRowData(jrow,sheet,i);
         List cells = new ArrayList();
         jrow.setData("cells",cells);
         for(int j=0;j<=frc;j++){
           jcell = new JSONObj(); //cell
           Cell cell = sheet.getCell(i,j);
           cells.add(jcell);
           prepareCellData(jcell,sheet,i,j);
         }
      }
    }
View Full Code Here

 
  private void prepareCellData(JSONObj jcell, Sheet sheet,int row,int col) {

    jcell.setData("ix", col);// index
   
    Cell cell = sheet.getCell(row, col);
   
    if (cell != null) {

      Format format = cell.getFormat();
      boolean wrap = false;
     
      CellFormatHelper cfh = new CellFormatHelper(sheet,row,col,_mergeMatrix);
      String st = cfh.getHtmlStyle();
      String ist = cfh.getInnerHtmlStyle();
      if (st != null && !"".equals(st)){
        jcell.setData("st", st);// style of text cell.
      }
      if (ist != null && !"".equals(ist)){
        jcell.setData("ist", ist);// inner style of text cell
      }
      if (format!=null && format.isTextWrap()){
        wrap = format.isTextWrap();
        jcell.setData("wrap", true);//warp
      }
      if (cfh.hasRightBorder()){
        jcell.setData("rbo",true);//right border, when processing text overflow, must take care this.
      }
     
      String txt = null;
      if (cell != null) {
        txt = cell.getText();
      }
     
      jcell.setData("txt", txt==null?"":Utils.escapeCellText(txt,wrap,wrap));
     
      TextHAlign textHAlign = cell.getTextHAlign();
      if (textHAlign != null) {
        if (textHAlign.equals(TextHAlign.RIGHT)) {
          jcell.setData("hal","r");
        } else if (textHAlign.equals(TextHAlign.CENTER)) {
          jcell.setData("hal","c");
View Full Code Here

    }
    return format;
  }
 
  public static void setFontColor(Sheet sheet,int row,int col,String color){
    Cell cell = Utils.getCell(sheet,row,col);
    if(cell!=null){
      Format format = cloneCellFormat(cell);
      if(format instanceof FormatImpl){
        ((FormatImpl)format).setFontColor(color);
        cell.setFormat(format);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.zkoss.zss.model.Cell

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.