Subversion Repositories eFlore/Applications.cel

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2033 aurelien 1
package org.tela_botanica.client.modeles.objets;
2
 
3
import java.util.HashMap;
4
import java.util.Iterator;
5
 
6
import com.google.gwt.json.client.JSONObject;
7
import com.google.gwt.json.client.JSONParser;
8
import com.google.gwt.json.client.JSONValue;
9
 
10
public class ListeGroupesChampsEtendus extends HashMap<String,HashMap<String, String>> {
11
 
12
	public ListeGroupesChampsEtendus(String groupeChampsEtendusJson) {
13
		super();
14
		try {
15
			JSONValue groupesJson = JSONParser.parse(groupeChampsEtendusJson);
16
			JSONObject groupes = groupesJson.isObject();
17
 
18
			for (Iterator<String> iterator = groupes.keySet().iterator(); iterator.hasNext();) {
19
				String groupe = iterator.next();
20
				JSONValue listeClesLabelsJson = groupes.get(groupe);
21
				JSONObject listeClesLabels = listeClesLabelsJson.isObject();
22
				HashMap<String, String> groupesClesLabel = new HashMap<String, String>();
23
				for (Iterator<String> itCleLabels = listeClesLabels.keySet().iterator(); itCleLabels.hasNext();) {
24
					String cle = itCleLabels.next();
25
					String label = listeClesLabels.get(cle).isString().stringValue();
26
					groupesClesLabel.put(cle, label);
27
				}
28
				this.put(groupe, groupesClesLabel);
29
			}
30
		} catch (Exception e) {
31
			// TODO: handle exception
32
		}
33
	}
34
}