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