Package org.zkoss.zss.engine.impl

Examples of org.zkoss.zss.engine.impl.CellRefImpl


    final int sb = Math.min(s1,s2);
    final int se = Math.max(s1,s2);
    for (int s = sb; s <= se; ++s) {
      final Worksheet sht = book.getWorksheetAt(s);
      final RefSheet refSht = BookHelper.getOrCreateRefBook(book).getOrCreateRefSheet(sht.getSheetName());
      addRef(new CellRefImpl(row, col, refSht));
    }
  }
View Full Code Here


        final RefAddr refAddr = new RefAddr(ntop, nleft, nbottom, nright);
        if (refMap.containsKey(refAddr)) { //same area there, next
          continue;
        }
        final Ref newRef = (nleft == nright && ntop == nbottom) ?
          new CellRefImpl(ntop, nleft, refSheet) :
          new AreaRefImpl(ntop, nleft, nbottom, nright, refSheet);
        nrefs.add(newRef);
        refMap.put(refAddr, newRef);
      }
      if (nrefs.isEmpty()) {
View Full Code Here

    return opResult;
  }
 
  protected CellRefImpl prepareSrcRef(OperationEvaluationContext ec) {
    final XelContext ctx = XelContextHolder.getXelContext();
    CellRefImpl srcRef = null;
    boolean isOld = false;
    final String srcSheetName = ec.getSheetName();
    final int srcRow = ec.getRowIndex();
    final int srcCol = ec.getColumnIndex();
    final RefBook srcRefBook = BookHelper.getOrCreateRefBook(_book);
    final RefSheet srcRefSheet = srcRefBook.getOrCreateRefSheet(srcSheetName);
    if (ctx != null) {
      final String srcRefKey = srcRefBook.getBookName()+"]"+srcSheetName+"!"+new CellReference(srcRow, srcCol).formatAsString();
      final Object[] refs = (Object[]) ctx.getAttribute(srcRefKey);
      if (refs != null) {
        srcRef = (CellRefImpl) refs[0];
        isOld = ((Boolean)refs[1]).booleanValue();
      } else {
        srcRef = (CellRefImpl) srcRefSheet.getRef(srcRow, srcCol, srcRow, srcCol);
        if (srcRef == null) { // a new evaluated one
          srcRef = (CellRefImpl) srcRefSheet.getOrCreateRef(srcRow, srcCol, srcRow, srcCol);
        } else {
          isOld = !srcRef.getPrecedents().isEmpty();
        }
        ctx.setAttribute(srcRefKey, new Object[] {srcRef, Boolean.valueOf(isOld)});
      }
      if (isOld) { //an old src ref, no need to add dependency
        return null;
View Full Code Here

        }
      } else if (ptg instanceof AreaPtgBase || ptg instanceof RefPtgBase) {
        precedents.add(ptg);
      }
    }
    final CellRefImpl srcRef = prepareSrcRef(ec);
    if (srcRef != null) {
      if (withIndirect) {
        srcRef.setWithIndirectPrecedent(true); //src ref with indirect precedent will always be evaluated, no need to handle other reference
        return;
      }
      for(Ptg ptg : precedents) {
        final WorkbookEvaluator evaluator = ec.getWorkbookEvaluator();
        final ValueEval opResult = evaluator.getEvalForPtg(ptg, ec);
View Full Code Here

TOP

Related Classes of org.zkoss.zss.engine.impl.CellRefImpl

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.