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