From 2846d6626147e99205a29b0163e8703a35980036 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Tue, 23 Mar 2010 03:19:17 +0000 Subject: [PATCH] Detect max cell index on load, just in case the max cell index we've stored previously was out of whack. git-svn-id: http://google-refine.googlecode.com/svn/trunk@341 7d457c2a-affb-35e4-300a-418c747d4874 --- src/main/java/com/metaweb/gridworks/model/Project.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/metaweb/gridworks/model/Project.java b/src/main/java/com/metaweb/gridworks/model/Project.java index 623cf8c33..e7c33b4d7 100644 --- a/src/main/java/com/metaweb/gridworks/model/Project.java +++ b/src/main/java/com/metaweb/gridworks/model/Project.java @@ -178,6 +178,7 @@ public class Project { /* String version = */ reader.readLine(); Project project = new Project(id); + int maxCellCount = 0; String line; while ((line = reader.readLine()) != null) { @@ -195,11 +196,15 @@ public class Project { int count = Integer.parseInt(value); for (int i = 0; i < count; i++) { - project.rows.add(Row.load(reader.readLine())); + Row row = Row.load(reader.readLine()); + project.rows.add(row); + + maxCellCount = Math.max(maxCellCount, row.cells.size()); } } } + project.columnModel.setMaxCellIndex(maxCellCount - 1); project.recomputeRowContextDependencies(); return project;