1918 |
aurelien |
1 |
package org.tela_botanica.client.modeles;
|
|
|
2 |
|
|
|
3 |
import java.util.HashMap;
|
|
|
4 |
import java.util.Iterator;
|
|
|
5 |
import java.util.Map;
|
|
|
6 |
|
|
|
7 |
import org.tela_botanica.client.Mediateur;
|
|
|
8 |
import org.tela_botanica.client.i18n.Constantes;
|
|
|
9 |
import org.tela_botanica.client.util.UtilString;
|
|
|
10 |
|
|
|
11 |
import com.extjs.gxt.ui.client.store.ListStore;
|
|
|
12 |
|
|
|
13 |
public class OntologiesLocales {
|
|
|
14 |
|
|
|
15 |
public static Map<String,String[]> listeOuiNonPeutEtre;
|
|
|
16 |
|
|
|
17 |
// TODO: mapper ça vers l'i18n
|
|
|
18 |
public static Map<String, String[]> getListeOuiNonPeutEtre() {
|
|
|
19 |
if(listeOuiNonPeutEtre == null) {
|
|
|
20 |
Constantes i18n = Mediateur.i18nC;
|
|
|
21 |
listeOuiNonPeutEtre = new HashMap<String, String[]>();
|
|
|
22 |
listeOuiNonPeutEtre.put("",new String[] {UtilString.mettrePremiereLettreEnMajuscule(i18n.neSaitPas()), "0"});
|
|
|
23 |
listeOuiNonPeutEtre.put("oui", new String[] {UtilString.mettrePremiereLettreEnMajuscule(i18n.oui()), "1"});
|
|
|
24 |
listeOuiNonPeutEtre.put("non", new String[] {UtilString.mettrePremiereLettreEnMajuscule(i18n.non()), "2"});
|
|
|
25 |
listeOuiNonPeutEtre.put("peut-etre", new String[] {UtilString.mettrePremiereLettreEnMajuscule(i18n.peutEtre()), "3"});
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
return listeOuiNonPeutEtre;
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public static String getValeurOntologie(Map<String, String[]> ontologie, String cle) {
|
|
|
32 |
String retour = "";
|
|
|
33 |
if(ontologie.containsKey(cle)) {
|
|
|
34 |
retour = ontologie.get(cle)[0];
|
|
|
35 |
}
|
|
|
36 |
return retour;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public static ListStore<SimpleModelData> convertirVersListeStore(Map<String, String[]> aConvertir) {
|
|
|
40 |
ListStore<SimpleModelData> listeConvertie = new ListStore<SimpleModelData>();
|
|
|
41 |
Iterator<String> it = aConvertir.keySet().iterator();
|
|
|
42 |
while (it.hasNext()) {
|
|
|
43 |
String cle = it.next();
|
|
|
44 |
String[] valeurs = aConvertir.get(cle);
|
|
|
45 |
listeConvertie.add(new SimpleModelData(cle, valeurs[0], valeurs[1]));
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
return listeConvertie;
|
|
|
49 |
}
|
|
|
50 |
}
|