Subversion Repositories eFlore/Applications.coel

Rev

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

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