Package org.zkoss.zss.model

Examples of org.zkoss.zss.model.Sheet


  }
 
 
  private String getSheetDefaultRules(){
   
    Sheet sheet = getSelectedSheet();

    HeaderPositionHelper colHelper = this.getColumnPositionHelper(sheet);
    HeaderPositionHelper rowHelper = this.getRowPositionHelper(sheet);
    MergeMatrixHelper mmhelper = this.getMergeMatrixHelper(sheet);
   
View Full Code Here


  }
 
  private void doInvalidate(){
    //reset
    _loadedRect.set(-1,-1,-1,-1);
    Sheet sheet = getSelectedSheet();
   
   
    clearHeaderSizeHelper(true,true);
    //remove this, beacuse invalidate will cause client side rebuild,
    //i must reinitial size helper since there are maybe some customized is from client.
View Full Code Here

    return getBottom() - getTop() + 1;
  }
 
  public Collection getCells() {
    final List list = new LinkedList();
    final Sheet sheetTo = getSheetTo();
    if (sheetTo != null) { //3d range
      final Book book = getSheet().getBook();
      final Sheet sheetFrom = getSheet();
      boolean start = false;
      boolean stop = false;
      for(final Iterator it = book.getSheets().iterator(); it.hasNext() && !stop;) {
        final Sheet sheet = (Sheet) it.next();
        if (sheet == sheetFrom) {
          start = true;
        } else if (sheet == sheetTo) {
          stop = true;
        }
View Full Code Here

    }
  }
 
  public Cell[][][] getCellsArray() {
    final Book book = getSheet().getBook();
    final Sheet sheetTo = getSheetTo();
    Cell[][][] cella = null;
    int startj = -1;
    if (sheetTo != null) { //3d range
      final Sheet sheetFrom = getSheet();
      int j = 0;
      int endj = -1;
      for(final Iterator it = book.getSheets().iterator(); it.hasNext(); ++j) {
        final Sheet sheet = (Sheet) it.next();
        if (sheet == sheetFrom) {
          startj = j;
        } else if (sheet == sheetTo) {
          endj = j;
          break;
        }
      }
      if (startj < 0 || endj < 0) { //reach sheetTo first, reverse sequence.
        throw new SSErrorXelException(SSError.REF);
      }
      final int sheetsz = endj - startj + 1;
      cella = new Cell[sheetsz][][];
     
    } else { //2d range
      startj = 0;
      cella = new Cell[1][][];
    }
    final int sheetsz = cella.length;
    final int top = getTop();
    final int left = getLeft();
    final int rowsz = getBottom() - top + 1;
    final int colsz = getRight() - left + 1;
    int sj = 0;
    for (final ListIterator it = book.getSheets().listIterator(startj); it.hasNext() && sj < sheetsz; ++sj) {
      final Sheet sheet = (Sheet) it.next();
      cella[sj] = new Cell[rowsz][];
      for (int rj = 0; rj < rowsz; ++rj) {
        cella[sj][rj] = new Cell[colsz];
        for (int cj = 0; cj < colsz; ++cj) {
          cella[sj][rj][cj] = sheet.getCell(top+rj, left+cj);
        }
      }
    }
    return cella;
  }
View Full Code Here

    if ((dstRowSize % srcRowSize) != 0 || (dstColSize % srcColSize) != 0) {
      dstRowSize = srcRowSize;
      dstColSize = srcColSize;
    }
   
    final Sheet srcSheet = getSheet();
    final Sheet dstSheet = dst.getSheet();

    //prepare copy direction
    int rb, re, rs, cb, ce, cs;
    if (dstTop > srcTop) {
      rb = dstRowSize - 1;
      re = -1;
      rs = -1;
    } else {
      rb = 0;
      re = dstRowSize;
      rs = 1;
    }
   
    if (dstLeft > srcLeft) {
      cb = dstColSize - 1;
      ce = -1;
      cs = -1;
    } else {
      cb = 0;
      ce = dstColSize;
      cs = 1;
    }
     
    for(int r = rb; r != re; r += rs) {
      for(int c = cb; c != ce; c += cs) {
        final Cell srcCell = srcSheet.getCell((r % srcRowSize) + srcTop, (c % srcColSize) + srcLeft);
        final int dstr = r+dstTop;
        final int dstc = c+dstLeft;
        if (srcCell == null) {
          dstSheet.removeCell(dstr, dstc);
        } else {
          dstSheet.copyCell(srcCell, dstr, dstc);
        }
      }
    }
  }
View Full Code Here

  public void unmerge() {
    ((SheetImpl)getSheet()).unmergeCells(getLeft(), getTop(), getRight(), getBottom());
  }
 
  public int hashCode() {
    final Sheet sheet = getSheet();
    final Sheet sheetTo = getSheetTo();
    return (sheet == null ? 0 : sheet.hashCode())
      ^ (sheetTo == null ? 0 : sheetTo.hashCode())
      ^ getLeft() ^ getTop() ^ getRight() ^ getBottom();
  }
View Full Code Here

  }
 
  private Range getRange(Object opn1, Object opn2, XelContext ctx) {
    final Range rng1 = (Range) opn1;
    final Range rng2 = (Range) opn2;
    final Sheet sheet1 = rng1.getSheet();
    if (sheet1 != rng2.getSheet()) {
      throw new SSErrorXelException(SSError.VALUE);
    }
    final int left = rngmin(rng1.getLeft(), rng2.getLeft());
    final int top = rngmin(rng1.getTop(), rng2.getTop());
View Full Code Here

  }
 
  private Range getIntersect(Object opn1, Object opn2, XelContext ctx) {
    final Range rng1 = (Range) opn1;
    final Range rng2 = (Range) opn2;
    final Sheet sheet1 = rng1.getSheet();
    if (sheet1 != rng2.getSheet()) {
      throw new SSErrorXelException(SSError.VALUE);
    }
    final int left = rngmax(rng1.getLeft(), rng2.getLeft());
    final int top = rngmax(rng1.getTop(), rng2.getTop());
View Full Code Here

      return SSError.REF.toString();
    }
    final StringBuffer sb = new StringBuffer(32);
    final VariableResolver resolver = ctx.getVariableResolver();
    final Reference ref = (Reference) resolver.resolveVariable("zkoss.ss.Ref");
    final Sheet orgsheet = ref.getSheet();
    final Book orgbook = orgsheet.getBook();
   
    final Sheet sheet = cell.getSheet();
    final Book book = sheet.getBook();
    if (book != orgbook) {
      sb.append("[").append(book.getName()).append("]");
    }
    if (sheet != orgsheet) {
      sb.append(sheet.getName()+"!");
    }
    return sb.append(Indexes.toA1(cell.getRow(), cell.getColumn(), absrow, abscol)).toString();
  }
View Full Code Here

      return SSError.REF.toString();
    }
    final StringBuffer sb = new StringBuffer(32);
    final VariableResolver resolver = ctx.getVariableResolver();
    final Reference ref = (Reference) resolver.resolveVariable("zkoss.ss.Ref");
    final Sheet orgsheet = ref.getSheet();
    final Book orgbook = orgsheet.getBook();
   
    final Sheet sheet = rng.getSheet();
    final Sheet sheetTo = rng.getSheetTo();
    final Book book = sheet.getBook();
    if (book != orgbook) {
      sb.append("[").append(book.getName()).append("]");
    }
    if (sheet != orgsheet) {
      sb.append(sheet.getName());
      if (sheetTo != null) {
        sb.append(":").append(sheetTo.getName());
      }
      sb.append("!");
    }
    return sb.append(Indexes.toA1(rng.getTop(), rng.getLeft(), rng.isTopAbsolute(), rng.isLeftAbsolute()))
        .append(":")
View Full Code Here

TOP

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

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.