X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.spreadsheet.graph%2Fsrc%2Forg%2Fsimantics%2Fspreadsheet%2Fgraph%2FSpreadsheetBook.java;h=d64d008edf713b1cfaf33a3e0fe28261bf188447;hp=f87ce4d0675e851fee84a432d093241f38245607;hb=5915c1bbd6d0c6125aa3c815c7843339190f28e4;hpb=1251d640abb698a4018ef1ea212f8cdf78befaaf diff --git a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java index f87ce4d06..d64d008ed 100644 --- a/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java +++ b/bundles/org.simantics.spreadsheet.graph/src/org/simantics/spreadsheet/graph/SpreadsheetBook.java @@ -6,9 +6,11 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; import org.simantics.databoard.Bindings; import org.simantics.databoard.binding.Binding; @@ -365,7 +367,26 @@ public class SpreadsheetBook implements StandardNodeManagerSupport, S v.visit(this); } - public List invalidate(SpreadsheetCell cell) { + //Recursively find all SpreadsheetCells, invalidate them and return them all as a set + public Set invalidate(SpreadsheetCell cell) { + Set result = new HashSet<>(); + result.add(cell); + cell.invalidate(); + long refKey = cell.makeReferenceKey(); + AbstractLongSet refs = referenceMap.remove(refKey); + if(refs == null) return result; + for(long ref : refs) { + long sheet = ref >> 40; + long row = (ref >> 20) & 0xFFFFF; + long col = (ref) & 0xFFFFF; + SpreadsheetCell referer = get(sheets.get((int)sheet), (int)row, (int)col); + result.addAll(invalidate(referer)); + } + return result; + } + + @Deprecated + public List invalidateShallow(SpreadsheetCell cell) { ArrayList result = new ArrayList<>(); result.add(cell); cell.invalidate();