Added pre-canned facets isBlank(value) and isError(value).

git-svn-id: http://google-refine.googlecode.com/svn/trunk@196 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-04 07:32:30 +00:00
parent 7487e81a4e
commit 22f226358d
3 changed files with 44 additions and 0 deletions

View File

@ -57,6 +57,7 @@ import com.metaweb.gridworks.gel.controls.ForEach;
import com.metaweb.gridworks.gel.controls.ForNonBlank;
import com.metaweb.gridworks.gel.controls.If;
import com.metaweb.gridworks.gel.controls.IsBlank;
import com.metaweb.gridworks.gel.controls.IsError;
import com.metaweb.gridworks.gel.controls.IsNonBlank;
import com.metaweb.gridworks.gel.controls.IsNotNull;
import com.metaweb.gridworks.gel.controls.IsNull;
@ -169,5 +170,6 @@ public class ControlFunctionRegistry {
registerControl("isBlank", new IsBlank());
registerControl("isNonBlank", new IsNonBlank());
registerControl("isNumeric", new IsNumeric());
registerControl("isError", new IsError());
}
}

View File

@ -0,0 +1,15 @@
package com.metaweb.gridworks.gel.controls;
import com.metaweb.gridworks.expr.ExpressionUtils;
public class IsError extends IsTest {
@Override
protected String getDescription() {
return "Returns whether o is an error";
}
@Override
protected boolean test(Object o) {
return ExpressionUtils.isError(o);
}
}

View File

@ -170,6 +170,33 @@ DataTableColumnHeaderUI.prototype._createMenuForColumnHeader = function(elmt) {
}
);
}
},
{},
{
label: "By Error",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.headerLabel + ": Error?",
"columnName" : self._column.headerLabel,
"expression" : "isError(value)"
}
);
}
},
{
label: "By Blank",
click: function() {
ui.browsingEngine.addFacet(
"list",
{
"name" : self._column.headerLabel + ": Blank?",
"columnName" : self._column.headerLabel,
"expression" : "isBlank(value)"
}
);
}
}
]
},