Rev 2755 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package org.tela_botanica.client.modeles.objets;import java.util.HashMap;import java.util.Iterator;import org.tela_botanica.client.cel2;import com.google.gwt.json.client.JSONArray;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 HashMap<String, String> correspondancesClesLabels ;public HashMap<String, String> correspondancesCorrespondancesIdsNomsGroupes;public ListeGroupesChampsEtendus(String groupeChampsEtendusJson) {super();try {correspondancesClesLabels = new HashMap<String, String>();correspondancesCorrespondancesIdsNomsGroupes = new HashMap<String, String>();JSONValue groupesJson = JSONParser.parseStrict(groupeChampsEtendusJson);JSONArray groupes = groupesJson.isArray();for (int i = 0; i < groupes.size(); i++) {JSONObject groupe = groupes.get(i).isObject();String cleGroupe = groupe.get("cle").isString().stringValue();String nomGroupe = groupe.get("nom").isString().stringValue();JSONArray listeClesLabels = groupe.get("champs").isArray();correspondancesCorrespondancesIdsNomsGroupes.put(cleGroupe, nomGroupe);HashMap<String, String> groupesClesLabel = new HashMap<String, String>();for (int j = 0; j < listeClesLabels.size(); j++) {JSONObject champ = listeClesLabels.get(j).isObject();String cle = champ.get("cle").isString().stringValue();String label = champ.get("label").isString().stringValue();groupesClesLabel.put(cle, label);correspondancesClesLabels.put(cle, label);}this.put(nomGroupe, groupesClesLabel);}} catch (Exception e) {// TODO: handle exception}}public HashMap<String, String> getCorrespondancesClesLabel() {return correspondancesClesLabels;}public HashMap<String, String> getCorrespondancesCorrespondancesIdsNomsGroupes() {return correspondancesCorrespondancesIdsNomsGroupes;}}