Add logic for new customized facets
This commit is contained in:
parent
14e49d0099
commit
64b01a2319
@ -141,6 +141,7 @@ import com.google.refine.grel.controls.ForRange;
|
|||||||
import com.google.refine.grel.controls.If;
|
import com.google.refine.grel.controls.If;
|
||||||
import com.google.refine.grel.controls.IsBlank;
|
import com.google.refine.grel.controls.IsBlank;
|
||||||
import com.google.refine.grel.controls.IsError;
|
import com.google.refine.grel.controls.IsError;
|
||||||
|
import com.google.refine.grel.controls.IsEmptyString;
|
||||||
import com.google.refine.grel.controls.IsNonBlank;
|
import com.google.refine.grel.controls.IsNonBlank;
|
||||||
import com.google.refine.grel.controls.IsNotNull;
|
import com.google.refine.grel.controls.IsNotNull;
|
||||||
import com.google.refine.grel.controls.IsNull;
|
import com.google.refine.grel.controls.IsNull;
|
||||||
@ -305,6 +306,7 @@ public class ControlFunctionRegistry {
|
|||||||
|
|
||||||
registerControl("isNull", new IsNull());
|
registerControl("isNull", new IsNull());
|
||||||
registerControl("isNotNull", new IsNotNull());
|
registerControl("isNotNull", new IsNotNull());
|
||||||
|
registerControl("isEmptyString", new IsEmptyString());
|
||||||
registerControl("isBlank", new IsBlank());
|
registerControl("isBlank", new IsBlank());
|
||||||
registerControl("isNonBlank", new IsNonBlank());
|
registerControl("isNonBlank", new IsNonBlank());
|
||||||
registerControl("isNumeric", new IsNumeric());
|
registerControl("isNumeric", new IsNumeric());
|
||||||
|
14
main/src/com/google/refine/grel/controls/IsEmptyString.java
Normal file
14
main/src/com/google/refine/grel/controls/IsEmptyString.java
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
package com.google.refine.grel.controls;
|
||||||
|
|
||||||
|
public class IsEmptyString extends IsTest {
|
||||||
|
@Override
|
||||||
|
protected String getDescription() {
|
||||||
|
return "Returns whether o is an empty string";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean test(Object o) {
|
||||||
|
return o != null && o.getClass().equals(String.class)
|
||||||
|
&& o.equals("");
|
||||||
|
}
|
||||||
|
}
|
@ -246,15 +246,29 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "core/blank-facet",
|
id: "core/null-facet",
|
||||||
label: $.i18n._('core-views')["facet-blank"],
|
label: $.i18n._('core-views')["facet-null"],
|
||||||
click: function() {
|
click: function() {
|
||||||
ui.browsingEngine.addFacet(
|
ui.browsingEngine.addFacet(
|
||||||
"list",
|
"list",
|
||||||
{
|
{
|
||||||
"name": column.name,
|
"name": column.name,
|
||||||
"columnName": column.name,
|
"columnName": column.name,
|
||||||
"expression": "isBlank(value)"
|
"expression": "isNull(value)"
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "core/empty-string-facet",
|
||||||
|
label: $.i18n._('core-views')["facet-empty-string"],
|
||||||
|
click: function() {
|
||||||
|
ui.browsingEngine.addFacet(
|
||||||
|
"list",
|
||||||
|
{
|
||||||
|
"name": column.name,
|
||||||
|
"columnName": column.name,
|
||||||
|
"expression": "isEmptyString(value)"
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user