Skip to content

Latest commit

 

History

History
40 lines (36 loc) · 1.26 KB

File metadata and controls

40 lines (36 loc) · 1.26 KB

#Add inheritance

#JSON

String jsonString = "{'map': [{'char':'a', 'words': ['alpha', 'adam']}, {'char':'b', 'words': ['beta', 'ben']}]}";
final ListBox listBox = new ListBox();
JSONObject jsonObject = JSONParser.parse(jsonString).isObject();
JSONArray jsonArray = jsonObject.get("map").isArray();
for (int i = 0; i< jsonArray.size(); i++) {
  JSONObject item = jsonArray.get(i).isObject();
  listBox.addItem(item.get("char").toString());
  JSONArray words = item.get("words").isArray();
  for (int j = 0; j< words.size(); j++) {
        String word = words.get(j).toString();
        listBox.addItem("*** " + word);
      }
}

#Iteration with casting for (int i = 0; i< grid.getRowCount(); i++) { final Widget widget = grid.getWidget(i, 0); try { final Label button = (Label) ((VerticalPanel) widget).getWidget(0); Window.alert(button.getText()); } catch (ClassCastException exception) { continue; } }

#List to JSONArray final JSONArray jArray = new JSONArray(); for (int i = 1; i< myList.size()+1; i++){ jArray.set(i, new JSONString(myList.get(i))); }

#GWT Remote Debugging http://remotedomain.com:8888/?gwt.codesvr=127.0.0.1:9997