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