Bug fix: editing one facet choice while some other choices are selected resulted in no change.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@429 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-08 22:16:12 +00:00
parent c4460fdfdd
commit 759824e1b4
4 changed files with 41 additions and 29 deletions

View File

@ -47,6 +47,11 @@ public class Engine implements Jsonizable {
}
public void initializeFromJSON(JSONObject o) throws Exception {
if (o == null) {
return;
}
if (o.has("facets") && !o.isNull("facets")) {
JSONArray a = o.getJSONArray("facets");
int length = a.length();
@ -68,6 +73,7 @@ public class Engine implements Jsonizable {
_facets.add(facet);
}
}
}
if (o.has("includeDependent") && !o.isNull("includeDependent")) {
_includeDependent = o.getBoolean("includeDependent");

View File

@ -15,7 +15,8 @@ abstract public class EngineDependentOperation extends AbstractOperation {
protected EngineDependentOperation(JSONObject engineConfig) {
_engineConfig = engineConfig;
_engineConfigString = engineConfig.toString();
_engineConfigString = engineConfig == null || engineConfig.length() == 0
? null : engineConfig.toString();
}
protected Engine createEngine(Project project) throws Exception {
@ -25,7 +26,7 @@ abstract public class EngineDependentOperation extends AbstractOperation {
}
protected JSONObject getEngineConfig() {
if (_engineConfig == null) {
if (_engineConfig == null && _engineConfigString != null) {
try {
_engineConfig = ParsingUtilities.evaluateJsonStringToObject(_engineConfigString);
} catch (JSONException e) {

View File

@ -294,7 +294,10 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
to: text
}])
},
{ cellsChanged: true },
{
includeEngine: false, // we're really changing all rows, not just the visible ones
cellsChanged: true
},
{
onDone: function(o) {
var selection = [];

View File

@ -186,14 +186,16 @@ Gridworks.update = function(options, onFinallyDone) {
};
Gridworks.postProcess = function(command, params, body, updateOptions, callbacks) {
updateOptions = updateOptions || {};
callbacks = callbacks || {};
params = params || {};
params.project = theProject.id;
body = body || {};
if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
body.engine = JSON.stringify(ui.browsingEngine.getJSON());
updateOptions = updateOptions || {};
callbacks = callbacks || {};
}
var done = false;
var dismissBusy = null;