use of com.qcadoo.view.internal.components.grid.GridComponentMultiSearchFilterRule in project qcadoo by qcadoo.
the class GridComponentMultiSearchFilter method addRule.
public void addRule(final String field, final String operator, final String data) {
GridComponentFilterOperator filterOperator = resolveOperator(operator);
rules.add(new GridComponentMultiSearchFilterRule(field, filterOperator, data));
}
use of com.qcadoo.view.internal.components.grid.GridComponentMultiSearchFilterRule in project qcadoo by qcadoo.
the class GridComponentMultiSearchFilter method toJson.
public JSONObject toJson() throws JSONException {
if (groupOperator != null && !rules.isEmpty()) {
JSONObject jsonObject = new JSONObject();
jsonObject.put(JSON_GROUP_OPERATOR_FIELD, groupOperator.getValue());
JSONArray jsonRules = new JSONArray();
for (GridComponentMultiSearchFilterRule rule : rules) {
JSONObject jsonRule = new JSONObject();
jsonRule.put(GridComponentMultiSearchFilterRule.JSON_FIELD_FIELD, rule.getField());
jsonRule.put(GridComponentMultiSearchFilterRule.JSON_OPERATOR_FIELD, rule.getFilterOperator().getValue());
jsonRule.put(GridComponentMultiSearchFilterRule.JSON_DATA_FIELD, rule.getData());
jsonRules.put(jsonRule);
}
jsonObject.put(JSON_RULES_FIELD, jsonRules);
return jsonObject;
}
return null;
}
Aggregations