Subversion Repositories eFlore/Applications.coel

Rev

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

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