Subversion Repositories eFlore/Applications.coel

Rev

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

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