System.out.println("Got some search record results JSON");
JSONValue val = JSONParser.parseStrict(response.getText());
JSONObject ob = val.isObject();
JSONValue value = null;
value = ob.get("records");
JSONArray a = value.isArray();
final int HEADER_ROW_INDEX = 0;
f.insertRow(HEADER_ROW_INDEX);
f.setWidget(HEADER_ROW_INDEX, 0, new Label("First Name"));
f.setWidget(HEADER_ROW_INDEX, 1, new Label("Last Name"));
f.setWidget(HEADER_ROW_INDEX, 2, new Label("Date Of Birth"));
f.setWidget(HEADER_ROW_INDEX, 3, new Label("Gender"));
int rowIndex = 1;
for (int i=0; i<a.size(); i++) {
int cellIndex = 0;
String firstName = a.get(i).isObject().get("FirstName").toString().replaceAll("^\"|\"$", "");
System.out.println("got: " + firstName);
Label widget = new Label(firstName);
f.setWidget(rowIndex, cellIndex++, widget);
String lastName = a.get(i).isObject().get("LastName").toString().replaceAll("^\"|\"$", "");
//System.out.println("got: " + lastName);
Label widget2 = new Label(lastName);
f.setWidget(rowIndex, cellIndex++, widget2);
String dOB = a.get(i).isObject().get("DOB").toString().replaceAll("^\"|\"$", "").substring(0, 9);
System.out.println("got: " + dOB);
Label widget3 = new Label(dOB);
f.setWidget(rowIndex, cellIndex++, widget3);
String gender = a.get(i).isObject().get("Gender").toString().replaceAll("^\"|\"$", "");
switch (Integer.parseInt(gender)) {
case 1: gender = "male"; break;
case 2: gender = "female"; break;
default: gender = "unmapped";
}