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;
|
1018 |
jpm |
7 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
859 |
jpm |
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
1329 |
cyprien |
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
687 |
jp_milcent |
10 |
import org.tela_botanica.client.composants.ChampMultiValeurs;
|
1925 |
delphine |
11 |
import org.tela_botanica.client.composants.ChampNombre;
|
859 |
jpm |
12 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
1329 |
cyprien |
13 |
import org.tela_botanica.client.composants.pagination.ProxyCollections;
|
|
|
14 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
687 |
jp_milcent |
15 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
16 |
import org.tela_botanica.client.modeles.ValeurListe;
|
935 |
jpm |
17 |
import org.tela_botanica.client.modeles.collection.Collection;
|
|
|
18 |
import org.tela_botanica.client.modeles.structure.Structure;
|
1367 |
cyprien |
19 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
951 |
jpm |
20 |
import org.tela_botanica.client.util.Debug;
|
1925 |
delphine |
21 |
import org.tela_botanica.client.util.UtilDate;
|
1428 |
cyprien |
22 |
import org.tela_botanica.client.util.UtilString;
|
934 |
jpm |
23 |
import org.tela_botanica.client.vues.Formulaire;
|
|
|
24 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
858 |
jpm |
25 |
|
1329 |
cyprien |
26 |
import com.extjs.gxt.ui.client.data.ModelData;
|
|
|
27 |
import com.extjs.gxt.ui.client.data.ModelType;
|
968 |
jpm |
28 |
import com.extjs.gxt.ui.client.event.Events;
|
859 |
jpm |
29 |
import com.extjs.gxt.ui.client.util.Margins;
|
1925 |
delphine |
30 |
import com.extjs.gxt.ui.client.widget.Label;
|
859 |
jpm |
31 |
import com.extjs.gxt.ui.client.widget.Text;
|
1925 |
delphine |
32 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
687 |
jp_milcent |
33 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
|
|
34 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
|
|
35 |
import com.extjs.gxt.ui.client.widget.form.HiddenField;
|
859 |
jpm |
36 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
687 |
jp_milcent |
37 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
862 |
jpm |
38 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
687 |
jp_milcent |
39 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
|
|
40 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
859 |
jpm |
41 |
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
|
|
|
42 |
import com.google.gwt.i18n.client.NumberFormat;
|
1925 |
delphine |
43 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
687 |
jp_milcent |
44 |
|
|
|
45 |
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
|
|
|
46 |
|
1083 |
jpm |
47 |
public static final String ID = "general";
|
867 |
jpm |
48 |
private Collection collection = null;
|
|
|
49 |
private Collection collectionCollectee = null;
|
|
|
50 |
|
1018 |
jpm |
51 |
private HiddenField<String> idCollectionChp = null;
|
687 |
jp_milcent |
52 |
|
1329 |
cyprien |
53 |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
|
|
|
54 |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
|
858 |
jpm |
55 |
|
1925 |
delphine |
56 |
private ChampNombre periodeConstitutionDebutChp = null;
|
|
|
57 |
private ChampNombre periodeConstitutionFinChp = null;
|
862 |
jpm |
58 |
private ChampMultiValeurs lieuCouvertureChp = null;
|
687 |
jp_milcent |
59 |
|
859 |
jpm |
60 |
private ChampComboBoxListeValeurs specimenTypeCombo = null;
|
|
|
61 |
private ChampComboBoxListeValeurs precisionTypeNbreCombo = null;
|
|
|
62 |
private NumberField nbreTypeChp = null;
|
1018 |
jpm |
63 |
private ChampComboBoxListeValeurs classementSpecimenTypeCombo = null;
|
858 |
jpm |
64 |
|
867 |
jpm |
65 |
private ChampComboBoxListeValeurs typeDepotCombo = null;
|
865 |
jpm |
66 |
private TextField<String> coteChp = null;
|
|
|
67 |
private ChampMultiValeurs nomsAlternatifsChp = null;
|
|
|
68 |
private ChampMultiValeurs codesAlternatifsChp = null;
|
862 |
jpm |
69 |
|
865 |
jpm |
70 |
private TextArea descriptionChp = null;
|
|
|
71 |
private TextArea historiqueChp = null;
|
|
|
72 |
private ChampMultiValeurs urlsChp = null;
|
862 |
jpm |
73 |
|
1367 |
cyprien |
74 |
private Sequenceur sequenceur = new Sequenceur();
|
|
|
75 |
|
687 |
jp_milcent |
76 |
public CollectionFormGeneral(Formulaire formulaireCourrant) {
|
|
|
77 |
initialiserOnglet(formulaireCourrant);
|
1083 |
jpm |
78 |
setId(ID);
|
687 |
jp_milcent |
79 |
setText(Mediateur.i18nC.collectionGeneral());
|
|
|
80 |
|
|
|
81 |
creerChampsCache();
|
|
|
82 |
creerFieldsetLiaison();
|
|
|
83 |
creerFieldsetAdministratif();
|
|
|
84 |
creerFieldsetDescription();
|
858 |
jpm |
85 |
creerFieldsetCouverture();
|
859 |
jpm |
86 |
creerFieldsetType();
|
687 |
jp_milcent |
87 |
}
|
|
|
88 |
|
875 |
jpm |
89 |
private void initialiserCollection() {
|
|
|
90 |
collection = ((CollectionForm) formulaire).collection;
|
|
|
91 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
|
|
92 |
}
|
|
|
93 |
|
687 |
jp_milcent |
94 |
private void creerChampsCache() {
|
|
|
95 |
// Champs cachés
|
|
|
96 |
idCollectionChp = new HiddenField<String>();
|
|
|
97 |
this.add(idCollectionChp);
|
|
|
98 |
}
|
|
|
99 |
|
|
|
100 |
private void creerFieldsetLiaison() {
|
1428 |
cyprien |
101 |
|
687 |
jp_milcent |
102 |
FieldSet liaisonFieldSet = new FieldSet();
|
1680 |
raphael |
103 |
liaisonFieldSet.setHeadingHtml(i18nC.liaisonTitreCollection());
|
687 |
jp_milcent |
104 |
liaisonFieldSet.setCollapsible(true);
|
858 |
jpm |
105 |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
687 |
jp_milcent |
106 |
|
1329 |
cyprien |
107 |
|
1526 |
jpm |
108 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
109 |
// Champ Structures
|
1329 |
cyprien |
110 |
|
|
|
111 |
ModelType modelTypeStructures = new ModelType();
|
|
|
112 |
modelTypeStructures.setRoot("structures");
|
|
|
113 |
modelTypeStructures.setTotalName("nbElements");
|
|
|
114 |
modelTypeStructures.addField("cs_nom");
|
|
|
115 |
modelTypeStructures.addField("cs_id_structure");
|
|
|
116 |
|
|
|
117 |
String displayNameStructures = "cs_nom";
|
1468 |
jpm |
118 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
|
1329 |
cyprien |
119 |
|
|
|
120 |
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
|
|
121 |
structuresCombo.setWidth(250, 600);
|
|
|
122 |
structuresCombo.getCombo().setTabIndex(tabIndex++);
|
|
|
123 |
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
|
|
|
124 |
structuresCombo.getCombo().setForceSelection(true);
|
|
|
125 |
|
|
|
126 |
structuresCombo.getCombo().setValidator(new Validator() {
|
687 |
jp_milcent |
127 |
public String validate(Field<?> field, String value) {
|
|
|
128 |
String retour = null;
|
|
|
129 |
if (field.getRawValue().equals("")) {
|
|
|
130 |
field.setValue(null);
|
1329 |
cyprien |
131 |
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
|
687 |
jp_milcent |
132 |
String contenuBrut = field.getRawValue();
|
|
|
133 |
field.setValue(null);
|
|
|
134 |
field.setRawValue(contenuBrut);
|
|
|
135 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
|
|
136 |
}
|
|
|
137 |
return retour;
|
|
|
138 |
}
|
|
|
139 |
});
|
1329 |
cyprien |
140 |
|
|
|
141 |
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
|
687 |
jp_milcent |
142 |
|
1329 |
cyprien |
143 |
|
1526 |
jpm |
144 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
145 |
// Champ Collections
|
1329 |
cyprien |
146 |
|
|
|
147 |
ModelType modelTypeCollections = new ModelType();
|
|
|
148 |
modelTypeCollections.setRoot("collections");
|
|
|
149 |
modelTypeCollections.setTotalName("nbElements");
|
|
|
150 |
modelTypeCollections.addField("cc_nom");
|
|
|
151 |
modelTypeCollections.addField("cc_id_collection");
|
1367 |
cyprien |
152 |
modelTypeCollections.addField("cc_ce_mere");
|
1329 |
cyprien |
153 |
|
|
|
154 |
String displayNameCollections = "cc_nom";
|
1468 |
jpm |
155 |
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(null);
|
1329 |
cyprien |
156 |
|
|
|
157 |
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
|
|
|
158 |
collectionsCombo.setWidth(250, 600);
|
|
|
159 |
collectionsCombo.getCombo().setTabIndex(tabIndex++);
|
|
|
160 |
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
|
1428 |
cyprien |
161 |
collectionsCombo.getCombo().setForceSelection(true);
|
1329 |
cyprien |
162 |
|
|
|
163 |
collectionsCombo.getCombo().setValidator(new Validator() {
|
687 |
jp_milcent |
164 |
public String validate(Field<?> field, String value) {
|
|
|
165 |
String retour = null;
|
|
|
166 |
if (field.getRawValue().equals("")) {
|
|
|
167 |
field.setValue(null);
|
1329 |
cyprien |
168 |
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
|
687 |
jp_milcent |
169 |
String contenuBrut = field.getRawValue();
|
|
|
170 |
field.setValue(null);
|
|
|
171 |
field.setRawValue(contenuBrut);
|
|
|
172 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
|
|
173 |
}
|
|
|
174 |
return retour;
|
|
|
175 |
}
|
|
|
176 |
});
|
1329 |
cyprien |
177 |
|
|
|
178 |
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
|
687 |
jp_milcent |
179 |
|
|
|
180 |
this.add(liaisonFieldSet);
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
private void creerFieldsetAdministratif() {
|
|
|
184 |
// Fieldset ADMINISTRATIF
|
|
|
185 |
FieldSet administratifFieldSet = new FieldSet();
|
1680 |
raphael |
186 |
administratifFieldSet.setHeadingHtml(i18nC.collectionGeneralTitre());
|
687 |
jp_milcent |
187 |
administratifFieldSet.setCollapsible(true);
|
1900 |
aurelien |
188 |
administratifFieldSet.collapse();
|
858 |
jpm |
189 |
administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
687 |
jp_milcent |
190 |
|
859 |
jpm |
191 |
typeDepotCombo = new ChampComboBoxListeValeurs(i18nC.typeDepot(), "typeDepot", tabIndex++);
|
|
|
192 |
administratifFieldSet.add(typeDepotCombo);
|
862 |
jpm |
193 |
|
865 |
jpm |
194 |
coteChp = new TextField<String>();
|
|
|
195 |
coteChp.setTabIndex(tabIndex++);
|
|
|
196 |
coteChp.setFieldLabel(i18nC.cote());
|
|
|
197 |
administratifFieldSet.add(coteChp, new FormData(450, 0));
|
862 |
jpm |
198 |
|
|
|
199 |
nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
|
687 |
jp_milcent |
200 |
administratifFieldSet.add(nomsAlternatifsChp);
|
|
|
201 |
|
862 |
jpm |
202 |
codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
|
687 |
jp_milcent |
203 |
administratifFieldSet.add(codesAlternatifsChp);
|
|
|
204 |
|
|
|
205 |
this.add(administratifFieldSet);
|
|
|
206 |
}
|
|
|
207 |
|
|
|
208 |
private void creerFieldsetDescription() {
|
|
|
209 |
// Fieldset DESCRIPTION
|
862 |
jpm |
210 |
FieldSet descriptionFieldSet = new FieldSet();
|
1680 |
raphael |
211 |
descriptionFieldSet.setHeadingHtml(i18nC.collectionDescriptionTitre());
|
687 |
jp_milcent |
212 |
descriptionFieldSet.setCollapsible(true);
|
858 |
jpm |
213 |
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
687 |
jp_milcent |
214 |
|
862 |
jpm |
215 |
descriptionChp = new TextArea();
|
687 |
jp_milcent |
216 |
descriptionChp.setFieldLabel(i18nC.description());
|
|
|
217 |
descriptionFieldSet.add(descriptionChp, new FormData(550, 0));
|
|
|
218 |
|
862 |
jpm |
219 |
historiqueChp = new TextArea();
|
687 |
jp_milcent |
220 |
historiqueChp.setFieldLabel(i18nC.historique());
|
|
|
221 |
descriptionFieldSet.add(historiqueChp, new FormData(550, 0));
|
|
|
222 |
|
862 |
jpm |
223 |
urlsChp = new ChampMultiValeurs(i18nC.urlsCollection());
|
687 |
jp_milcent |
224 |
descriptionFieldSet.add(urlsChp);
|
|
|
225 |
|
|
|
226 |
this.add(descriptionFieldSet);
|
|
|
227 |
}
|
|
|
228 |
|
858 |
jpm |
229 |
private void creerFieldsetCouverture() {
|
|
|
230 |
FieldSet couvertureFieldSet = new FieldSet();
|
1680 |
raphael |
231 |
couvertureFieldSet.setHeadingHtml("Couvertures");
|
858 |
jpm |
232 |
couvertureFieldSet.setCollapsible(true);
|
1900 |
aurelien |
233 |
couvertureFieldSet.collapse();
|
858 |
jpm |
234 |
couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
235 |
|
1018 |
jpm |
236 |
|
1925 |
delphine |
237 |
// à modifier
|
|
|
238 |
//periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
|
|
|
239 |
//couvertureFieldSet.add(periodeConstitutionChp);
|
|
|
240 |
Label labelperiodeDebut = new Label(i18nC.periodeConstitutionDetailForm());
|
|
|
241 |
labelperiodeDebut.setStyleName("labelChampNombreFormat");
|
|
|
242 |
|
|
|
243 |
periodeConstitutionDebutChp = new ChampNombre();
|
|
|
244 |
periodeConstitutionDebutChp.setStyleName("champNombreFormat");
|
|
|
245 |
periodeConstitutionDebutChp.setWidth(55);
|
|
|
246 |
periodeConstitutionDebutChp.setEmptyText(i18nC.publicationDateParution());
|
|
|
247 |
|
|
|
248 |
periodeConstitutionFinChp = new ChampNombre();
|
|
|
249 |
periodeConstitutionFinChp.setStyleName("champNombreFormat");
|
|
|
250 |
periodeConstitutionFinChp.setWidth(55);
|
|
|
251 |
periodeConstitutionFinChp.setEmptyText(i18nC.publicationDateParution());
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
HorizontalPanel conteneurPeriode = new HorizontalPanel();
|
|
|
255 |
conteneurPeriode.setBorderWidth(0);
|
|
|
256 |
|
|
|
257 |
conteneurPeriode.add(labelperiodeDebut);
|
|
|
258 |
conteneurPeriode.add(periodeConstitutionDebutChp);
|
|
|
259 |
conteneurPeriode.add(periodeConstitutionFinChp);
|
|
|
260 |
|
|
|
261 |
couvertureFieldSet.add(conteneurPeriode);
|
|
|
262 |
|
862 |
jpm |
263 |
lieuCouvertureChp = new ChampMultiValeurs(i18nC.lieuCouvertureCollection());
|
|
|
264 |
couvertureFieldSet.add(lieuCouvertureChp);
|
|
|
265 |
|
858 |
jpm |
266 |
this.add(couvertureFieldSet);
|
|
|
267 |
}
|
|
|
268 |
|
1925 |
delphine |
269 |
|
|
|
270 |
|
859 |
jpm |
271 |
private void creerFieldsetType() {
|
|
|
272 |
FieldSet typeFieldSet = new FieldSet();
|
1680 |
raphael |
273 |
typeFieldSet.setHeadingHtml("Spécimens «types»");
|
859 |
jpm |
274 |
typeFieldSet.setCollapsible(true);
|
1900 |
aurelien |
275 |
typeFieldSet.collapse();
|
859 |
jpm |
276 |
typeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
277 |
|
|
|
278 |
specimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.specimenTypeCollection(), "onpi", tabIndex++);
|
|
|
279 |
typeFieldSet.add(specimenTypeCombo);
|
|
|
280 |
|
|
|
281 |
ConteneurMultiChamps nbreTypeConteneur = new ConteneurMultiChamps(i18nC.nbreSpecimenTypeCollection());
|
|
|
282 |
|
|
|
283 |
nbreTypeChp = new NumberField();
|
|
|
284 |
nbreTypeChp.setFormat(NumberFormat.getFormat("#"));
|
|
|
285 |
nbreTypeConteneur.ajouterChamp(nbreTypeChp, new HBoxLayoutData(new Margins(0, 20, 0, 0)));
|
|
|
286 |
|
|
|
287 |
precisionTypeNbreCombo = new ChampComboBoxListeValeurs(null, "ea");
|
|
|
288 |
precisionTypeNbreCombo.setTrie("id_valeur");
|
|
|
289 |
precisionTypeNbreCombo.setEmptyText(i18nC.precisionNbreSpecimenTypeCollectionChpVide());
|
|
|
290 |
nbreTypeConteneur.ajouterChamp(precisionTypeNbreCombo);
|
|
|
291 |
|
|
|
292 |
typeFieldSet.add(nbreTypeConteneur);
|
|
|
293 |
|
|
|
294 |
classementSpecimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.classementSpecimenTypeCollection(), "typeClassement", tabIndex++);
|
|
|
295 |
typeFieldSet.add(classementSpecimenTypeCombo);
|
|
|
296 |
|
|
|
297 |
Text infoType = new Text(i18nC.specimenTypeCollectionInfo());
|
|
|
298 |
typeFieldSet.add(infoType);
|
|
|
299 |
|
|
|
300 |
this.add(typeFieldSet);
|
|
|
301 |
}
|
|
|
302 |
|
867 |
jpm |
303 |
public void peupler() {
|
875 |
jpm |
304 |
initialiserCollection();
|
867 |
jpm |
305 |
if (collection != null) {
|
|
|
306 |
idCollectionChp.setValue(collection.getId());
|
875 |
jpm |
307 |
setValeurComboStructures();
|
|
|
308 |
setValeurComboCollections();
|
867 |
jpm |
309 |
|
|
|
310 |
typeDepotCombo.peupler(collection.getTypeDepot());
|
|
|
311 |
coteChp.setValue(collection.getCote());
|
|
|
312 |
nomsAlternatifsChp.peupler(collection.getNomAlternatif());
|
|
|
313 |
codesAlternatifsChp.peupler(collection.getCode());
|
|
|
314 |
|
|
|
315 |
descriptionChp.setValue(collection.getDescription());
|
|
|
316 |
historiqueChp.setValue(collection.getHistorique());
|
|
|
317 |
urlsChp.peupler(collection.getUrls());
|
|
|
318 |
|
1925 |
delphine |
319 |
if(!collection.getPeriodeConstitutionDebut().equals("0")) {
|
|
|
320 |
periodeConstitutionDebutChp.setValue((Integer.parseInt(collection.getPeriodeConstitutionDebut())));
|
|
|
321 |
}
|
|
|
322 |
if(!collection.getPeriodeConstitutionFin().equals("0")) {
|
|
|
323 |
periodeConstitutionFinChp.setValue((Integer.parseInt(collection.getPeriodeConstitutionFin())));
|
|
|
324 |
}
|
867 |
jpm |
325 |
lieuCouvertureChp.peupler(collection.getCouvertureLieu());
|
|
|
326 |
|
|
|
327 |
specimenTypeCombo.peupler(collection.getSpecimenType());
|
875 |
jpm |
328 |
nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
|
867 |
jpm |
329 |
precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
|
|
|
330 |
classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
|
|
|
331 |
}
|
|
|
332 |
}
|
|
|
333 |
|
875 |
jpm |
334 |
public ArrayList<String> verifier() {
|
|
|
335 |
ArrayList<String> messages = new ArrayList<String>();
|
|
|
336 |
return messages;
|
|
|
337 |
}
|
|
|
338 |
|
867 |
jpm |
339 |
public void collecter() {
|
875 |
jpm |
340 |
initialiserCollection();
|
1613 |
aurelien |
341 |
// l'onglet collection est obligatoirement rempli lors d'un ajout
|
|
|
342 |
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
|
867 |
jpm |
343 |
collectionCollectee.setId(idCollectionChp.getValue());
|
875 |
jpm |
344 |
collectionCollectee.setIdStructure(getValeurComboStructures());
|
|
|
345 |
collectionCollectee.setCollectionMereId(getValeurComboCollections());
|
867 |
jpm |
346 |
|
|
|
347 |
collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
|
|
|
348 |
collectionCollectee.setCote(coteChp.getValue());
|
|
|
349 |
collectionCollectee.setNomAlternatif(nomsAlternatifsChp.getValeurs());
|
|
|
350 |
collectionCollectee.setCode(codesAlternatifsChp.getValeurs());
|
|
|
351 |
|
|
|
352 |
collectionCollectee.setDescription(descriptionChp.getValue());
|
|
|
353 |
collectionCollectee.setHistorique(historiqueChp.getValue());
|
|
|
354 |
collectionCollectee.setUrls(urlsChp.getValeurs());
|
|
|
355 |
|
1925 |
delphine |
356 |
collectionCollectee.setPeriodeConstitutionDebut((Integer) periodeConstitutionDebutChp.getValue());
|
|
|
357 |
collectionCollectee.setPeriodeConstitutionFin((Integer) periodeConstitutionFinChp.getValue());
|
867 |
jpm |
358 |
collectionCollectee.setCouvertureLieu(lieuCouvertureChp.getValeurs());
|
|
|
359 |
|
|
|
360 |
collectionCollectee.setSpecimenType(specimenTypeCombo.getValeur());
|
968 |
jpm |
361 |
if (nbreTypeChp.getValue() != null) {
|
|
|
362 |
collectionCollectee.setSpecimenTypeNbre(nbreTypeChp.getValue().toString());
|
|
|
363 |
}
|
867 |
jpm |
364 |
collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
|
|
|
365 |
collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
|
|
|
366 |
}
|
|
|
367 |
}
|
|
|
368 |
|
875 |
jpm |
369 |
private String getValeurComboStructures() {
|
|
|
370 |
String valeur = "";
|
1329 |
cyprien |
371 |
if (structuresCombo.getCombo().getValue() != null) {
|
|
|
372 |
Structure structure = new Structure(structuresCombo.getValeur());
|
|
|
373 |
valeur = structure.getId();
|
875 |
jpm |
374 |
}
|
|
|
375 |
return valeur;
|
|
|
376 |
}
|
|
|
377 |
private void setValeurComboStructures() {
|
1513 |
jpm |
378 |
if (structuresCombo.getCombo().getStore() != null
|
1428 |
cyprien |
379 |
&& collection != null
|
|
|
380 |
&& collection.getStructureNom() != null
|
|
|
381 |
&& !UtilString.isEmpty(collection.getStructureNom())) {
|
|
|
382 |
structuresCombo.chargerValeurInitiale(collection.getStructureNom(), "cs_nom");
|
|
|
383 |
} else {
|
|
|
384 |
structuresCombo.getCombo().setValue(null);
|
867 |
jpm |
385 |
}
|
|
|
386 |
}
|
|
|
387 |
|
875 |
jpm |
388 |
private String getValeurComboCollections() {
|
|
|
389 |
String valeur = "";
|
1329 |
cyprien |
390 |
if (collectionsCombo.getCombo().getValue() != null) {
|
|
|
391 |
Collection collection = new Collection(collectionsCombo.getValeur());
|
|
|
392 |
valeur = collection.getId();
|
875 |
jpm |
393 |
}
|
|
|
394 |
return valeur;
|
|
|
395 |
}
|
1428 |
cyprien |
396 |
private void setValeurComboCollections() {
|
|
|
397 |
if (collectionsCombo.getCombo().getStore() != null
|
|
|
398 |
&& collection != null
|
|
|
399 |
&& collection.getCollectionMereNom() != null
|
|
|
400 |
&& !UtilString.isEmpty(collection.getCollectionMereNom())) {
|
|
|
401 |
collectionsCombo.chargerValeurInitiale(collection.getCollectionMereNom(), "cc_nom");
|
867 |
jpm |
402 |
}
|
|
|
403 |
}
|
|
|
404 |
|
687 |
jp_milcent |
405 |
public void rafraichir(Object nouvellesDonnees) {
|
1329 |
cyprien |
406 |
if (nouvellesDonnees instanceof ValeurListe) {
|
858 |
jpm |
407 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
|
|
408 |
rafraichirValeurListe(listeValeurs);
|
687 |
jp_milcent |
409 |
} else {
|
951 |
jpm |
410 |
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
|
687 |
jp_milcent |
411 |
}
|
|
|
412 |
}
|
|
|
413 |
|
|
|
414 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
858 |
jpm |
415 |
if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
|
831 |
jpm |
416 |
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
|
687 |
jp_milcent |
417 |
} else {
|
951 |
jpm |
418 |
Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
|
687 |
jp_milcent |
419 |
}
|
|
|
420 |
}
|
|
|
421 |
|
703 |
jp_milcent |
422 |
|
687 |
jp_milcent |
423 |
|
|
|
424 |
}
|