Subversion Repositories eFlore/Applications.coel

Rev

Rev 867 | Rev 928 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 867 Rev 875
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line -... Line 2...
-
 
2
 
-
 
3
import java.util.ArrayList;
2
 
4
 
3
import org.tela_botanica.client.Mediateur;
5
import org.tela_botanica.client.Mediateur;
4
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
6
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
5
import org.tela_botanica.client.composants.ChampMultiValeurs;
7
import org.tela_botanica.client.composants.ChampMultiValeurs;
6
import org.tela_botanica.client.composants.ConteneurMultiChamps;
8
import org.tela_botanica.client.composants.ConteneurMultiChamps;
Line 66... Line 68...
66
	public CollectionFormGeneral(Formulaire formulaireCourrant) {
68
	public CollectionFormGeneral(Formulaire formulaireCourrant) {
67
		initialiserOnglet(formulaireCourrant);
69
		initialiserOnglet(formulaireCourrant);
68
		setId("general");
70
		setId("general");
69
		setText(Mediateur.i18nC.collectionGeneral());
71
		setText(Mediateur.i18nC.collectionGeneral());
Line 70... Line -...
70
		
-
 
71
		collection = ((CollectionForm) formulaire).collection;
-
 
72
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
-
 
73
		
72
		
74
		creerChampsCache();
73
		creerChampsCache();
75
		creerFieldsetLiaison();
74
		creerFieldsetLiaison();
76
		creerFieldsetAdministratif();
75
		creerFieldsetAdministratif();
77
		creerFieldsetDescription();
76
		creerFieldsetDescription();
78
		creerFieldsetCouverture();
77
		creerFieldsetCouverture();
79
		creerFieldsetType();
78
		creerFieldsetType();
Line -... Line 79...
-
 
79
	}
-
 
80
 
-
 
81
	private void initialiserCollection() {
-
 
82
		collection = ((CollectionForm) formulaire).collection;
-
 
83
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
80
	}
84
	}
81
 
85
	
82
	private void creerChampsCache() {
86
	private void creerChampsCache() {
83
		// Champs cachés
87
		// Champs cachés
84
		idCollectionChp = new HiddenField<String>();
88
		idCollectionChp = new HiddenField<String>();
Line 271... Line 275...
271
		
275
		
272
		this.add(typeFieldSet);
276
		this.add(typeFieldSet);
Line 273... Line 277...
273
	}
277
	}
-
 
278
	
274
	
279
	public void peupler() {
275
	public void peupler() {
280
		initialiserCollection();
-
 
281
		if (collection != null) {
-
 
282
			idCollectionChp.setValue(collection.getId());
-
 
283
			setValeurComboProjets();
Line 276... Line 284...
276
		if (collection != null) {
284
			setValeurComboStructures();
277
			idCollectionChp.setValue(collection.getId());
285
			setValeurComboCollections();
278
			
286
			
279
			typeDepotCombo.peupler(collection.getTypeDepot());
287
			typeDepotCombo.peupler(collection.getTypeDepot());
Line 290... Line 298...
290
			groupementPrincipeCombo.peupler(collection.getGroupementPrincipe());
298
			groupementPrincipeCombo.peupler(collection.getGroupementPrincipe());
291
			butRealisationCombo.peupler(collection.getGroupementBut());
299
			butRealisationCombo.peupler(collection.getGroupementBut());
292
			lieuCouvertureChp.peupler(collection.getCouvertureLieu());
300
			lieuCouvertureChp.peupler(collection.getCouvertureLieu());
Line 293... Line 301...
293
			
301
			
294
			specimenTypeCombo.peupler(collection.getSpecimenType());
302
			specimenTypeCombo.peupler(collection.getSpecimenType());
295
			nbreTypeChp.setValue(Integer.parseInt(collection.getSpecimenTypeNbre()));
303
			nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
296
			precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
304
			precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
297
			classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
305
			classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
298
		}
306
		}
Line -... Line 307...
-
 
307
	}
-
 
308
	
-
 
309
	public ArrayList<String> verifier() {
-
 
310
		ArrayList<String> messages = new ArrayList<String>();
-
 
311
		if (projetsCombo.getValue() == null || projetsCombo.getValue().equals("") || collection.getIdProjet().equals("")) {
-
 
312
			messages.add("Veuillez sélectionner un projet pour la collection.");
-
 
313
		}
-
 
314
		return messages;
299
	}
315
	}
-
 
316
	
300
	
317
	public void collecter() {
301
	public void collecter() {
318
		initialiserCollection();
-
 
319
		if (etreAccede()) {
-
 
320
			collectionCollectee.setId(idCollectionChp.getValue());
-
 
321
			collectionCollectee.setCollectionMereId(getValeurComboProjets());
Line 302... Line 322...
302
		if (etreAccede()) {
322
			collectionCollectee.setIdStructure(getValeurComboStructures());
303
			collectionCollectee.setId(idCollectionChp.getValue());
323
			collectionCollectee.setCollectionMereId(getValeurComboCollections());
304
			
324
			
305
			collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
325
			collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
Line 322... Line 342...
322
			collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
342
			collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
323
			collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
343
			collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
324
		}
344
		}
325
	}
345
	}
Line -... Line 346...
-
 
346
	
-
 
347
	private String getValeurComboProjets() {
-
 
348
		String valeur = "";
-
 
349
		if (projetsCombo.getValue() != null) {
-
 
350
			valeur = projetsCombo.getValue().getId();
-
 
351
		}
-
 
352
		return valeur;
326
	
353
	}
327
	private void mettreAJourValeurComboProjets() {
354
	private void setValeurComboProjets() {
328
		if (projetsCombo.getStore() != null && collection != null) {
355
		if (projetsCombo.getStore() != null && collection != null) {
329
			projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
356
			projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
330
		}
357
		}
Line -... Line 358...
-
 
358
	}
-
 
359
	
-
 
360
	private String getValeurComboStructures() {
-
 
361
		String valeur = "";
-
 
362
		if (structuresCombo.getValue() != null) {
-
 
363
			valeur = structuresCombo.getValue().getId();
-
 
364
		}
331
	}
365
		return valeur;
332
	
366
	}
333
	private void mettreAJourValeurComboStructures() {
367
	private void setValeurComboStructures() {
334
		if (structuresCombo.getStore() != null && collection != null) {
368
		if (structuresCombo.getStore() != null && collection != null) {
335
			structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
369
			structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
Line -... Line 370...
-
 
370
		}
-
 
371
	}
-
 
372
	
-
 
373
	private String getValeurComboCollections() {
-
 
374
		String valeur = "";
-
 
375
		if (collectionsCombo.getValue() != null) {
-
 
376
			valeur = collectionsCombo.getValue().getId();
336
		}
377
		}
337
	}
378
		return valeur;
338
	
379
	}
339
	private void mettreAJourValeurComboCollections() {
380
	private void setValeurComboCollections() {
340
		if (collectionsCombo.getStore() != null && collection != null) {
381
		if (collectionsCombo.getStore() != null && collection != null) {
Line 341... Line 382...
341
			collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
382
			collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
342
		}
383
		}
343
	}
384
	}
344
	
385
	
345
	public void rafraichir(Object nouvellesDonnees) {
386
	public void rafraichir(Object nouvellesDonnees) {
346
		if (nouvellesDonnees instanceof ProjetListe) {
387
		if (nouvellesDonnees instanceof ProjetListe) {
347
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
388
			ProjetListe projets = (ProjetListe) nouvellesDonnees;
348
			Formulaire.rafraichirComboBox(projets, projetsCombo);
389
			Formulaire.rafraichirComboBox(projets, projetsCombo);
349
			mettreAJourValeurComboProjets();
390
			setValeurComboProjets();
350
		} else if (nouvellesDonnees instanceof StructureListe) {
391
		} else if (nouvellesDonnees instanceof StructureListe) {
351
			StructureListe structures = (StructureListe) nouvellesDonnees;
392
			StructureListe structures = (StructureListe) nouvellesDonnees;
352
			Formulaire.rafraichirComboBox(structures, structuresCombo);
393
			Formulaire.rafraichirComboBox(structures, structuresCombo);
353
			mettreAJourValeurComboStructures();
394
			setValeurComboStructures();
354
		} else if (nouvellesDonnees instanceof CollectionListe) {
395
		} else if (nouvellesDonnees instanceof CollectionListe) {
355
			CollectionListe collections = (CollectionListe) nouvellesDonnees;
396
			CollectionListe collections = (CollectionListe) nouvellesDonnees;
356
			Formulaire.rafraichirComboBox(collections, collectionsCombo);
397
			Formulaire.rafraichirComboBox(collections, collectionsCombo);
357
			mettreAJourValeurComboCollections();
398
			setValeurComboCollections();
358
		} else if (nouvellesDonnees instanceof ValeurListe) {
399
		} else if (nouvellesDonnees instanceof ValeurListe) {