Subversion Repositories eFlore/Applications.coel

Rev

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

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