Added options for omitting error and blank choices in list facets, and use them in the various recon facets.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@227 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
694f09fb0a
commit
80e6111a92
@ -16,9 +16,15 @@ import com.metaweb.gridworks.browsing.filters.RowFilter;
|
|||||||
import com.metaweb.gridworks.expr.Evaluable;
|
import com.metaweb.gridworks.expr.Evaluable;
|
||||||
import com.metaweb.gridworks.expr.MetaParser;
|
import com.metaweb.gridworks.expr.MetaParser;
|
||||||
import com.metaweb.gridworks.model.Project;
|
import com.metaweb.gridworks.model.Project;
|
||||||
|
import com.metaweb.gridworks.util.JSONUtilities;
|
||||||
|
|
||||||
public class ListFacet implements Facet {
|
public class ListFacet implements Facet {
|
||||||
protected List<NominalFacetChoice> _selection = new LinkedList<NominalFacetChoice>();
|
protected List<NominalFacetChoice> _selection = new LinkedList<NominalFacetChoice>();
|
||||||
|
|
||||||
|
// If true, then facet won't show the blank and error choices
|
||||||
|
protected boolean _omitBlank;
|
||||||
|
protected boolean _omitError;
|
||||||
|
|
||||||
protected boolean _selectBlank;
|
protected boolean _selectBlank;
|
||||||
protected boolean _selectError;
|
protected boolean _selectError;
|
||||||
|
|
||||||
@ -50,14 +56,14 @@ public class ListFacet implements Facet {
|
|||||||
}
|
}
|
||||||
writer.endArray();
|
writer.endArray();
|
||||||
|
|
||||||
if (_selectBlank || _blankCount > 0) {
|
if (!_omitBlank && (_selectBlank || _blankCount > 0)) {
|
||||||
writer.key("blankChoice");
|
writer.key("blankChoice");
|
||||||
writer.object();
|
writer.object();
|
||||||
writer.key("s"); writer.value(_selectBlank);
|
writer.key("s"); writer.value(_selectBlank);
|
||||||
writer.key("c"); writer.value(_blankCount);
|
writer.key("c"); writer.value(_blankCount);
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
}
|
}
|
||||||
if (_selectError || _errorCount > 0) {
|
if (!_omitError && (_selectError || _errorCount > 0)) {
|
||||||
writer.key("errorChoice");
|
writer.key("errorChoice");
|
||||||
writer.object();
|
writer.object();
|
||||||
writer.key("s"); writer.value(_selectError);
|
writer.key("s"); writer.value(_selectError);
|
||||||
@ -98,12 +104,11 @@ public class ListFacet implements Facet {
|
|||||||
_selection.add(nominalFacetChoice);
|
_selection.add(nominalFacetChoice);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (o.has("selectBlank")) {
|
_omitBlank = JSONUtilities.getBoolean(o, "omitBlank", false);
|
||||||
_selectBlank = o.getBoolean("selectBlank");
|
_omitError = JSONUtilities.getBoolean(o, "omitError", false);
|
||||||
}
|
|
||||||
if (o.has("selectError")) {
|
_selectBlank = JSONUtilities.getBoolean(o, "selectBlank", false);
|
||||||
_selectError = o.getBoolean("selectError");
|
_selectError = JSONUtilities.getBoolean(o, "selectError", false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RowFilter getRowFilter() {
|
public RowFilter getRowFilter() {
|
||||||
|
@ -130,6 +130,7 @@ public class ReconOperation extends EngineDependentOperation {
|
|||||||
writer.key("name"); writer.value(_columnName + ": judgment");
|
writer.key("name"); writer.value(_columnName + ": judgment");
|
||||||
writer.key("columnName"); writer.value(_columnName);
|
writer.key("columnName"); writer.value(_columnName);
|
||||||
writer.key("expression"); writer.value("cell.recon.judgment");
|
writer.key("expression"); writer.value("cell.recon.judgment");
|
||||||
|
writer.key("omitError"); writer.value(true);
|
||||||
writer.endObject();
|
writer.endObject();
|
||||||
writer.key("facetOptions");
|
writer.key("facetOptions");
|
||||||
writer.object();
|
writer.object();
|
||||||
|
@ -38,6 +38,8 @@ ListFacet.prototype.getJSON = function() {
|
|||||||
name: this._config.name,
|
name: this._config.name,
|
||||||
columnName: this._config.columnName,
|
columnName: this._config.columnName,
|
||||||
expression: this._config.expression,
|
expression: this._config.expression,
|
||||||
|
omitBlank: "omitBlank" in this._config ? this._config.omitBlank : false,
|
||||||
|
omitError: "omitError" in this._config ? this._config.omitError : false,
|
||||||
selection: [],
|
selection: [],
|
||||||
selectBlank: this._blankChoice != null && this._blankChoice.s,
|
selectBlank: this._blankChoice != null && this._blankChoice.s,
|
||||||
selectError: this._errorChoice != null && this._errorChoice.s
|
selectError: this._errorChoice != null && this._errorChoice.s
|
||||||
|
@ -301,7 +301,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
|||||||
{
|
{
|
||||||
"name" : self._column.name + ": judgment",
|
"name" : self._column.name + ": judgment",
|
||||||
"columnName" : self._column.name,
|
"columnName" : self._column.name,
|
||||||
"expression" : "cell.recon.judgment"
|
"expression" : "cell.recon.judgment",
|
||||||
|
"omitError" : true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scroll" : false
|
"scroll" : false
|
||||||
@ -334,7 +335,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
|||||||
{
|
{
|
||||||
"name" : self._column.name + ": best candidate's type match",
|
"name" : self._column.name + ": best candidate's type match",
|
||||||
"columnName" : self._column.name,
|
"columnName" : self._column.name,
|
||||||
"expression" : "cell.recon.features.typeMatch"
|
"expression" : "cell.recon.features.typeMatch",
|
||||||
|
"omitError" : true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scroll" : false
|
"scroll" : false
|
||||||
@ -350,7 +352,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
|||||||
{
|
{
|
||||||
"name" : self._column.name + ": best candidate's name match",
|
"name" : self._column.name + ": best candidate's name match",
|
||||||
"columnName" : self._column.name,
|
"columnName" : self._column.name,
|
||||||
"expression" : "cell.recon.features.nameMatch"
|
"expression" : "cell.recon.features.nameMatch",
|
||||||
|
"omitError" : true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"scroll" : false
|
"scroll" : false
|
||||||
@ -400,7 +403,8 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
|
|||||||
{
|
{
|
||||||
"name" : self._column.name + ": best candidate's types",
|
"name" : self._column.name + ": best candidate's types",
|
||||||
"columnName" : self._column.name,
|
"columnName" : self._column.name,
|
||||||
"expression" : "cell.recon.best.type"
|
"expression" : "cell.recon.best.type",
|
||||||
|
"omitError" : true
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user