Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1513 Rev 1641
1
package org.tela_botanica.client.composants;
1
package org.tela_botanica.client.composants;
2
 
2
 
3
import java.util.HashMap;
3
import java.util.HashMap;
4
 
4
 
5
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.images.Images;
6
import org.tela_botanica.client.images.Images;
7
import org.tela_botanica.client.modeles.Valeur;
7
import org.tela_botanica.client.modeles.Valeur;
8
import org.tela_botanica.client.modeles.aDonnee;
8
import org.tela_botanica.client.modeles.aDonnee;
9
import org.tela_botanica.client.util.Debug;
9
import org.tela_botanica.client.util.Debug;
10
 
10
 
11
import com.extjs.gxt.ui.client.event.ButtonEvent;
11
import com.extjs.gxt.ui.client.event.ButtonEvent;
12
import com.extjs.gxt.ui.client.event.Events;
12
import com.extjs.gxt.ui.client.event.Events;
13
import com.extjs.gxt.ui.client.event.FieldEvent;
13
import com.extjs.gxt.ui.client.event.FieldEvent;
14
import com.extjs.gxt.ui.client.event.Listener;
14
import com.extjs.gxt.ui.client.event.Listener;
15
import com.extjs.gxt.ui.client.event.SelectionListener;
15
import com.extjs.gxt.ui.client.event.SelectionListener;
16
import com.extjs.gxt.ui.client.store.ListStore;
16
import com.extjs.gxt.ui.client.store.ListStore;
17
import com.extjs.gxt.ui.client.widget.LayoutContainer;
17
import com.extjs.gxt.ui.client.widget.LayoutContainer;
18
import com.extjs.gxt.ui.client.widget.MessageBox;
18
import com.extjs.gxt.ui.client.widget.MessageBox;
19
import com.extjs.gxt.ui.client.widget.Text;
19
import com.extjs.gxt.ui.client.widget.Text;
20
import com.extjs.gxt.ui.client.widget.button.Button;
20
import com.extjs.gxt.ui.client.widget.button.Button;
21
import com.extjs.gxt.ui.client.widget.form.ComboBox;
21
import com.extjs.gxt.ui.client.widget.form.ComboBox;
22
import com.extjs.gxt.ui.client.widget.form.Field;
22
import com.extjs.gxt.ui.client.widget.form.Field;
23
import com.extjs.gxt.ui.client.widget.form.HiddenField;
23
import com.extjs.gxt.ui.client.widget.form.HiddenField;
24
import com.extjs.gxt.ui.client.widget.form.LabelField;
24
import com.extjs.gxt.ui.client.widget.form.LabelField;
25
import com.extjs.gxt.ui.client.widget.form.TextField;
25
import com.extjs.gxt.ui.client.widget.form.TextField;
26
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
26
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
27
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
27
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
28
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
28
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
29
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
29
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
30
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
30
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
31
 
31
 
32
public class ChampMultiValeurs extends LayoutContainer {
32
public class ChampMultiValeurs extends LayoutContainer {
33
	//TODO : changer le champRecapitulatif par une hashMap
33
	//TODO : changer le champRecapitulatif par une hashMap
34
	//TODO : autoriser la modification des champs saisis
34
	//TODO : autoriser la modification des champs saisis
35
 
35
 
36
	String idChampCache = null;
36
	String idChampCache = null;
37
	
37
	
38
	String nomLabelChampTxt = "";
38
	String nomLabelChampTxt = "";
39
	
39
	
40
	String titreErreur = null;
40
	String titreErreur = null;
41
	String valeurVideMsg = null;
41
	String valeurVideMsg = null;
42
	String valeurIdentiqueMsg = null;
42
	String valeurIdentiqueMsg = null;
43
	String valeurNonValideMsg = null;
43
	String valeurNonValideMsg = null;
44
	
44
	
45
	String valeurParDefaut = "";
45
	String valeurParDefaut = "";
46
	String validationMasque = null;
46
	String validationMasque = null;
47
	String exempleValidation = null;
47
	String exempleValidation = null;
48
	String boutonSupprimerLabel = "";
48
	String boutonSupprimerLabel = "";
49
	
49
	
50
	LayoutContainer principalLayout = null;
50
	LayoutContainer principalLayout = null;
51
	Field<String> champValeurTxt = null;
51
	Field<String> champValeurTxt = null;
52
	ComboBox<Valeur> champValeurCombo = null;
52
	ComboBox<Valeur> champValeurCombo = null;
53
	HiddenField<String> champRecapitulatif = null;
53
	HiddenField<String> champRecapitulatif = null;
54
	HashMap<String, LayoutContainer> valeurs = null;
54
	HashMap<String, LayoutContainer> valeurs = null;
55
	ComboBox<Valeur> types = null;
55
	ComboBox<Valeur> types = null;
56
	
56
	
57
	int largeurTotale = 420;
57
	int largeurTotale = 420;
58
	int largeurBouton = 20;
58
	int largeurBouton = 20;
59
	int largeurChamp = 0;
59
	int largeurChamp = 0;
60
	int largeurType = 0;
60
	int largeurType = 0;
61
 	
61
 	
62
	boolean estMultiType = false;
62
	boolean estMultiType = false;
63
	boolean estComboBox = false;
63
	boolean estComboBox = false;
64
	
64
	
65
	public ChampMultiValeurs() {
65
	public ChampMultiValeurs() {
66
		initialiserChampMultiValeur(null, 0);
66
		initialiserChampMultiValeur(null, 0);
67
	}
67
	}
68
	
68
	
69
	public ChampMultiValeurs(String label) {
69
	public ChampMultiValeurs(String label) {
70
		initialiserChampMultiValeur(label, 0);
70
		initialiserChampMultiValeur(label, 0);
71
	}
71
	}
72
	
72
	
73
	public ChampMultiValeurs(String label, int largeurTotale) {
73
	public ChampMultiValeurs(String label, int largeurTotale) {
74
		initialiserChampMultiValeur(label, largeurTotale);
74
		initialiserChampMultiValeur(label, largeurTotale);
75
	}
75
	}
76
	
76
	
77
	public ChampMultiValeurs(boolean estMultiType, String label, int largeurTotale, int largeurType) {
77
	public ChampMultiValeurs(boolean estMultiType, String label, int largeurTotale, int largeurType) {
78
		this.estMultiType = estMultiType;
78
		this.estMultiType = estMultiType;
79
		initialiserChampMultiValeur(label, largeurTotale);
79
		initialiserChampMultiValeur(label, largeurTotale);
80
	}
80
	}
81
		
81
		
82
	public ChampMultiValeurs(boolean estCombobox, boolean estMultiType, String label, int largeurTotale, int largeurType) {
82
	public ChampMultiValeurs(boolean estCombobox, boolean estMultiType, String label, int largeurTotale, int largeurType) {
83
		this.estMultiType = estMultiType;
83
		this.estMultiType = estMultiType;
84
		this.estComboBox = estCombobox;
84
		this.estComboBox = estCombobox;
85
		setLargeurType(largeurType);
85
		setLargeurType(largeurType);
86
		initialiserChampMultiValeur(label, largeurTotale);
86
		initialiserChampMultiValeur(label, largeurTotale);
87
	}
87
	}
88
	
88
	
89
	public ComboBox<Valeur> getTypes() {
89
	public ComboBox<Valeur> getTypes() {
90
		return this.types;
90
		return this.types;
91
	}
91
	}
92
	
92
	
93
	public void setLabel(String label) {
93
	public void setLabel(String label) {
94
		if (label == null) {
94
		if (label == null) {
95
			label = "";
95
			label = "";
96
		}
96
		}
97
		nomLabelChampTxt = label;
97
		nomLabelChampTxt = label;
98
	}
98
	}
99
	
99
	
100
	public void setLargeurChamp(int largeurMax) {
100
	public void setLargeurChamp(int largeurMax) {
101
		if (largeurMax != 0 && largeurMax > 20) {
101
		if (largeurMax != 0 && largeurMax > 20) {
102
			largeurTotale = largeurMax;
102
			largeurTotale = largeurMax;
103
		}
103
		}
104
		
104
		
105
		largeurChamp = largeurTotale - largeurBouton;
105
		largeurChamp = largeurTotale - largeurBouton;
106
	}
106
	}
107
	
107
	
108
	public void setLargeurType(int largeur) {
108
	public void setLargeurType(int largeur) {
109
		largeurType = largeur;
109
		largeurType = largeur;
110
	}
110
	}
111
		
111
		
112
	public void setValidation (String validation, String exempleValidation)	{
112
	public void setValidation (String validation, String exempleValidation)	{
113
		this.validationMasque = validation;
113
		this.validationMasque = validation;
114
		this.exempleValidation = exempleValidation;
114
		this.exempleValidation = exempleValidation;
115
		
115
		
116
		this.valeurNonValideMsg = Mediateur.i18nM.valeurNonValideMsg(exempleValidation);
116
		this.valeurNonValideMsg = Mediateur.i18nM.valeurNonValideMsg(exempleValidation);
117
	}
117
	}
118
	
118
	
119
	public void setValeurParDefaut(String valeur)	{
119
	public void setValeurParDefaut(String valeur)	{
120
		this.valeurParDefaut = valeur;
120
		this.valeurParDefaut = valeur;
121
		champValeurTxt.setValue(valeur);
121
		champValeurTxt.setValue(valeur);
122
	}
122
	}
123
	
123
	
124
	public void setValeurBoutonSupprimer(String valeur)	{
124
	public void setValeurBoutonSupprimer(String valeur)	{
125
		this.boutonSupprimerLabel = valeur;
125
		this.boutonSupprimerLabel = valeur;
126
	}
126
	}
127
	
127
	
128
	private void initialiserChampMultiValeur(String label, int largeur) {
128
	private void initialiserChampMultiValeur(String label, int largeur) {
129
		setLabel(label);
129
		setLabel(label);
130
		setLargeurChamp(largeur);
130
		setLargeurChamp(largeur);
131
		
131
		
132
		titreErreur = Mediateur.i18nC.erreurSaisieTitre();
132
		titreErreur = Mediateur.i18nC.erreurSaisieTitre();
133
		valeurVideMsg = Mediateur.i18nC.demanderValeur();
133
		valeurVideMsg = Mediateur.i18nC.demanderValeur();
134
		valeurIdentiqueMsg = Mediateur.i18nC.valeurDejaPresente();
134
		valeurIdentiqueMsg = Mediateur.i18nC.valeurDejaPresente();
135
		
135
		
136
		valeurs = new HashMap<String, LayoutContainer>();
136
		valeurs = new HashMap<String, LayoutContainer>();
137
		champRecapitulatif = new HiddenField<String>();
137
		champRecapitulatif = new HiddenField<String>();
138
		champRecapitulatif.setValue("");
138
		champRecapitulatif.setValue("");
139
		
139
		
140
		setLayout(new FormLayout());
140
		setLayout(new FormLayout());
141
		
141
		
142
		creerChampMultiValeurs();
142
		creerChampMultiValeurs();
143
	}
143
	}
144
	
144
	
145
	private void creerChampMultiValeurs() {
145
	private void creerChampMultiValeurs() {
146
		principalLayout = new LayoutContainer();
146
		principalLayout = new LayoutContainer();
147
		principalLayout.setLayout(new RowLayout());
147
		principalLayout.setLayout(new RowLayout());
148
		
148
		
149
		LabelField label = new LabelField(nomLabelChampTxt + ":");
149
		LabelField label = new LabelField(nomLabelChampTxt + ":");
150
		label.setWidth("95%");
150
		label.setWidth("95%");
151
		principalLayout.add(label);
151
		principalLayout.add(label);
152
		
152
		
153
		LayoutContainer colonneConteneur = new LayoutContainer();
153
		LayoutContainer colonneConteneur = new LayoutContainer();
154
		colonneConteneur.setLayout(new ColumnLayout());
154
		colonneConteneur.setLayout(new ColumnLayout());
155
		
155
		
156
		if (estMultiType == true)	{
156
		if (estMultiType == true)	{
157
			types = new ComboBox<Valeur>();
157
			types = new ComboBox<Valeur>();
158
			types.setDisplayField("nom");
158
			types.setDisplayField("nom");
159
			types.setEmptyText("Choisissez:");			
159
			types.setEmptyText("Choisissez:");			
160
			types.setStore(new ListStore<Valeur>());
160
			types.setStore(new ListStore<Valeur>());
161
			types.setTypeAhead(true);
161
			types.setTypeAhead(true);
162
			types.setTriggerAction(TriggerAction.ALL);
162
			types.setTriggerAction(TriggerAction.ALL);
163
			
163
			
164
			types.addListener(Events.Select, new Listener<FieldEvent>() {
164
			types.addListener(Events.Select, new Listener<FieldEvent>() {
165
				public void handleEvent(FieldEvent fe) {
165
				public void handleEvent(FieldEvent fe) {
166
 
166
 
167
				}
167
				}
168
			});
168
			});
169
			
169
			
170
			colonneConteneur.add(types, new ColumnData(largeurType));
170
			colonneConteneur.add(types, new ColumnData(largeurType));
171
		}
171
		}
172
		
172
		
173
		if (estComboBox) {
173
		if (estComboBox) {
174
			champValeurCombo = new ComboBox<Valeur>();
174
			champValeurCombo = new ComboBox<Valeur>();
175
			champValeurCombo.setDisplayField("nom");
175
			champValeurCombo.setDisplayField("nom");
176
			champValeurCombo.setStore(new ListStore<Valeur>());
176
			champValeurCombo.setStore(new ListStore<Valeur>());
177
			colonneConteneur.add(champValeurCombo, new ColumnData(largeurChamp));			
177
			colonneConteneur.add(champValeurCombo, new ColumnData(largeurChamp));			
178
		} else {
178
		} else {
179
			champValeurTxt = new TextField<String>();
179
			champValeurTxt = new TextField<String>();
180
			colonneConteneur.add(champValeurTxt, new ColumnData(largeurChamp));
180
			colonneConteneur.add(champValeurTxt, new ColumnData(largeurChamp));
181
		}
181
		}
182
		Button ajouterBouton = new Button();
182
		Button ajouterBouton = new Button();
183
		ajouterBouton.setIcon(Images.ICONES.ajouter());
183
		ajouterBouton.setIcon(Images.ICONES.ajouter());
184
		ajouterBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
184
		ajouterBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
185
			public void componentSelected(ButtonEvent ce) {
185
			public void componentSelected(ButtonEvent ce) {
186
				String valeurChamp = "";
-
 
187
				if (estComboBox) {
-
 
188
					if (champValeurCombo.getValue() != null) {
-
 
189
						valeurChamp = champValeurCombo.getValue().getId();
-
 
190
					}
-
 
191
				} else {
-
 
192
					valeurChamp = champValeurTxt.getValue();
-
 
193
				}
-
 
194
				
-
 
195
				if ((valeurChamp == null) || valeurChamp.trim().equals("") || valeurChamp.trim().equals(valeurParDefaut))	{
-
 
196
					MessageBox.alert(titreErreur, valeurVideMsg, null);
-
 
197
				} else if (valeurs.get(valeurChamp) != null){
-
 
198
					MessageBox.alert(titreErreur, valeurIdentiqueMsg, null);							
-
 
199
				} else {
-
 
200
					if (validationMasque != null && !valeurChamp.matches(validationMasque)) 	{
-
 
201
						MessageBox.alert(titreErreur, valeurNonValideMsg, null);
-
 
202
					} else {
-
 
203
						if (estMultiType)	{
-
 
204
							String type = "";
-
 
205
							String id = "";
-
 
206
							Valeur valeur = types.getValue();
-
 
207
				
-
 
208
							if (valeur != null)	{
-
 
209
								type = valeur.getNom();
-
 
210
								id = valeur.getId();
-
 
211
							} else {
-
 
212
								type = types.getRawValue();
-
 
213
								id = type;
-
 
214
							}
-
 
215
			
-
 
216
							if (type.trim().equals(""))	{
-
 
217
								MessageBox.alert(Mediateur.i18nM.titreErreurSaisie(), Mediateur.i18nM.typeChampMulti(), null);
-
 
218
							} else {
-
 
219
								ajouterValeur(valeurChamp, type, id);
-
 
220
							}
-
 
221
						} else {
-
 
222
							ajouterValeur(valeurChamp);
186
				surAjoutValeur(true);
223
						}
-
 
224
					}
-
 
225
				}
-
 
226
			}
187
			}
227
		});
188
		});
228
		colonneConteneur.add(ajouterBouton, new ColumnData(largeurBouton));
189
		colonneConteneur.add(ajouterBouton, new ColumnData(largeurBouton));
229
		
190
		
230
		principalLayout.add(champRecapitulatif);
191
		principalLayout.add(champRecapitulatif);
231
		principalLayout.add(colonneConteneur);
192
		principalLayout.add(colonneConteneur);
232
		add(principalLayout);
193
		add(principalLayout);
233
	}
194
	}
-
 
195
	
-
 
196
	private void surAjoutValeur(boolean validerChamp) {
-
 
197
		String valeurChamp = "";
-
 
198
		if (estComboBox) {
-
 
199
			if (champValeurCombo.getValue() != null) {
-
 
200
				valeurChamp = champValeurCombo.getValue().getId();
-
 
201
			}
-
 
202
		} else {
-
 
203
			valeurChamp = champValeurTxt.getValue();
-
 
204
		}
-
 
205
		
-
 
206
		if ((valeurChamp == null) || valeurChamp.trim().equals("") || valeurChamp.trim().equals(valeurParDefaut))	{
-
 
207
			if(validerChamp) {
-
 
208
				MessageBox.alert(titreErreur, valeurVideMsg, null);
-
 
209
			}
-
 
210
		} else if (valeurs.get(valeurChamp) != null) {
-
 
211
			if(validerChamp) {
-
 
212
				MessageBox.alert(titreErreur, valeurIdentiqueMsg, null);
-
 
213
			}
-
 
214
		} else {
-
 
215
			if (validationMasque != null && !valeurChamp.matches(validationMasque)) {
-
 
216
				if(validerChamp) {
-
 
217
					MessageBox.alert(titreErreur, valeurNonValideMsg, null);
-
 
218
				}
-
 
219
			} else {
-
 
220
				if (estMultiType)	{
-
 
221
					String type = "";
-
 
222
					String id = "";
-
 
223
					Valeur valeur = types.getValue();
-
 
224
		
-
 
225
					if (valeur != null)	{
-
 
226
						type = valeur.getNom();
-
 
227
						id = valeur.getId();
-
 
228
					} else {
-
 
229
						type = types.getRawValue();
-
 
230
						id = type;
-
 
231
					}
-
 
232
	
-
 
233
					if (type.trim().equals(""))	{
-
 
234
						MessageBox.alert(Mediateur.i18nM.titreErreurSaisie(), Mediateur.i18nM.typeChampMulti(), null);
-
 
235
					} else {
-
 
236
						ajouterValeur(valeurChamp, type, id);
-
 
237
					}
-
 
238
				} else {
-
 
239
					ajouterValeur(valeurChamp);
-
 
240
				}
-
 
241
			}
-
 
242
		}
-
 
243
	}
234
	
244
	
235
	public void ajouterValeur(final String texte, final String strValeur, final String id)	{
245
	public void ajouterValeur(final String texte, final String strValeur, final String id)	{
236
		//Implémenté dans classe inférieure
246
		//Implémenté dans classe inférieure
237
	}
247
	}
238
	
248
	
239
	public void ajouterValeur(final String texte) 	{
249
	public void ajouterValeur(final String texte) 	{
240
		
250
		
241
		LayoutContainer colonneLayout = new LayoutContainer();
251
		LayoutContainer colonneLayout = new LayoutContainer();
242
		colonneLayout.setLayout(new ColumnLayout());
252
		colonneLayout.setLayout(new ColumnLayout());
243
		valeurs.put(texte, colonneLayout);
253
		valeurs.put(texte, colonneLayout);
244
		
254
		
245
		Text champTxt = new Text();
255
		Text champTxt = new Text();
246
		champTxt.setText(texte);
256
		champTxt.setText(texte);
247
		colonneLayout.add(champTxt, new ColumnData(largeurChamp));
257
		colonneLayout.add(champTxt, new ColumnData(largeurChamp));
248
		
258
		
249
		Button supprimerBouton = new Button();
259
		Button supprimerBouton = new Button();
250
		supprimerBouton.setIcon(Images.ICONES.supprimer());
260
		supprimerBouton.setIcon(Images.ICONES.supprimer());
251
		supprimerBouton.setText(boutonSupprimerLabel);
261
		supprimerBouton.setText(boutonSupprimerLabel);
252
		supprimerBouton.setData("valeur", texte);
262
		supprimerBouton.setData("valeur", texte);
253
		supprimerBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
263
		supprimerBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
254
			public void componentSelected(ButtonEvent ce) {
264
			public void componentSelected(ButtonEvent ce) {
255
				String valeur = ce.getComponent().getData("valeur");
265
				String valeur = ce.getComponent().getData("valeur");
256
				LayoutContainer valeurLayout = valeurs.get(valeur);
266
				LayoutContainer valeurLayout = valeurs.get(valeur);
257
				principalLayout.remove(valeurLayout);
267
				principalLayout.remove(valeurLayout);
258
				
268
				
259
				valeurs.remove(valeur);
269
				valeurs.remove(valeur);
260
 
270
 
261
				supprimerValeurDuRecapitulatif(valeur);
271
				supprimerValeurDuRecapitulatif(valeur);
262
				
272
				
263
				actualiserLayoutGlobal();
273
				actualiserLayoutGlobal();
264
			}
274
			}
265
		});
275
		});
266
		colonneLayout.add(supprimerBouton, new ColumnData(largeurBouton));
276
		colonneLayout.add(supprimerBouton, new ColumnData(largeurBouton));
267
		
277
		
268
		// Ajout du layout de la valeur au layout principal
278
		// Ajout du layout de la valeur au layout principal
269
		principalLayout.add(colonneLayout);
279
		principalLayout.add(colonneLayout);
270
		
280
		
271
		// Ajout de la valeur au champ récapitulatif des valeurs ajoutées
281
		// Ajout de la valeur au champ récapitulatif des valeurs ajoutées
272
		ajouterValeurAuRecapitulatif(texte);
282
		ajouterValeurAuRecapitulatif(texte);
273
		reinitialiserChamp();
283
		reinitialiserChamp();
274
		actualiserLayoutGlobal();
284
		actualiserLayoutGlobal();
275
	}
285
	}
276
	
286
	
277
	public void reinitialiserChamp()	{
287
	public void reinitialiserChamp()	{
278
		if (estComboBox) {
288
		if (estComboBox) {
279
			champValeurCombo.setValue(champValeurCombo.getStore().findModel("id_valeur", valeurParDefaut));
289
			champValeurCombo.setValue(champValeurCombo.getStore().findModel("id_valeur", valeurParDefaut));
280
		} else {
290
		} else {
281
			champValeurTxt.setValue(valeurParDefaut);
291
			champValeurTxt.setValue(valeurParDefaut);
282
		}
292
		}
283
		
293
		
284
		if (estMultiType) {
294
		if (estMultiType) {
285
			types.reset();
295
			types.reset();
286
		}
296
		}
287
	}
297
	}
288
	
298
	
289
	public void actualiserLayoutGlobal() {
299
	public void actualiserLayoutGlobal() {
290
		layout();
300
		layout();
291
	}
301
	}
292
	
302
	
293
	public void ajouterValeurAuRecapitulatif(String texte) {
303
	public void ajouterValeurAuRecapitulatif(String texte) {
294
		String texteRecapitulatif = "";
304
		String texteRecapitulatif = "";
295
		if (champRecapitulatif.getValue() != null)	{
305
		if (champRecapitulatif.getValue() != null)	{
296
			texteRecapitulatif = champRecapitulatif.getValue();
306
			texteRecapitulatif = champRecapitulatif.getValue();
297
		}
307
		}
298
		texteRecapitulatif += texte + aDonnee.SEPARATEUR_VALEURS;
308
		texteRecapitulatif += texte + aDonnee.SEPARATEUR_VALEURS;
299
		champRecapitulatif.setValue(texteRecapitulatif);
309
		champRecapitulatif.setValue(texteRecapitulatif);
300
	}
310
	}
301
	
311
	
302
	public void supprimerValeurDuRecapitulatif(String texte) {
312
	public void supprimerValeurDuRecapitulatif(String texte) {
303
 
313
 
304
		if (champRecapitulatif.getValue() != null)	{
314
		if (champRecapitulatif.getValue() != null)	{
305
			String texteValeur = "";
315
			String texteValeur = "";
306
			if (estComboBox) {
316
			if (estComboBox) {
307
				// comme c'est le nom de la valeur qui est passée en paramètre,
317
				// comme c'est le nom de la valeur qui est passée en paramètre,
308
				// on doit récupérer son id
318
				// on doit récupérer son id
309
				ListStore<Valeur> valeurs = champValeurCombo.getStore();
319
				ListStore<Valeur> valeurs = champValeurCombo.getStore();
310
				Valeur objetValeur = valeurs.findModel("nom", texte);
320
				Valeur objetValeur = valeurs.findModel("nom", texte);
311
				
321
				
312
				if (objetValeur != null)	{
322
				if (objetValeur != null)	{
313
					texteValeur = objetValeur.getId();
323
					texteValeur = objetValeur.getId();
314
				} else {
324
				} else {
315
					texteValeur = texte;
325
					texteValeur = texte;
316
				}
326
				}
317
			} else {
327
			} else {
318
				texteValeur = texte;
328
				texteValeur = texte;
319
			}
329
			}
320
			
330
			
321
			String texteRecapitulatif = champRecapitulatif.getValue();
331
			String texteRecapitulatif = champRecapitulatif.getValue();
322
			texteRecapitulatif = texteRecapitulatif.replace(texteValeur + aDonnee.SEPARATEUR_VALEURS, "");
332
			texteRecapitulatif = texteRecapitulatif.replace(texteValeur + aDonnee.SEPARATEUR_VALEURS, "");
323
			champRecapitulatif.setValue(texteRecapitulatif);
333
			champRecapitulatif.setValue(texteRecapitulatif);
324
		}
334
		}
325
	}
335
	}
326
	
336
	
327
	public String getValeurs() {
337
	public String getValeurs() {
-
 
338
		// permet de s'assurer qu'une valeur saisie dans le champ mais non ajoutée par le 
-
 
339
		// clic sur le + soit bien prise en compte
-
 
340
		surAjoutValeur(false);
328
		String texteRecapitulatif = "";
341
		String texteRecapitulatif = "";
329
		if (champRecapitulatif.getValue() != null) {
342
		if (champRecapitulatif.getValue() != null) {
330
			texteRecapitulatif = champRecapitulatif.getValue();
343
			texteRecapitulatif = champRecapitulatif.getValue();
331
			texteRecapitulatif = texteRecapitulatif.replaceAll("(.*)"+aDonnee.SEPARATEUR_VALEURS+"$", "$1");
344
			texteRecapitulatif = texteRecapitulatif.replaceAll("(.*)"+aDonnee.SEPARATEUR_VALEURS+"$", "$1");
332
		}
345
		}
333
		return texteRecapitulatif;
346
		return texteRecapitulatif;
334
	}
347
	}
335
	
348
	
336
	public void peupler(String chaineExistante) {
349
	public void peupler(String chaineExistante) {
337
		if (valeurs.size()>0)	{
350
		if (valeurs.size()>0)	{
338
			reinitialiser();
351
			reinitialiser();
339
		}
352
		}
340
		if (chaineExistante != null && !chaineExistante.trim().equals("")) {
353
		if (chaineExistante != null && !chaineExistante.trim().equals("")) {
341
			String[] valeurs = chaineExistante.split(aDonnee.SEPARATEUR_VALEURS);
354
			String[] valeurs = chaineExistante.split(aDonnee.SEPARATEUR_VALEURS);
342
			for (int i = 0; i < valeurs.length; i++) {
355
			for (int i = 0; i < valeurs.length; i++) {
343
				ajouterValeur(valeurs[i]);
356
				ajouterValeur(valeurs[i]);
344
			}
357
			}
345
		}
358
		}
346
	}
359
	}
347
	
360
	
348
	public void reinitialiser()	{
361
	public void reinitialiser()	{
349
		//TODO : pourrait etre mieux fait si les valeurs étaient enregistrées dans un 
362
		//TODO : pourrait etre mieux fait si les valeurs étaient enregistrées dans un 
350
		// layout particulier. Il suffirait alors d'enlever les valeurs de ce layout.
363
		// layout particulier. Il suffirait alors d'enlever les valeurs de ce layout.
351
		principalLayout.removeAll();
364
		principalLayout.removeAll();
352
		initialiserChampMultiValeur(nomLabelChampTxt, largeurTotale);
365
		initialiserChampMultiValeur(nomLabelChampTxt, largeurTotale);
353
	}
366
	}
354
}
367
}