Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1218 Rev 1249
1
package org.tela_botanica.client.vues.collection;
1
package org.tela_botanica.client.vues.collection;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
 
4
 
5
import org.tela_botanica.client.ComposantClass;
5
import org.tela_botanica.client.ComposantClass;
6
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.Mediateur;
7
import org.tela_botanica.client.composants.ChampCaseACocher;
7
import org.tela_botanica.client.composants.ChampCaseACocher;
8
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
8
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
9
import org.tela_botanica.client.composants.ChampMultiValeurs;
9
import org.tela_botanica.client.composants.ChampMultiValeurs;
10
import org.tela_botanica.client.composants.ConteneurMultiChamps;
10
import org.tela_botanica.client.composants.ConteneurMultiChamps;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.modeles.ValeurListe;
12
import org.tela_botanica.client.modeles.ValeurListe;
13
import org.tela_botanica.client.modeles.collection.Collection;
13
import org.tela_botanica.client.modeles.collection.Collection;
14
import org.tela_botanica.client.modeles.collection.CollectionListe;
14
import org.tela_botanica.client.modeles.collection.CollectionListe;
15
import org.tela_botanica.client.modeles.projet.Projet;
15
import org.tela_botanica.client.modeles.projet.Projet;
16
import org.tela_botanica.client.modeles.projet.ProjetListe;
16
import org.tela_botanica.client.modeles.projet.ProjetListe;
17
import org.tela_botanica.client.modeles.structure.Structure;
17
import org.tela_botanica.client.modeles.structure.Structure;
18
import org.tela_botanica.client.modeles.structure.StructureListe;
18
import org.tela_botanica.client.modeles.structure.StructureListe;
19
import org.tela_botanica.client.util.Debug;
19
import org.tela_botanica.client.util.Debug;
20
import org.tela_botanica.client.vues.Formulaire;
20
import org.tela_botanica.client.vues.Formulaire;
21
import org.tela_botanica.client.vues.FormulaireOnglet;
21
import org.tela_botanica.client.vues.FormulaireOnglet;
22
 
22
 
23
import com.extjs.gxt.ui.client.event.BaseEvent;
23
import com.extjs.gxt.ui.client.event.BaseEvent;
24
import com.extjs.gxt.ui.client.event.Events;
24
import com.extjs.gxt.ui.client.event.Events;
25
import com.extjs.gxt.ui.client.event.Listener;
25
import com.extjs.gxt.ui.client.event.Listener;
26
import com.extjs.gxt.ui.client.store.ListStore;
26
import com.extjs.gxt.ui.client.store.ListStore;
27
import com.extjs.gxt.ui.client.util.Margins;
27
import com.extjs.gxt.ui.client.util.Margins;
28
import com.extjs.gxt.ui.client.widget.Text;
28
import com.extjs.gxt.ui.client.widget.Text;
29
import com.extjs.gxt.ui.client.widget.form.ComboBox;
29
import com.extjs.gxt.ui.client.widget.form.ComboBox;
30
import com.extjs.gxt.ui.client.widget.form.Field;
30
import com.extjs.gxt.ui.client.widget.form.Field;
31
import com.extjs.gxt.ui.client.widget.form.FieldSet;
31
import com.extjs.gxt.ui.client.widget.form.FieldSet;
32
import com.extjs.gxt.ui.client.widget.form.HiddenField;
32
import com.extjs.gxt.ui.client.widget.form.HiddenField;
33
import com.extjs.gxt.ui.client.widget.form.NumberField;
33
import com.extjs.gxt.ui.client.widget.form.NumberField;
34
import com.extjs.gxt.ui.client.widget.form.TextArea;
34
import com.extjs.gxt.ui.client.widget.form.TextArea;
35
import com.extjs.gxt.ui.client.widget.form.TextField;
35
import com.extjs.gxt.ui.client.widget.form.TextField;
36
import com.extjs.gxt.ui.client.widget.form.Validator;
36
import com.extjs.gxt.ui.client.widget.form.Validator;
37
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
37
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
38
import com.extjs.gxt.ui.client.widget.layout.FormData;
38
import com.extjs.gxt.ui.client.widget.layout.FormData;
39
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
39
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
40
import com.google.gwt.i18n.client.NumberFormat;
40
import com.google.gwt.i18n.client.NumberFormat;
41
 
41
 
42
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
42
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
43
	
43
	
44
	public static final String ID = "general";
44
	public static final String ID = "general";
45
	private Collection collection = null;
45
	private Collection collection = null;
46
	private Collection collectionCollectee = null;
46
	private Collection collectionCollectee = null;
47
 
47
 
48
	private HiddenField<String> idCollectionChp = null;
48
	private HiddenField<String> idCollectionChp = null;
49
	
49
	
50
	private ComboBox<Projet> projetsCombo = null;
50
	private ComboBox<Projet> projetsCombo = null;
51
	private ComboBox<Structure> structuresCombo = null;
51
	private ComboBox<Structure> structuresCombo = null;
52
	private ComboBox<Collection> collectionsCombo = null;
52
	private ComboBox<Collection> collectionsCombo = null;
53
	
53
	
54
	private ChampCaseACocher periodeConstitutionChp = null;
54
	private ChampCaseACocher periodeConstitutionChp = null;
55
	private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
55
	private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
56
	private ChampMultiValeurs lieuCouvertureChp = null;
56
	private ChampMultiValeurs lieuCouvertureChp = null;
57
 
57
 
58
	private ChampComboBoxListeValeurs specimenTypeCombo = null;
58
	private ChampComboBoxListeValeurs specimenTypeCombo = null;
59
	private ChampComboBoxListeValeurs precisionTypeNbreCombo = null;
59
	private ChampComboBoxListeValeurs precisionTypeNbreCombo = null;
60
	private NumberField nbreTypeChp = null;
60
	private NumberField nbreTypeChp = null;
61
	private ChampComboBoxListeValeurs classementSpecimenTypeCombo = null;
61
	private ChampComboBoxListeValeurs classementSpecimenTypeCombo = null;
62
	
62
	
63
	private ChampComboBoxListeValeurs typeDepotCombo = null;
63
	private ChampComboBoxListeValeurs typeDepotCombo = null;
64
	private TextField<String> coteChp = null;
64
	private TextField<String> coteChp = null;
65
	private ChampMultiValeurs idAlternatifsChp = null;
65
	private ChampMultiValeurs idAlternatifsChp = null;
66
	private ChampMultiValeurs nomsAlternatifsChp = null;
66
	private ChampMultiValeurs nomsAlternatifsChp = null;
67
	private ChampMultiValeurs codesAlternatifsChp = null;
67
	private ChampMultiValeurs codesAlternatifsChp = null;
68
	
68
	
69
	private TextArea descriptionSpecialisteChp = null;
69
	private TextArea descriptionSpecialisteChp = null;
70
	private TextArea descriptionChp = null;
70
	private TextArea descriptionChp = null;
71
	private TextArea historiqueChp = null;
71
	private TextArea historiqueChp = null;
72
	private ChampMultiValeurs urlsChp = null;
72
	private ChampMultiValeurs urlsChp = null;
73
 
73
 
74
	private ChampComboBoxListeValeurs butRealisationCombo = null;
74
	private ChampComboBoxListeValeurs butRealisationCombo = null;
75
	
75
	
76
	public CollectionFormGeneral(Formulaire formulaireCourrant) {
76
	public CollectionFormGeneral(Formulaire formulaireCourrant) {
77
		initialiserOnglet(formulaireCourrant);
77
		initialiserOnglet(formulaireCourrant);
78
		setId(ID);
78
		setId(ID);
79
		setText(Mediateur.i18nC.collectionGeneral());
79
		setText(Mediateur.i18nC.collectionGeneral());
80
		
80
		
81
		creerChampsCache();
81
		creerChampsCache();
82
		creerFieldsetLiaison();
82
		creerFieldsetLiaison();
83
		creerFieldsetAdministratif();
83
		creerFieldsetAdministratif();
84
		creerFieldsetDescription();
84
		creerFieldsetDescription();
85
		creerFieldsetCouverture();
85
		creerFieldsetCouverture();
86
		creerFieldsetType();
86
		creerFieldsetType();
87
	}
87
	}
88
 
88
 
89
	private void initialiserCollection() {
89
	private void initialiserCollection() {
90
		collection = ((CollectionForm) formulaire).collection;
90
		collection = ((CollectionForm) formulaire).collection;
91
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
91
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
92
	}
92
	}
93
	
93
	
94
	private void creerChampsCache() {
94
	private void creerChampsCache() {
95
		// Champs cachés
95
		// Champs cachés
96
		idCollectionChp = new HiddenField<String>();
96
		idCollectionChp = new HiddenField<String>();
97
		this.add(idCollectionChp);
97
		this.add(idCollectionChp);
98
	}
98
	}
99
	
99
	
100
	private void creerFieldsetLiaison() {
100
	private void creerFieldsetLiaison() {
101
		FieldSet liaisonFieldSet = new FieldSet();
101
		FieldSet liaisonFieldSet = new FieldSet();
102
		liaisonFieldSet.setHeading(i18nC.liaisonTitreCollection());
102
		liaisonFieldSet.setHeading(i18nC.liaisonTitreCollection());
103
		liaisonFieldSet.setCollapsible(true);
103
		liaisonFieldSet.setCollapsible(true);
104
		liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
104
		liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
105
		
105
		
106
		projetsCombo = new ComboBox<Projet>();
106
		projetsCombo = new ComboBox<Projet>();
107
		projetsCombo.setTabIndex(tabIndex++);
107
		projetsCombo.setTabIndex(tabIndex++);
108
		projetsCombo.setFieldLabel(i18nC.projetChamp());
108
		projetsCombo.setFieldLabel(i18nC.projetChamp());
109
		projetsCombo.setDisplayField("nom");
109
		projetsCombo.setDisplayField("nom");
110
		projetsCombo.setForceSelection(true);
110
		projetsCombo.setForceSelection(true);
111
		projetsCombo.setValidator(new Validator() {
111
		projetsCombo.setValidator(new Validator() {
112
			@Override
-
 
113
			public String validate(Field<?> field, String value) {
112
			public String validate(Field<?> field, String value) {
114
				String retour = null;
113
				String retour = null;
115
				if (field.getRawValue().equals("")) {
114
				if (field.getRawValue().equals("")) {
116
					field.setValue(null);
115
					field.setValue(null);
117
				} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
116
				} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
118
					String contenuBrut = field.getRawValue();
117
					String contenuBrut = field.getRawValue();
119
					field.setValue(null);
118
					field.setValue(null);
120
					field.setRawValue(contenuBrut);
119
					field.setRawValue(contenuBrut);
121
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
120
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
122
				}
121
				}
123
				return retour;
122
				return retour;
124
			}
123
			}
125
		});
124
		});
126
		projetsCombo.setTriggerAction(TriggerAction.ALL);
125
		projetsCombo.setTriggerAction(TriggerAction.ALL);
127
		projetsCombo.setStore(new ListStore<Projet>());
126
		projetsCombo.setStore(new ListStore<Projet>());
128
		projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
127
		projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
129
		projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
128
		projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
130
		liaisonFieldSet.add(projetsCombo, new FormData(450, 0));
129
		liaisonFieldSet.add(projetsCombo, new FormData(450, 0));
131
		mediateur.selectionnerProjet(this, null);
130
		mediateur.selectionnerProjet(this, null);
132
		
131
		
133
		structuresCombo = new ComboBox<Structure>();
132
		structuresCombo = new ComboBox<Structure>();
134
		structuresCombo.setTabIndex(tabIndex++);
133
		structuresCombo.setTabIndex(tabIndex++);
135
		structuresCombo.setFieldLabel(i18nC.lienStructureCollection());
134
		structuresCombo.setFieldLabel(i18nC.lienStructureCollection());
136
		structuresCombo.setDisplayField("nom");
135
		structuresCombo.setDisplayField("nom");
137
		structuresCombo.setForceSelection(true);
136
		structuresCombo.setForceSelection(true);
138
		structuresCombo.setValidator(new Validator() {
137
		structuresCombo.setValidator(new Validator() {
139
			@Override
-
 
140
			public String validate(Field<?> field, String value) {
138
			public String validate(Field<?> field, String value) {
141
				String retour = null;
139
				String retour = null;
142
				if (field.getRawValue().equals("")) {
140
				if (field.getRawValue().equals("")) {
143
					field.setValue(null);
141
					field.setValue(null);
144
				} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) {
142
				} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) {
145
					String contenuBrut = field.getRawValue();
143
					String contenuBrut = field.getRawValue();
146
					field.setValue(null);
144
					field.setValue(null);
147
					field.setRawValue(contenuBrut);
145
					field.setRawValue(contenuBrut);
148
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
146
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
149
				}
147
				}
150
				return retour;
148
				return retour;
151
			}
149
			}
152
		});
150
		});
153
		structuresCombo.setTriggerAction(TriggerAction.ALL);
151
		structuresCombo.setTriggerAction(TriggerAction.ALL);
154
		structuresCombo.setStore(new ListStore<Structure>());
152
		structuresCombo.setStore(new ListStore<Structure>());
155
		liaisonFieldSet.add(structuresCombo, new FormData(450, 0));
153
		liaisonFieldSet.add(structuresCombo, new FormData(450, 0));
156
		mediateur.selectionnerStructureParProjet(this, null);
154
		mediateur.selectionnerStructureParProjet(this, null);
157
		
155
		
158
		collectionsCombo = new ComboBox<Collection>();
156
		collectionsCombo = new ComboBox<Collection>();
159
		collectionsCombo.setTabIndex(tabIndex++);
157
		collectionsCombo.setTabIndex(tabIndex++);
160
		collectionsCombo.setFieldLabel(i18nC.lienMereCollection());
158
		collectionsCombo.setFieldLabel(i18nC.lienMereCollection());
161
		collectionsCombo.setDisplayField("nom");
159
		collectionsCombo.setDisplayField("nom");
162
		collectionsCombo.setForceSelection(true);
160
		collectionsCombo.setForceSelection(true);
163
		collectionsCombo.setValidator(new Validator() {
161
		collectionsCombo.setValidator(new Validator() {
164
			@Override
-
 
165
			public String validate(Field<?> field, String value) {
162
			public String validate(Field<?> field, String value) {
166
				String retour = null;
163
				String retour = null;
167
				if (field.getRawValue().equals("")) {
164
				if (field.getRawValue().equals("")) {
168
					field.setValue(null);
165
					field.setValue(null);
169
				} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
166
				} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
170
					String contenuBrut = field.getRawValue();
167
					String contenuBrut = field.getRawValue();
171
					field.setValue(null);
168
					field.setValue(null);
172
					field.setRawValue(contenuBrut);
169
					field.setRawValue(contenuBrut);
173
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
170
					retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
174
				}
171
				}
175
				return retour;
172
				return retour;
176
			}
173
			}
177
		});
174
		});
178
		collectionsCombo.setTriggerAction(TriggerAction.ALL);
175
		collectionsCombo.setTriggerAction(TriggerAction.ALL);
179
		collectionsCombo.setStore(new ListStore<Collection>());
176
		collectionsCombo.setStore(new ListStore<Collection>());
180
		liaisonFieldSet.add(collectionsCombo, new FormData(450, 0));
177
		liaisonFieldSet.add(collectionsCombo, new FormData(450, 0));
181
		mediateur.selectionnerCollectionParProjet(this, null);
178
		mediateur.selectionnerCollectionParProjet(this, null);
182
		
179
		
183
		this.add(liaisonFieldSet);
180
		this.add(liaisonFieldSet);
184
	}
181
	}
185
	
182
	
186
	private void creerFieldsetAdministratif() {
183
	private void creerFieldsetAdministratif() {
187
		// Fieldset ADMINISTRATIF
184
		// Fieldset ADMINISTRATIF
188
		FieldSet administratifFieldSet = new FieldSet();
185
		FieldSet administratifFieldSet = new FieldSet();
189
		administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
186
		administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
190
		administratifFieldSet.setCollapsible(true);
187
		administratifFieldSet.setCollapsible(true);
191
		administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
188
		administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
192
		
189
		
193
		typeDepotCombo = new ChampComboBoxListeValeurs(i18nC.typeDepot(), "typeDepot", tabIndex++);
190
		typeDepotCombo = new ChampComboBoxListeValeurs(i18nC.typeDepot(), "typeDepot", tabIndex++);
194
		administratifFieldSet.add(typeDepotCombo);
191
		administratifFieldSet.add(typeDepotCombo);
195
		
192
		
196
		coteChp = new TextField<String>();
193
		coteChp = new TextField<String>();
197
		coteChp.setTabIndex(tabIndex++);
194
		coteChp.setTabIndex(tabIndex++);
198
		coteChp.setFieldLabel(i18nC.cote());
195
		coteChp.setFieldLabel(i18nC.cote());
199
		administratifFieldSet.add(coteChp, new FormData(450, 0));
196
		administratifFieldSet.add(coteChp, new FormData(450, 0));
200
		
197
		
201
		idAlternatifsChp = new ChampMultiValeurs(i18nC.idAlternatifCollection());
198
		idAlternatifsChp = new ChampMultiValeurs(i18nC.idAlternatifCollection());
202
		administratifFieldSet.add(idAlternatifsChp);
199
		administratifFieldSet.add(idAlternatifsChp);
203
		
200
		
204
		nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
201
		nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
205
		administratifFieldSet.add(nomsAlternatifsChp);
202
		administratifFieldSet.add(nomsAlternatifsChp);
206
				
203
				
207
		codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
204
		codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
208
		administratifFieldSet.add(codesAlternatifsChp);
205
		administratifFieldSet.add(codesAlternatifsChp);
209
		
206
		
210
		this.add(administratifFieldSet);
207
		this.add(administratifFieldSet);
211
	}
208
	}
212
	
209
	
213
	private void creerFieldsetDescription() {
210
	private void creerFieldsetDescription() {
214
		// Fieldset DESCRIPTION
211
		// Fieldset DESCRIPTION
215
		FieldSet descriptionFieldSet = new FieldSet();
212
		FieldSet descriptionFieldSet = new FieldSet();
216
		descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
213
		descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
217
		descriptionFieldSet.setCollapsible(true);
214
		descriptionFieldSet.setCollapsible(true);
218
		descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
215
		descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
219
 
216
 
220
		descriptionChp = new TextArea();
217
		descriptionChp = new TextArea();
221
		descriptionChp.setFieldLabel(i18nC.description());
218
		descriptionChp.setFieldLabel(i18nC.description());
222
		descriptionFieldSet.add(descriptionChp, new FormData(550, 0));
219
		descriptionFieldSet.add(descriptionChp, new FormData(550, 0));
223
		
220
		
224
		descriptionSpecialisteChp = new TextArea();
221
		descriptionSpecialisteChp = new TextArea();
225
		descriptionSpecialisteChp.setFieldLabel(i18nC.descriptionSpecialiste());
222
		descriptionSpecialisteChp.setFieldLabel(i18nC.descriptionSpecialiste());
226
		descriptionFieldSet.add(descriptionSpecialisteChp, new FormData(550, 0));
223
		descriptionFieldSet.add(descriptionSpecialisteChp, new FormData(550, 0));
227
		
224
		
228
		historiqueChp = new TextArea();
225
		historiqueChp = new TextArea();
229
		historiqueChp.setFieldLabel(i18nC.historique());
226
		historiqueChp.setFieldLabel(i18nC.historique());
230
		descriptionFieldSet.add(historiqueChp, new FormData(550, 0));
227
		descriptionFieldSet.add(historiqueChp, new FormData(550, 0));
231
		
228
		
232
		urlsChp = new ChampMultiValeurs(i18nC.urlsCollection());
229
		urlsChp = new ChampMultiValeurs(i18nC.urlsCollection());
233
		descriptionFieldSet.add(urlsChp);
230
		descriptionFieldSet.add(urlsChp);
234
 
231
 
235
		this.add(descriptionFieldSet);
232
		this.add(descriptionFieldSet);
236
	}
233
	}
237
	
234
	
238
	private void creerFieldsetCouverture() {
235
	private void creerFieldsetCouverture() {
239
		FieldSet couvertureFieldSet = new FieldSet();
236
		FieldSet couvertureFieldSet = new FieldSet();
240
		couvertureFieldSet.setHeading("Couvertures");
237
		couvertureFieldSet.setHeading("Couvertures");
241
		couvertureFieldSet.setCollapsible(true);
238
		couvertureFieldSet.setCollapsible(true);
242
		couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
239
		couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
243
		
240
		
244
		periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
241
		periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
245
		couvertureFieldSet.add(periodeConstitutionChp);
242
		couvertureFieldSet.add(periodeConstitutionChp);
246
		
243
		
247
		groupementPrincipeCombo = new ChampComboBoxListeValeurs(i18nC.groupementPrincipeCollection(), "groupementPrincipe", tabIndex++);
244
		groupementPrincipeCombo = new ChampComboBoxListeValeurs(i18nC.groupementPrincipeCollection(), "groupementPrincipe", tabIndex++);
248
		groupementPrincipeCombo.setToolTip(i18nC.groupementPrincipeCollectionInfo());
245
		groupementPrincipeCombo.setToolTip(i18nC.groupementPrincipeCollectionInfo());
249
		couvertureFieldSet.add(groupementPrincipeCombo);
246
		couvertureFieldSet.add(groupementPrincipeCombo);
250
		
247
		
251
		butRealisationCombo = new ChampComboBoxListeValeurs(i18nC.butCollection(), "realisationBut", tabIndex++);
248
		butRealisationCombo = new ChampComboBoxListeValeurs(i18nC.butCollection(), "realisationBut", tabIndex++);
252
		couvertureFieldSet.add(butRealisationCombo);
249
		couvertureFieldSet.add(butRealisationCombo);
253
		
250
		
254
		lieuCouvertureChp = new ChampMultiValeurs(i18nC.lieuCouvertureCollection());
251
		lieuCouvertureChp = new ChampMultiValeurs(i18nC.lieuCouvertureCollection());
255
		couvertureFieldSet.add(lieuCouvertureChp);
252
		couvertureFieldSet.add(lieuCouvertureChp);
256
		
253
		
257
		this.add(couvertureFieldSet);
254
		this.add(couvertureFieldSet);
258
	}
255
	}
259
	
256
	
260
	private void creerFieldsetType() {
257
	private void creerFieldsetType() {
261
		FieldSet typeFieldSet = new FieldSet();
258
		FieldSet typeFieldSet = new FieldSet();
262
		typeFieldSet.setHeading("Spécimens «types»");
259
		typeFieldSet.setHeading("Spécimens «types»");
263
		typeFieldSet.setCollapsible(true);
260
		typeFieldSet.setCollapsible(true);
264
		typeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
261
		typeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
265
		
262
		
266
		specimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.specimenTypeCollection(), "onpi", tabIndex++);
263
		specimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.specimenTypeCollection(), "onpi", tabIndex++);
267
		typeFieldSet.add(specimenTypeCombo);
264
		typeFieldSet.add(specimenTypeCombo);
268
		
265
		
269
		ConteneurMultiChamps nbreTypeConteneur = new ConteneurMultiChamps(i18nC.nbreSpecimenTypeCollection());
266
		ConteneurMultiChamps nbreTypeConteneur = new ConteneurMultiChamps(i18nC.nbreSpecimenTypeCollection());
270
		
267
		
271
		nbreTypeChp = new NumberField();
268
		nbreTypeChp = new NumberField();
272
		nbreTypeChp.setFormat(NumberFormat.getFormat("#"));
269
		nbreTypeChp.setFormat(NumberFormat.getFormat("#"));
273
		nbreTypeConteneur.ajouterChamp(nbreTypeChp, new HBoxLayoutData(new Margins(0, 20, 0, 0)));
270
		nbreTypeConteneur.ajouterChamp(nbreTypeChp, new HBoxLayoutData(new Margins(0, 20, 0, 0)));
274
		
271
		
275
		precisionTypeNbreCombo = new ChampComboBoxListeValeurs(null, "ea");
272
		precisionTypeNbreCombo = new ChampComboBoxListeValeurs(null, "ea");
276
		precisionTypeNbreCombo.setTrie("id_valeur");
273
		precisionTypeNbreCombo.setTrie("id_valeur");
277
		precisionTypeNbreCombo.setEmptyText(i18nC.precisionNbreSpecimenTypeCollectionChpVide());
274
		precisionTypeNbreCombo.setEmptyText(i18nC.precisionNbreSpecimenTypeCollectionChpVide());
278
		nbreTypeConteneur.ajouterChamp(precisionTypeNbreCombo);
275
		nbreTypeConteneur.ajouterChamp(precisionTypeNbreCombo);
279
		
276
		
280
		typeFieldSet.add(nbreTypeConteneur);
277
		typeFieldSet.add(nbreTypeConteneur);
281
				
278
				
282
		classementSpecimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.classementSpecimenTypeCollection(), "typeClassement", tabIndex++);
279
		classementSpecimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.classementSpecimenTypeCollection(), "typeClassement", tabIndex++);
283
		typeFieldSet.add(classementSpecimenTypeCombo);
280
		typeFieldSet.add(classementSpecimenTypeCombo);
284
		
281
		
285
		Text infoType = new Text(i18nC.specimenTypeCollectionInfo());
282
		Text infoType = new Text(i18nC.specimenTypeCollectionInfo());
286
		typeFieldSet.add(infoType);
283
		typeFieldSet.add(infoType);
287
		
284
		
288
		this.add(typeFieldSet);
285
		this.add(typeFieldSet);
289
	}
286
	}
290
	
287
	
291
	public void peupler() {
288
	public void peupler() {
292
		initialiserCollection();
289
		initialiserCollection();
293
		if (collection != null) {
290
		if (collection != null) {
294
			idCollectionChp.setValue(collection.getId());
291
			idCollectionChp.setValue(collection.getId());
295
			setValeurComboProjets();
292
			setValeurComboProjets();
296
			setValeurComboStructures();
293
			setValeurComboStructures();
297
			setValeurComboCollections();
294
			setValeurComboCollections();
298
			
295
			
299
			typeDepotCombo.peupler(collection.getTypeDepot());
296
			typeDepotCombo.peupler(collection.getTypeDepot());
300
			coteChp.setValue(collection.getCote());
297
			coteChp.setValue(collection.getCote());
301
			idAlternatifsChp.peupler(collection.getIdAlternatif());
298
			idAlternatifsChp.peupler(collection.getIdAlternatif());
302
			nomsAlternatifsChp.peupler(collection.getNomAlternatif());
299
			nomsAlternatifsChp.peupler(collection.getNomAlternatif());
303
			codesAlternatifsChp.peupler(collection.getCode());
300
			codesAlternatifsChp.peupler(collection.getCode());
304
			
301
			
305
			descriptionChp.setValue(collection.getDescription());
302
			descriptionChp.setValue(collection.getDescription());
306
			descriptionSpecialisteChp.setValue(collection.getDescriptionSpecialiste());
303
			descriptionSpecialisteChp.setValue(collection.getDescriptionSpecialiste());
307
			historiqueChp.setValue(collection.getHistorique());
304
			historiqueChp.setValue(collection.getHistorique());
308
			urlsChp.peupler(collection.getUrls());
305
			urlsChp.peupler(collection.getUrls());
309
			
306
			
310
			periodeConstitutionChp.peupler(collection.getPeriodeConstitution());			
307
			periodeConstitutionChp.peupler(collection.getPeriodeConstitution());			
311
			groupementPrincipeCombo.peupler(collection.getGroupementPrincipe());
308
			groupementPrincipeCombo.peupler(collection.getGroupementPrincipe());
312
			butRealisationCombo.peupler(collection.getGroupementBut());
309
			butRealisationCombo.peupler(collection.getGroupementBut());
313
			lieuCouvertureChp.peupler(collection.getCouvertureLieu());
310
			lieuCouvertureChp.peupler(collection.getCouvertureLieu());
314
			
311
			
315
			specimenTypeCombo.peupler(collection.getSpecimenType());
312
			specimenTypeCombo.peupler(collection.getSpecimenType());
316
			nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
313
			nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
317
			precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
314
			precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
318
			classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
315
			classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
319
		}
316
		}
320
	}
317
	}
321
	
318
	
322
	public ArrayList<String> verifier() {
319
	public ArrayList<String> verifier() {
323
		ArrayList<String> messages = new ArrayList<String>();
320
		ArrayList<String> messages = new ArrayList<String>();
324
		if (projetsCombo.getValue() == null || !projetsCombo.isValid()) {
321
		if (projetsCombo.getValue() == null || !projetsCombo.isValid()) {
325
			messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
322
			messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
326
		}
323
		}
327
		return messages;
324
		return messages;
328
	}
325
	}
329
	
326
	
330
	public void collecter() {
327
	public void collecter() {
331
		initialiserCollection();
328
		initialiserCollection();
332
		if (etreAccede()) {
329
		if (etreAccede()) {
333
			collectionCollectee.setId(idCollectionChp.getValue());
330
			collectionCollectee.setId(idCollectionChp.getValue());
334
			collectionCollectee.setIdProjet(getValeurComboProjets());
331
			collectionCollectee.setIdProjet(getValeurComboProjets());
335
			collectionCollectee.setIdStructure(getValeurComboStructures());
332
			collectionCollectee.setIdStructure(getValeurComboStructures());
336
			collectionCollectee.setCollectionMereId(getValeurComboCollections());
333
			collectionCollectee.setCollectionMereId(getValeurComboCollections());
337
			
334
			
338
			collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
335
			collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
339
			collectionCollectee.setCote(coteChp.getValue());
336
			collectionCollectee.setCote(coteChp.getValue());
340
			collectionCollectee.setIdAlternatif(idAlternatifsChp.getValeurs());
337
			collectionCollectee.setIdAlternatif(idAlternatifsChp.getValeurs());
341
			collectionCollectee.setNomAlternatif(nomsAlternatifsChp.getValeurs());
338
			collectionCollectee.setNomAlternatif(nomsAlternatifsChp.getValeurs());
342
			collectionCollectee.setCode(codesAlternatifsChp.getValeurs());
339
			collectionCollectee.setCode(codesAlternatifsChp.getValeurs());
343
			
340
			
344
			collectionCollectee.setDescription(descriptionChp.getValue());
341
			collectionCollectee.setDescription(descriptionChp.getValue());
345
			collectionCollectee.setDescriptionSpecialiste(descriptionSpecialisteChp.getValue());
342
			collectionCollectee.setDescriptionSpecialiste(descriptionSpecialisteChp.getValue());
346
			collectionCollectee.setHistorique(historiqueChp.getValue());
343
			collectionCollectee.setHistorique(historiqueChp.getValue());
347
			collectionCollectee.setUrls(urlsChp.getValeurs());
344
			collectionCollectee.setUrls(urlsChp.getValeurs());
348
			
345
			
349
			collectionCollectee.setPeriodeConstitution(periodeConstitutionChp.getValeur());
346
			collectionCollectee.setPeriodeConstitution(periodeConstitutionChp.getValeur());
350
			collectionCollectee.setGroupementPrincipe(groupementPrincipeCombo.getValeur());
347
			collectionCollectee.setGroupementPrincipe(groupementPrincipeCombo.getValeur());
351
			collectionCollectee.setGroupementBut(butRealisationCombo.getValeur());
348
			collectionCollectee.setGroupementBut(butRealisationCombo.getValeur());
352
			collectionCollectee.setCouvertureLieu(lieuCouvertureChp.getValeurs());
349
			collectionCollectee.setCouvertureLieu(lieuCouvertureChp.getValeurs());
353
			
350
			
354
			collectionCollectee.setSpecimenType(specimenTypeCombo.getValeur());
351
			collectionCollectee.setSpecimenType(specimenTypeCombo.getValeur());
355
			if (nbreTypeChp.getValue() != null) {
352
			if (nbreTypeChp.getValue() != null) {
356
				collectionCollectee.setSpecimenTypeNbre(nbreTypeChp.getValue().toString());
353
				collectionCollectee.setSpecimenTypeNbre(nbreTypeChp.getValue().toString());
357
			}
354
			}
358
			collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
355
			collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
359
			collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
356
			collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
360
		}
357
		}
361
	}
358
	}
362
	
359
	
363
	private String getValeurComboProjets() {
360
	private String getValeurComboProjets() {
364
		String valeur = "";
361
		String valeur = "";
365
		if (projetsCombo.getValue() != null) {
362
		if (projetsCombo.getValue() != null) {
366
			valeur = projetsCombo.getValue().getId();
363
			valeur = projetsCombo.getValue().getId();
367
		}
364
		}
368
		return valeur;
365
		return valeur;
369
	}
366
	}
370
	private void setValeurComboProjets() {
367
	private void setValeurComboProjets() {
371
		if (projetsCombo.getStore() != null && collection != null) {
368
		if (projetsCombo.getStore() != null && collection != null) {
372
			projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
369
			projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
373
		}
370
		}
374
	}
371
	}
375
	
372
	
376
	private String getValeurComboStructures() {
373
	private String getValeurComboStructures() {
377
		String valeur = "";
374
		String valeur = "";
378
		if (structuresCombo.getValue() != null) {
375
		if (structuresCombo.getValue() != null) {
379
			valeur = structuresCombo.getValue().getId();
376
			valeur = structuresCombo.getValue().getId();
380
		}
377
		}
381
		return valeur;
378
		return valeur;
382
	}
379
	}
383
	private void setValeurComboStructures() {
380
	private void setValeurComboStructures() {
384
		if (structuresCombo.getStore() != null && collection != null) {
381
		if (structuresCombo.getStore() != null && collection != null) {
385
			structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
382
			structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
386
		}
383
		}
387
	}
384
	}
388
	
385
	
389
	private String getValeurComboCollections() {
386
	private String getValeurComboCollections() {
390
		String valeur = "";
387
		String valeur = "";
391
		if (collectionsCombo.getValue() != null) {
388
		if (collectionsCombo.getValue() != null) {
392
			valeur = collectionsCombo.getValue().getId();
389
			valeur = collectionsCombo.getValue().getId();
393
		}
390
		}
394
		return valeur;
391
		return valeur;
395
	}
392
	}
396
	private void setValeurComboCollections() {
393
	private void setValeurComboCollections() {
397
		if (collectionsCombo.getStore() != null && collection != null) {
394
		if (collectionsCombo.getStore() != null && collection != null) {
398
			collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
395
			collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
399
		}
396
		}
400
	}
397
	}
401
	
398
	
402
	public void rafraichir(Object nouvellesDonnees) {
399
	public void rafraichir(Object nouvellesDonnees) {
403
		if (nouvellesDonnees instanceof ProjetListe) {
400
		if (nouvellesDonnees instanceof ProjetListe) {
404
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
401
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
405
			Formulaire.rafraichirComboBox(projets, projetsCombo);
402
			Formulaire.rafraichirComboBox(projets, projetsCombo);
406
			setValeurComboProjets();
403
			setValeurComboProjets();
407
		} else if (nouvellesDonnees instanceof StructureListe) {
404
		} else if (nouvellesDonnees instanceof StructureListe) {
408
			StructureListe structures = (StructureListe) nouvellesDonnees;
405
			StructureListe structures = (StructureListe) nouvellesDonnees;
409
			Formulaire.rafraichirComboBox(structures, structuresCombo);
406
			Formulaire.rafraichirComboBox(structures, structuresCombo);
410
			setValeurComboStructures();
407
			setValeurComboStructures();
411
		} else if (nouvellesDonnees instanceof CollectionListe) {
408
		} else if (nouvellesDonnees instanceof CollectionListe) {
412
			CollectionListe collections = (CollectionListe) nouvellesDonnees;
409
			CollectionListe collections = (CollectionListe) nouvellesDonnees;
413
			Formulaire.rafraichirComboBox(collections, collectionsCombo);
410
			Formulaire.rafraichirComboBox(collections, collectionsCombo);
414
			setValeurComboCollections();
411
			setValeurComboCollections();
415
		} else if (nouvellesDonnees instanceof ValeurListe) {
412
		} else if (nouvellesDonnees instanceof ValeurListe) {
416
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
413
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
417
			rafraichirValeurListe(listeValeurs);
414
			rafraichirValeurListe(listeValeurs);
418
		} else {
415
		} else {
419
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
416
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
420
		}
417
		}
421
	}
418
	}
422
	
419
	
423
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
420
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
424
		if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
421
		if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
425
			Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
422
			Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
426
		} else {
423
		} else {
427
			Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
424
			Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
428
		}
425
		}
429
	}
426
	}
430
	
427
	
431
	
428
	
432
 
429
 
433
}
430
}