Subversion Repositories eFlore/Applications.coel

Rev

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

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