Subversion Repositories eFlore/Applications.coel

Rev

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

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