New file |
0,0 → 1,34 |
package org.tela_botanica.client.modeles.objets; |
|
import java.util.HashMap; |
import java.util.Iterator; |
|
import com.google.gwt.json.client.JSONObject; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONValue; |
|
public class ListeGroupesChampsEtendus extends HashMap<String,HashMap<String, String>> { |
|
public ListeGroupesChampsEtendus(String groupeChampsEtendusJson) { |
super(); |
try { |
JSONValue groupesJson = JSONParser.parse(groupeChampsEtendusJson); |
JSONObject groupes = groupesJson.isObject(); |
|
for (Iterator<String> iterator = groupes.keySet().iterator(); iterator.hasNext();) { |
String groupe = iterator.next(); |
JSONValue listeClesLabelsJson = groupes.get(groupe); |
JSONObject listeClesLabels = listeClesLabelsJson.isObject(); |
HashMap<String, String> groupesClesLabel = new HashMap<String, String>(); |
for (Iterator<String> itCleLabels = listeClesLabels.keySet().iterator(); itCleLabels.hasNext();) { |
String cle = itCleLabels.next(); |
String label = listeClesLabels.get(cle).isString().stringValue(); |
groupesClesLabel.put(cle, label); |
} |
this.put(groupe, groupesClesLabel); |
} |
} catch (Exception e) { |
// TODO: handle exception |
} |
} |
} |