Subversion Repositories eFlore/Applications.coel

Rev

Rev 268 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
147 gduche 1
package org.tela_botanica.client.modeles;
2
 
3
import java.util.LinkedHashMap;
4
 
5
import com.google.gwt.json.client.JSONArray;
6
import com.google.gwt.json.client.JSONObject;
7
 
8
/**
9
 * Table de hachage composée d'informations sur les Valeurs des listes, renvoyé par un objet de type DAO
277 jp_milcent 10
 * La clé est l'id de l'entite.
147 gduche 11
 *
277 jp_milcent 12
 * @author Grégoire DUCHÉ
147 gduche 13
 *
14
 */
268 jp_milcent 15
public class ProjetListe extends LinkedHashMap<String, Projet> {
147 gduche 16
 
17
	private int id = 0;
18
 
19
	/**
20
	 * Constructeur sans paramètres
21
	 */
268 jp_milcent 22
	public ProjetListe() {
147 gduche 23
		super();
24
	}
25
 
26
	/**
27
	 * Constructeur avec paramètre
28
	 * @param taille la taille de la table de hachage
29
	 */
268 jp_milcent 30
	public ProjetListe(int taille) {
147 gduche 31
		super(taille);
32
	}
33
 
34
	/**
35
	 * Constructeur pour une liste de projets
36
	 * @param dates
37
	 */
268 jp_milcent 38
	public ProjetListe(JSONArray projetsListe) {
147 gduche 39
		super(projetsListe.size());
40
 
41
		final int taillemax = projetsListe.size();
42
 
43
		for (int i = 0; i < taillemax; i++) {
44
			JSONObject projetCourant = projetsListe.get(i).isObject() ;
45
 
46
			if (projetCourant != null)	{
47
				Projet projet = new Projet(projetCourant);
48
				this.put(projet.getId(), projet);
49
			}
50
		}
51
	}
52
 
53
	/**
54
	 * @param id l'identifiant à définir
55
	 */
56
	public void setId(int id) {
57
		this.id = id;
58
	}
59
 
60
	/**
61
	 * @return l'identifiant de la liste
62
	 */
63
	public Integer getId() {
64
		return id;
65
	}
66
}