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