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,27 +47,33 @@ public class Engine implements Jsonizable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void initializeFromJSON(JSONObject o) throws Exception {
|
public void initializeFromJSON(JSONObject o) throws Exception {
|
||||||
JSONArray a = o.getJSONArray("facets");
|
if (o == null) {
|
||||||
int length = a.length();
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < length; i++) {
|
if (o.has("facets") && !o.isNull("facets")) {
|
||||||
JSONObject fo = a.getJSONObject(i);
|
JSONArray a = o.getJSONArray("facets");
|
||||||
String type = fo.has("type") ? fo.getString("type") : "list";
|
int length = a.length();
|
||||||
|
|
||||||
Facet facet = null;
|
for (int i = 0; i < length; i++) {
|
||||||
if ("list".equals(type)) {
|
JSONObject fo = a.getJSONObject(i);
|
||||||
facet = new ListFacet();
|
String type = fo.has("type") ? fo.getString("type") : "list";
|
||||||
} else if ("range".equals(type)) {
|
|
||||||
facet = new RangeFacet();
|
|
||||||
} else if ("text".equals(type)) {
|
|
||||||
facet = new TextSearchFacet();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (facet != null) {
|
Facet facet = null;
|
||||||
facet.initializeFromJSON(_project, fo);
|
if ("list".equals(type)) {
|
||||||
_facets.add(facet);
|
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")) {
|
if (o.has("includeDependent") && !o.isNull("includeDependent")) {
|
||||||
_includeDependent = o.getBoolean("includeDependent");
|
_includeDependent = o.getBoolean("includeDependent");
|
||||||
|
@ -15,7 +15,8 @@ abstract public class EngineDependentOperation extends AbstractOperation {
|
|||||||
|
|
||||||
protected EngineDependentOperation(JSONObject engineConfig) {
|
protected EngineDependentOperation(JSONObject engineConfig) {
|
||||||
_engineConfig = engineConfig;
|
_engineConfig = engineConfig;
|
||||||
_engineConfigString = engineConfig.toString();
|
_engineConfigString = engineConfig == null || engineConfig.length() == 0
|
||||||
|
? null : engineConfig.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Engine createEngine(Project project) throws Exception {
|
protected Engine createEngine(Project project) throws Exception {
|
||||||
@ -25,7 +26,7 @@ abstract public class EngineDependentOperation extends AbstractOperation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected JSONObject getEngineConfig() {
|
protected JSONObject getEngineConfig() {
|
||||||
if (_engineConfig == null) {
|
if (_engineConfig == null && _engineConfigString != null) {
|
||||||
try {
|
try {
|
||||||
_engineConfig = ParsingUtilities.evaluateJsonStringToObject(_engineConfigString);
|
_engineConfig = ParsingUtilities.evaluateJsonStringToObject(_engineConfigString);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
@ -294,7 +294,10 @@ ListFacet.prototype._editChoice = function(choice, choiceDiv) {
|
|||||||
to: text
|
to: text
|
||||||
}])
|
}])
|
||||||
},
|
},
|
||||||
{ cellsChanged: true },
|
{
|
||||||
|
includeEngine: false, // we're really changing all rows, not just the visible ones
|
||||||
|
cellsChanged: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
onDone: function(o) {
|
onDone: function(o) {
|
||||||
var selection = [];
|
var selection = [];
|
||||||
|
@ -186,14 +186,16 @@ Gridworks.update = function(options, onFinallyDone) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Gridworks.postProcess = function(command, params, body, updateOptions, callbacks) {
|
Gridworks.postProcess = function(command, params, body, updateOptions, callbacks) {
|
||||||
|
updateOptions = updateOptions || {};
|
||||||
|
callbacks = callbacks || {};
|
||||||
|
|
||||||
params = params || {};
|
params = params || {};
|
||||||
params.project = theProject.id;
|
params.project = theProject.id;
|
||||||
|
|
||||||
body = body || {};
|
body = body || {};
|
||||||
body.engine = JSON.stringify(ui.browsingEngine.getJSON());
|
if (!("includeEngine" in updateOptions) || updateOptions.includeEngine) {
|
||||||
|
body.engine = JSON.stringify(ui.browsingEngine.getJSON());
|
||||||
updateOptions = updateOptions || {};
|
}
|
||||||
callbacks = callbacks || {};
|
|
||||||
|
|
||||||
var done = false;
|
var done = false;
|
||||||
var dismissBusy = null;
|
var dismissBusy = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user