Line 8... |
Line 8... |
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
10 |
import org.tela_botanica.client.composants.ChampMultiValeurs;
|
10 |
import org.tela_botanica.client.composants.ChampMultiValeurs;
|
11 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
11 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
12 |
import org.tela_botanica.client.composants.pagination.ProxyCollections;
|
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;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
15 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
16 |
import org.tela_botanica.client.modeles.ValeurListe;
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
17 |
import org.tela_botanica.client.modeles.collection.Collection;
|
16 |
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;
|
17 |
import org.tela_botanica.client.modeles.structure.Structure;
|
20 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
18 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
21 |
import org.tela_botanica.client.util.Debug;
|
19 |
import org.tela_botanica.client.util.Debug;
|
22 |
import org.tela_botanica.client.util.UtilString;
|
20 |
import org.tela_botanica.client.util.UtilString;
|
23 |
import org.tela_botanica.client.vues.Formulaire;
|
21 |
import org.tela_botanica.client.vues.Formulaire;
|
Line 45... |
Line 43... |
45 |
private Collection collection = null;
|
43 |
private Collection collection = null;
|
46 |
private Collection collectionCollectee = null;
|
44 |
private Collection collectionCollectee = null;
|
Line 47... |
Line 45... |
47 |
|
45 |
|
Line 48... |
Line -... |
48 |
private HiddenField<String> idCollectionChp = null;
|
- |
|
49 |
|
46 |
private HiddenField<String> idCollectionChp = null;
|
50 |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
|
47 |
|
Line 51... |
Line 48... |
51 |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
|
48 |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
|
52 |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
|
49 |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
|
Line 106... |
Line 103... |
106 |
liaisonFieldSet.setCollapsible(true);
|
103 |
liaisonFieldSet.setCollapsible(true);
|
107 |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
104 |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
Line 108... |
Line 105... |
108 |
|
105 |
|
109 |
|
- |
|
110 |
//+-----------------------------------------------------------------------------------------------------------+
|
- |
|
111 |
// Champ Projets
|
- |
|
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";
|
- |
|
120 |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
|
- |
|
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() {
|
- |
|
131 |
public String validate(Field<?> field, String value) {
|
- |
|
132 |
String retour = null;
|
- |
|
133 |
if (field.getRawValue().equals("")) {
|
- |
|
134 |
field.setValue(null);
|
- |
|
135 |
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
|
- |
|
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 |
});
|
- |
|
144 |
|
- |
|
145 |
liaisonFieldSet.add(projetsCombo, new FormData(600, 0));
|
- |
|
146 |
|
- |
|
147 |
|
106 |
|
Line 148... |
Line 107... |
148 |
//+-----------------------------------------------------------------------------------------------------------+
|
107 |
//+-----------------------------------------------------------------------------------------------------------+
|
149 |
// Champ Structures
|
108 |
// Champ Structures
|
150 |
|
109 |
|
Line 327... |
Line 286... |
327 |
|
286 |
|
328 |
public void peupler() {
|
287 |
public void peupler() {
|
329 |
initialiserCollection();
|
288 |
initialiserCollection();
|
330 |
if (collection != null) {
|
289 |
if (collection != null) {
|
331 |
idCollectionChp.setValue(collection.getId());
|
- |
|
332 |
setValeurComboProjets();
|
290 |
idCollectionChp.setValue(collection.getId());
|
333 |
setValeurComboStructures();
|
291 |
setValeurComboStructures();
|
Line 334... |
Line 292... |
334 |
setValeurComboCollections();
|
292 |
setValeurComboCollections();
|
335 |
|
293 |
|
Line 356... |
Line 314... |
356 |
}
|
314 |
}
|
357 |
}
|
315 |
}
|
Line 358... |
Line 316... |
358 |
|
316 |
|
359 |
public ArrayList<String> verifier() {
|
317 |
public ArrayList<String> verifier() {
|
360 |
ArrayList<String> messages = new ArrayList<String>();
|
- |
|
361 |
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) {
|
- |
|
362 |
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
|
- |
|
363 |
}
|
318 |
ArrayList<String> messages = new ArrayList<String>();
|
364 |
return messages;
|
319 |
return messages;
|
Line 365... |
Line 320... |
365 |
}
|
320 |
}
|
366 |
|
321 |
|
367 |
public void collecter() {
|
322 |
public void collecter() {
|
368 |
initialiserCollection();
|
323 |
initialiserCollection();
|
369 |
// l'onglet collection est obligatoirement rempli lors d'un ajout
|
324 |
// l'onglet collection est obligatoirement rempli lors d'un ajout
|
370 |
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
|
- |
|
371 |
collectionCollectee.setId(idCollectionChp.getValue());
|
325 |
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
|
372 |
collectionCollectee.setIdProjet(getValeurComboProjets());
|
326 |
collectionCollectee.setId(idCollectionChp.getValue());
|
Line 373... |
Line 327... |
373 |
collectionCollectee.setIdStructure(getValeurComboStructures());
|
327 |
collectionCollectee.setIdStructure(getValeurComboStructures());
|
374 |
collectionCollectee.setCollectionMereId(getValeurComboCollections());
|
328 |
collectionCollectee.setCollectionMereId(getValeurComboCollections());
|
Line 396... |
Line 350... |
396 |
collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
|
350 |
collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
|
397 |
collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
|
351 |
collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
|
398 |
}
|
352 |
}
|
399 |
}
|
353 |
}
|
Line 400... |
Line -... |
400 |
|
- |
|
401 |
private String getValeurComboProjets() {
|
- |
|
402 |
String valeur = "";
|
- |
|
403 |
if (projetsCombo.getCombo().getValue() != null) {
|
- |
|
404 |
Projet projet = new Projet(projetsCombo.getValeur());
|
- |
|
405 |
valeur = projet.getId();
|
- |
|
406 |
}
|
- |
|
407 |
return valeur;
|
- |
|
408 |
}
|
- |
|
409 |
private void setValeurComboProjets() {
|
- |
|
410 |
if (projetsCombo.getCombo().getStore() != null
|
- |
|
411 |
&& collection != null
|
- |
|
412 |
&& collection.getIdProjet() != null
|
- |
|
413 |
&& !UtilString.isEmpty(collection.getIdProjet())) {
|
- |
|
414 |
projetsCombo.chargerValeurInitiale(collection.getIdProjet(), "cpr_id_projet");
|
- |
|
415 |
} else {
|
- |
|
416 |
projetsCombo.getCombo().setValue(null);
|
- |
|
417 |
}
|
- |
|
418 |
}
|
- |
|
419 |
|
354 |
|
420 |
private String getValeurComboStructures() {
|
355 |
private String getValeurComboStructures() {
|
421 |
String valeur = "";
|
356 |
String valeur = "";
|
422 |
if (structuresCombo.getCombo().getValue() != null) {
|
357 |
if (structuresCombo.getCombo().getValue() != null) {
|
423 |
Structure structure = new Structure(structuresCombo.getValeur());
|
358 |
Structure structure = new Structure(structuresCombo.getValeur());
|