Subversion Repositories eFlore/Applications.coel

Rev

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

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