Subversion Repositories eFlore/Applications.coel

Rev

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

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