Subversion Repositories eFlore/Applications.coel

Rev

Rev 363 | Rev 1369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 363 Rev 1292
Line 1... Line 1...
1
package org.tela_botanica.client.modeles;
1
package org.tela_botanica.client.modeles;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.ArrayList;
-
 
4
import java.util.Iterator;
-
 
5
import java.util.List;
-
 
6
 
-
 
7
import org.tela_botanica.client.Mediateur;
-
 
8
import org.tela_botanica.client.RegistreId;
-
 
9
import org.tela_botanica.client.interfaces.ListePaginable;
-
 
10
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
11
import org.tela_botanica.client.util.Debug;
-
 
12
 
-
 
13
import com.extjs.gxt.ui.client.Registry;
2
 
14
import com.google.gwt.i18n.client.Dictionary;
-
 
15
import com.google.gwt.json.client.JSONArray;
3
import com.google.gwt.json.client.JSONArray;
16
import com.google.gwt.json.client.JSONNumber;
4
import com.google.gwt.json.client.JSONObject;
17
import com.google.gwt.json.client.JSONObject;
Line 5... Line 18...
5
import com.google.gwt.json.client.JSONString;
18
import com.google.gwt.json.client.JSONString;
6
 
19
 
Line 16... Line 29...
16
	/**
29
	/**
17
	 * Identifiant pour sérialisé l'objet...
30
	 * Identifiant pour sérialisé l'objet...
18
	 */
31
	 */
19
	private static final long serialVersionUID = 7784635999621813450L;
32
	private static final long serialVersionUID = 7784635999621813450L;
Line -... Line 33...
-
 
33
	
-
 
34
	private Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
-
 
35
	
-
 
36
	private int nbElementsTotal;
-
 
37
	
20
	
38
	// Id de la meta-liste dans la base de données
-
 
39
	private int id = 0;
Line 21... Line 40...
21
	private int id = 0;
40
	private String abv = "";
22
	
41
	
23
	/**
42
	/**
24
	 * Constructeur sans paramètres 
43
	 * Constructeur sans paramètres 
Line 47... Line 66...
47
		super(listeValeurs.size());
66
		super(listeValeurs.size());
48
		this.setId(Integer.parseInt(listeId.stringValue()));
67
		this.setId(Integer.parseInt(listeId.stringValue()));
49
		this.constuireObjet(listeValeurs);
68
		this.constuireObjet(listeValeurs);
50
	}
69
	}
Line -... Line 70...
-
 
70
	
-
 
71
	public ValeurListe(JSONString listeId, String abv, JSONArray listeValeurs, JSONNumber nbElements) {
-
 
72
		super(listeValeurs.size());
-
 
73
		this.setId(Integer.parseInt(listeId.stringValue()));
-
 
74
		this.abv = abv;
-
 
75
		this.setNbElementsTotal(nbElements.toString());		
-
 
76
		this.constuireObjet(listeValeurs);
-
 
77
	}
-
 
78
	
51
	
79
	
52
	private void constuireObjet(JSONArray liste) {
80
	protected void constuireObjet(JSONArray liste) {
Line 53... Line 81...
53
		final int taillemax = liste.size();
81
		final int taillemax = liste.size();
54
		
82
		
Line 66... Line 94...
66
	 * @param id l'identifiant à définir
94
	 * @param id l'identifiant à définir
67
	 */
95
	 */
68
	public void setId(int id) {
96
	public void setId(int id) {
69
		this.id = id;
97
		this.id = id;
70
	}
98
	}
-
 
99
	
-
 
100
	public void setNbElementsTotal(String nbElements) {
-
 
101
		this.nbElementsTotal = Integer.parseInt(nbElements);
-
 
102
	}
Line 71... Line 103...
71
 
103
 
72
	/**
104
	/**
73
	 * @return l'identifiant de la liste
105
	 * @return l'identifiant de la liste
74
	 */
106
	 */
75
	public Integer getId() {
107
	public Integer getId() {
76
		return id;
108
		return id;
Line -... Line 109...
-
 
109
	}
-
 
110
	
-
 
111
	public String getFullId() {
-
 
112
		return (id+abv);
77
	}
113
	}
78
	
114
	
79
	public void ajouter(Valeur val) {
115
	public void ajouter(Valeur val) {
-
 
116
		this.put(val.getId(), val);
-
 
117
	}
-
 
118
	
-
 
119
	public ValeurListe cloner()
-
 
120
	{
-
 
121
		ValeurListe l = new ValeurListe();
-
 
122
		Iterator i = this.keySet().iterator();
-
 
123
		
-
 
124
		while (i.hasNext())
-
 
125
		{
-
 
126
			String clef = (String)i.next();
-
 
127
			Valeur valeur = this.get(clef);
-
 
128
			l.put(clef, valeur);
-
 
129
		}
-
 
130
 
-
 
131
		return l;
-
 
132
	}
-
 
133
	
-
 
134
	public void concatenerListe(ValeurListe lv) {
-
 
135
		this.putAll(lv);
-
 
136
		this.setId(lv.getId());
80
		this.put(val.getId(), val);
137
	}
-
 
138
 
-
 
139
}