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:
parent
c4460fdfdd
commit
759824e1b4
@ -47,28 +47,34 @@ public class Engine implements Jsonizable {
|
||||
}
|
||||
|
||||
public void initializeFromJSON(JSONObject o) throws Exception {
|
||||
JSONArray a = o.getJSONArray("facets");
|
||||
int length = a.length();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
JSONObject fo = a.getJSONObject(i);
|
||||
String type = fo.has("type") ? fo.getString("type") : "list";
|
||||
|
||||
Facet facet = null;
|
||||
if ("list".equals(type)) {
|
||||
facet = new ListFacet();
|
||||
} else if ("range".equals(type)) {
|
||||
facet = new RangeFacet();
|
||||
} else if ("text".equals(type)) {
|
||||
facet = new TextSearchFacet();
|
||||
}
|
||||
|
||||
if (facet != null) {
|
||||
facet.initializeFromJSON(_project, fo);
|
||||
_facets.add(facet);
|
||||
}
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (o.has("facets") && !o.isNull("facets")) {
|
||||
JSONArray a = o.getJSONArray("facets");
|
||||
int length = a.length();
|
||||
|
||||
for (int i = 0; i < length; i++) {
|
||||
JSONObject fo = a.getJSONObject(i);
|
||||
String type = fo.has("type") ? fo.getString("type") : "list";
|
||||
|
||||
Facet facet = null;
|
||||
if ("list".equals(type)) {
|
||||
facet = new ListFacet();
|
||||
} else if ("range".equals(type)) {
|
||||
facet = new RangeFacet();
|
||||
} else if ("text".equals(type)) {
|
||||
facet = new TextSearchFacet();
|
||||
}
|
||||
|
||||
if (facet != null) {
|
||||
facet.initializeFromJSON(_project, fo);
|
||||
_facets.add(facet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (o.has("includeDependent") && !o.isNull("includeDependent")) {
|
||||
_includeDependent = o.getBoolean("includeDependent");
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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 = [];
|
||||
|
@ -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 || {};
|
||||
body.engine = JSON.stringify(ui.browsingEngine.getJSON());
|
||||
|
||||
updateOptions = updateOptions || {};
|
||||
callbacks = callbacks || {};
|
||||
if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
|
||||
body.engine = JSON.stringify(ui.browsingEngine.getJSON());
|
||||
}
|
||||
|
||||
var done = false;
|
||||
var dismissBusy = null;
|
||||
|
Loading…
Reference in New Issue
Block a user