Subversion Repositories eFlore/Applications.coel

Rev

Rev 277 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 277 Rev 363
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
2
 
-
 
3
import java.util.LinkedHashMap;
-
 
4
 
2
 
5
import com.google.gwt.json.client.JSONArray;
3
import com.google.gwt.json.client.JSONArray;
6
import com.google.gwt.json.client.JSONObject;
4
import com.google.gwt.json.client.JSONObject;
7
 
5
 
8
/**
6
/**
9
 * Table de hachage composée d'informations sur les Valeurs des listes, renvoyé par un objet de type DAO
7
 * Table de hachage composée d'informations sur les Valeurs des listes, renvoyé par un objet de type DAO
10
 * La clé est l'id de l'entite.
8
 * La clé est l'id de l'entite.
11
 * 
9
 * 
12
 * @author Grégoire DUCHÉ
10
 * @author Grégoire DUCHÉ
13
 * 
11
 * 
14
 */
12
 */
15
public class ProjetListe extends LinkedHashMap<String, Projet> {
13
public class ProjetListe extends aDonneeListe<Projet> {
16
	
-
 
17
	private int id = 0;
-
 
-
 
14
	
-
 
15
	private static final long serialVersionUID = -9030260944108896455L;
18
	
16
 
19
	/**
17
	/**
20
	 * Constructeur sans paramètres 
18
	 * Constructeur sans paramètres 
21
	 */
19
	 */
22
	public ProjetListe() {
20
	public ProjetListe() {
23
		super();
21
		super();
24
	}
22
	}
25
	
23
	
26
	/**
24
	/**
27
	 * Constructeur avec paramètre
25
	 * Constructeur avec paramètre
28
	 * @param taille la taille de la table de hachage
26
	 * @param taille la taille de la table de hachage
29
	 */
27
	 */
30
	public ProjetListe(int taille) {
28
	public ProjetListe(int taille) {
31
		super(taille);
29
		super(taille);
32
	}
30
	}
33
	
31
	
34
	/**
32
	/**
35
	 * Constructeur pour une liste de projets
33
	 * Constructeur pour une liste de projets
36
	 * @param dates
34
	 * @param dates
37
	 */
35
	 */
38
	public ProjetListe(JSONArray projetsListe) {
36
	public ProjetListe(JSONArray projetsListe) {
39
		super(projetsListe.size());
37
		super(projetsListe.size());
40
		
38
		
41
		final int taillemax = projetsListe.size();
39
		final int taillemax = projetsListe.size();
42
		
-
 
43
		for (int i = 0; i < taillemax; i++) {
40
		for (int i = 0; i < taillemax; i++) {
44
			JSONObject projetCourant = projetsListe.get(i).isObject() ;
41
			JSONObject projetCourant = projetsListe.get(i).isObject() ;
45
			
42
			
46
			if (projetCourant != null)	{
43
			if (projetCourant != null)	{
47
				Projet projet = new Projet(projetCourant);
44
				Projet projet = new Projet(projetCourant);
48
				this.put(projet.getId(), projet);				
45
				this.put(projet.getId(), projet);				
49
			}
46
			}
50
		}
47
		}
51
	}
48
	}
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
}
49
}
67
50