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