Subversion Repositories eFlore/Applications.coel

Rev

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

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