Fixed Issue 2: Undo History bug. The MassChange class didn't write out each elemental change's class and so they couldn't be read back in.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@719 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-12 06:35:01 +00:00
parent 59ab6c0a78
commit 992cb964eb
2 changed files with 10 additions and 6 deletions

View File

@ -50,7 +50,7 @@ public class History implements Jsonizable {
return (Change) load.invoke(null, reader, pool);
}
static public void writeOneChange(OutputStream out, Change change, Pool pool) throws Exception {
static public void writeOneChange(OutputStream out, Change change, Pool pool) throws IOException {
Writer writer = new OutputStreamWriter(out);
try {
History.writeOneChange(writer, change, pool);
@ -59,14 +59,18 @@ public class History implements Jsonizable {
}
}
static public void writeOneChange(Writer writer, Change change, Pool pool) throws Exception {
writer.write(Gridworks.getVersion()); writer.write('\n');
writer.write(change.getClass().getName()); writer.write('\n');
static public void writeOneChange(Writer writer, Change change, Pool pool) throws IOException {
Properties options = new Properties();
options.setProperty("mode", "save");
options.put("pool", pool);
writeOneChange(writer, change, options);
}
static public void writeOneChange(Writer writer, Change change, Properties options) throws IOException {
writer.write(Gridworks.getVersion()); writer.write('\n');
writer.write(change.getClass().getName()); writer.write('\n');
change.save(writer, options);
}

View File

@ -49,7 +49,7 @@ public class MassChange implements Change {
writer.write("updateRowContextDependencies="); writer.write(Boolean.toString(_updateRowContextDependencies)); writer.write('\n');
writer.write("changeCount="); writer.write(Integer.toString(_changes.size())); writer.write('\n');
for (Change c : _changes) {
c.save(writer, options);
History.writeOneChange(writer, c, options);
}
writer.write("/ec/\n"); // end of change marker
}