1 package autotest.common.table; 2 3 import com.google.gwt.json.client.JSONObject; 4 import com.google.gwt.json.client.JSONValue; 5 6 public abstract class FieldFilter extends Filter { 7 protected String fieldName; 8 protected boolean isExactMatch = true; 9 FieldFilter(String fieldName)10 public FieldFilter(String fieldName) { 11 this.fieldName = fieldName; 12 } 13 setExactMatch(boolean exactMatch)14 public void setExactMatch(boolean exactMatch) { 15 isExactMatch = exactMatch; 16 } 17 getMatchValue()18 public abstract JSONValue getMatchValue(); 19 20 @Override addParams(JSONObject params)21 public void addParams(JSONObject params) { 22 String queryField = fieldName; 23 if (!isExactMatch) { 24 queryField += "__icontains"; 25 } 26 params.put(queryField, getMatchValue()); 27 } 28 } 29