Uploaded image for project: 'ZK Spreadsheet'
  1. ZK Spreadsheet
  2. ZSS-957

setCellStyle() should not clears a formula result cache

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 3.8.0
    • 3.8.0
    • None
    • Security Level: Jimmy
    • None

      Steps to Reproduce

      1. run zss with 3.8.0.FL.20150309-Eval
      2. set cell style with the code below:
        		Range selection = Ranges.range(ss.getSelectedSheet(), ss.getSelection());
        		CellStyle oldStyle = selection.getCellStyle();
        		EditableCellStyle newStyle = selection.getCellStyleHelper().createCellStyle(oldStyle);
        		newStyle.setBorderBottom(BorderType.THIN);
        		selection.setCellStyle(newStyle);
        

      Actual Result

      The stack trace shows that the API clears the formula result cache and triggers a formula re-evaluation.

      org.zkoss.zss.model.impl.CellImpl.clearFormulaResultCache() line: 264     
      org.zkoss.zss.model.impl.FormulaCacheClearHelper.handleAreaRef(org.zkoss.zss.model.sys.dependency.Ref) line: 119     
      org.zkoss.zss.model.impl.FormulaCacheClearHelper.clear(java.util.Set<org.zkoss.zss.model.sys.dependency.Ref>) line: 41     
      org.zkoss.zss.model.impl.FormulaCacheCleaner.clear(java.util.Set<org.zkoss.zss.model.sys.dependency.Ref>) line: 36     
      org.zkoss.zss.model.impl.FormulaCacheCleaner.clearByPrecedent(org.zkoss.zss.model.sys.dependency.Ref) line: 44     
      org.zkoss.zss.range.impl.RangeImpl.notifyChangeInLock(boolean, org.zkoss.zss.model.impl.CellAttribute) line: 602     
      org.zkoss.zss.range.impl.RangeImpl.access$1200(org.zkoss.zss.range.impl.RangeImpl, boolean, org.zkoss.zss.model.impl.CellAttribute) line: 101     
      org.zkoss.zss.range.impl.RangeImpl$20.invoke() line: 948     
      org.zkoss.zss.range.impl.RangeImpl$20(org.zkoss.zss.model.util.ReadWriteTask).doInWriteLock(java.util.concurrent.locks.ReadWriteLock) line: 43     
      org.zkoss.zss.range.impl.RangeImpl.setCellStyle(org.zkoss.zss.model.SCellStyle) line: 942     
      org.zkoss.zss.api.impl.RangeImpl.setCellStyle(org.zkoss.zss.api.model.CellStyle) line: 230     
      

      Expected Result

      For ZSS-939, changing a style should not trigger a formula re-evaluation.

      Debug Information

      • CellOperationUtil.applyBorder() doesn't trigger formulat re-evaluation.
        				CellOperationUtil.applyBorder(	b1
        					, org.zkoss.zss.api.Range.ApplyBorderType.FULL
        					, org.zkoss.zss.api.model.CellStyle.BorderType.THIN
        					, "#FF00FF");
        
      • Although setCellStyle() triggers a formula re-evaluation, it doesn't re-render the cell being changed. This behavior can only be observed by setting break points in a debugger.

            henrichen henrichen
            hawk hawk
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: