Subversion Repositories eFlore/Applications.coel

Rev

Rev 206 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 206 Rev 211
Line 14... Line 14...
14
import org.tela_botanica.client.modeles.Information;
14
import org.tela_botanica.client.modeles.Information;
15
import org.tela_botanica.client.modeles.InterneValeur;
15
import org.tela_botanica.client.modeles.InterneValeur;
16
import org.tela_botanica.client.modeles.InterneValeurListe;
16
import org.tela_botanica.client.modeles.InterneValeurListe;
17
import org.tela_botanica.client.modeles.Personne;
17
import org.tela_botanica.client.modeles.Personne;
18
import org.tela_botanica.client.modeles.Structure;
18
import org.tela_botanica.client.modeles.Structure;
-
 
19
import org.tela_botanica.client.modeles.StructureAPersonne;
-
 
20
import org.tela_botanica.client.modeles.StructureAPersonneListe;
19
import org.tela_botanica.client.modeles.StructureConservation;
21
import org.tela_botanica.client.modeles.StructureConservation;
-
 
22
import org.tela_botanica.client.modeles.StructureListe;
20
import org.tela_botanica.client.modeles.StructureValorisation;
23
import org.tela_botanica.client.modeles.StructureValorisation;
21
import org.tela_botanica.client.modeles.Valeur;
24
import org.tela_botanica.client.modeles.Valeur;
22
import org.tela_botanica.client.modeles.ValeurListe;
25
import org.tela_botanica.client.modeles.ValeurListe;
Line 23... Line 26...
23
 
26
 
24
import com.extjs.gxt.ui.client.Events;
27
import com.extjs.gxt.ui.client.Events;
25
import com.extjs.gxt.ui.client.Registry;
28
import com.extjs.gxt.ui.client.Registry;
26
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
29
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
-
 
30
import com.extjs.gxt.ui.client.Style.Scroll;
27
import com.extjs.gxt.ui.client.Style.Scroll;
31
import com.extjs.gxt.ui.client.event.BaseEvent;
28
import com.extjs.gxt.ui.client.event.ComponentEvent;
32
import com.extjs.gxt.ui.client.event.ComponentEvent;
29
import com.extjs.gxt.ui.client.event.Listener;
33
import com.extjs.gxt.ui.client.event.Listener;
30
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
34
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
31
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
35
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
Line 97... Line 101...
97
	private TabItem conservationOnglet = null;
101
	private TabItem conservationOnglet = null;
98
	private TabItem valorisationOnglet = null;
102
	private TabItem valorisationOnglet = null;
Line 99... Line 103...
99
 
103
 
Line 100... Line -...
100
	private HiddenField<String> idStructureChp = null;
-
 
101
	
-
 
102
	private StructureConservation conservation = null;
-
 
103
	private StructureValorisation valorisation = null;
104
	private HiddenField<String> idStructureChp = null;
-
 
105
	
104
	
106
	// Onglet IDENTIFICATION
105
	// Onglet IDENTIFICATION
107
	private Structure identification;
106
	private ListStore<Valeur> magazinLstpr = null;
108
	private ListStore<Valeur> magazinLstpr = null;
107
	private ComboBox<Valeur> comboLstpr = null;
109
	private ComboBox<Valeur> comboLstpr = null;
108
	private ListStore<Valeur> magazinLstpu = null;
110
	private ListStore<Valeur> magazinLstpu = null;
Line 127... Line 129...
127
	private TextField<String> urlChp;
129
	private TextField<String> urlChp;
128
	private ListStore<Valeur> magazinPays;
130
	private ListStore<Valeur> magazinPays;
129
	private ComboBox<Valeur> comboPays;
131
	private ComboBox<Valeur> comboPays;
Line 130... Line 132...
130
 
132
 
131
	// Onglet PERSONNEL
-
 
132
	private EditorGrid<Personne> grillePersonnel = null;
-
 
133
	private ListStore<Personne> personnelGrilleMagazin = null;
133
	// Onglet PERSONNEL
134
	private LabelField nbreTotalPersonnelChp = null;
134
	private ArrayList<StructureAPersonne> personnel;
-
 
135
	private NumberField nbreTotalPersonneStructureChp = null;
-
 
136
	private EditorGrid<StructureAPersonne> grillePersonnel = null;
-
 
137
	private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
Line 135... Line 138...
135
	private NumberField nbreTotalPersonneStructureChp = null;
138
	private LabelField nbreTotalPersonnelChp = null;
-
 
139
	
136
 
140
	// Onglet CONSERVATION
137
	// Onglet CONSERVATION
141
	private StructureConservation conservation = null;
138
	private RadioGroup formationMarkRGrpChp;
142
	private RadioGroup formationMarkRGrpChp;
139
	private RadioGroup interetFormationMarkRGrpChp;
143
	private RadioGroup interetFormationMarkRGrpChp;
140
	private RadioGroup collectionCommuneMarkRGrpChp;
144
	private RadioGroup collectionCommuneMarkRGrpChp;
Line 187... Line 191...
187
	private RadioGroup traitementAcquisitionMarkRGrpChp = null;
191
	private RadioGroup traitementAcquisitionMarkRGrpChp = null;
188
	private LabelField traitementAcquisitionMarkLabel = null;
192
	private LabelField traitementAcquisitionMarkLabel = null;
189
	private RadioGroup materielConservationCeRGrpChp = null;
193
	private RadioGroup materielConservationCeRGrpChp = null;
Line 190... Line 194...
190
 
194
 
-
 
195
	// Onglet VALORISATION
191
	// Onglet VALORISATION
196
	private StructureValorisation valorisation = null;
192
	private RadioGroup actionMarkRGrpChp = null;
197
	private RadioGroup actionMarkRGrpChp = null;
193
	private ContentPanel actionTrukCp = null;
198
	private ContentPanel actionTrukCp = null;
194
	private CheckBoxGroup actionTrukCacGrpChp = null;
199
	private CheckBoxGroup actionTrukCacGrpChp = null;
195
	private RadioGroup futureActionMarkRGrpChp;
200
	private RadioGroup futureActionMarkRGrpChp;
196
	private RadioGroup rechercheMarkRGrpChp;
201
	private RadioGroup rechercheMarkRGrpChp;
197
	private RadioGroup sansMotifAccesMarkRGrpChp;
202
	private RadioGroup sansMotifAccesMarkRGrpChp;
198
	private RadioGroup avecMotifAccesMarkRGrpChp;
203
	private RadioGroup avecMotifAccesMarkRGrpChp;
199
	private TextField<String> publicationChp;
204
	private TextField<String> publicationChp;
Line -... Line 205...
-
 
205
	private ContentPanel materielConservationCp;
-
 
206
 
200
	private ContentPanel materielConservationCp;
207
 
201
 
208
 
202
	public FormStructureVue() {
209
	public FormStructureVue() {
203
		//+-----------------------------------------------------------------------------------------------------------+		
210
		//+-----------------------------------------------------------------------------------------------------------+		
204
		// Initialisation de variables
211
		// Initialisation de variables
Line 241... Line 248...
241
		
248
		
242
		//+-----------------------------------------------------------------------------------------------------------+
249
		//+-----------------------------------------------------------------------------------------------------------+
Line 243... Line 250...
243
		// Gestion du FORMULAIRE GÉNÉRAL
250
		// Gestion du FORMULAIRE GÉNÉRAL
244
		
251
		
Line 245... Line 252...
245
		// Sélection de l'onglet par défaut
252
		// Sélection de l'onglet par défaut
246
		onglets.setSelection(valorisationOnglet);
253
		onglets.setSelection(personnelOnglet);
Line 247... Line 254...
247
		
254
		
Line 282... Line 289...
282
		if (mode == "AJOUT") {
289
		if (mode == "AJOUT") {
283
			//mediateur.ajouterStructure(this, structure);
290
			//mediateur.ajouterStructure(this, structure);
284
		} else if (mode == "MODIF") {
291
		} else if (mode == "MODIF") {
285
			mediateur.modifierStructure(this, structure, conservation, valorisation);
292
			mediateur.modifierStructure(this, structure, conservation, valorisation);
286
		}
293
		}
287
		GWT.log("Info Structure envoyées :\n"+valorisation.toString(), null);
294
		GWT.log("Info Structure envoyées :\n"+conservation.toString(), null);
288
	}
295
	}
Line 289... Line 296...
289
	
296
	
290
	private StructureValorisation collecterStructureValorisation() {
297
	private StructureValorisation collecterStructureValorisation() {
291
		if (valorisationOnglet.getData("acces").equals(false)) {
298
		if (valorisationOnglet.getData("acces").equals(false)) {
Line 349... Line 356...
349
	}
356
	}
Line 350... Line 357...
350
	
357
	
351
	private void peuplerStructureValorisation() {
358
	private void peuplerStructureValorisation() {
352
		if (valorisation != null) {
359
		if (valorisation != null) {
353
			// ACTION
360
			// ACTION
Line 354... Line 361...
354
			actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue((valorisation.getAction().equals("1") ? true : false));
361
			actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1)).setValue(true);
355
			
362
			
Line 356... Line 363...
356
			// ACTION INFO
363
			// ACTION INFO
Line 361... Line 368...
361
			
368
			
362
			// COLLECTION AUTRE
369
			// COLLECTION AUTRE
Line 363... Line 370...
363
			peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
370
			peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
364
			
371
			
Line 365... Line 372...
365
			// ACTION FUTURE
372
			// ACTION FUTURE
366
			futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1)).setValue((valorisation.getActionFuture().equals("1") ? true : false));
373
			futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1)).setValue(true);
Line 367... Line 374...
367
			
374
			
368
			// ACTION FUTURE INFO
375
			// ACTION FUTURE INFO
369
			futureActionChp.setValue(valorisation.getActionFutureInfo());
376
			futureActionChp.setValue(valorisation.getActionFutureInfo());
370
			
377
			
371
			// RECHERCHE
378
			// RECHERCHE
372
			rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1)).setValue((valorisation.getRecherche().equals("1") ? true : false));
379
			rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1)).setValue(true);
Line 373... Line 380...
373
			// RECHERCHE PROVENANCE
380
			// RECHERCHE PROVENANCE
374
			peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
381
			peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
375
			// RECHERCHE TYPE
382
			// RECHERCHE TYPE
376
			peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
383
			peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
Line 377... Line 384...
377
 
384
 
378
			// ACCÈS SANS MOTIF
385
			// ACCÈS SANS MOTIF
379
			sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1)).setValue((valorisation.getAccesSansMotif().equals("1") ? true : false));
386
			sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1)).setValue(true);
380
			// ACCÈS SANS MOTIF INFO
387
			// ACCÈS SANS MOTIF INFO
-
 
388
			sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
-
 
389
			
381
			sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
390
			// VISITE AVEC MOTIF
382
			
391
			avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1)).setValue(true);
Line 383... Line 392...
383
			// VISITE AVEC MOTIF
392
			// VISITE AVEC MOTIF INFO
384
			avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1)).setValue((valorisation.getVisiteAvecMotif().equals("1") ? true : false));
393
			avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
Line 484... Line 493...
484
	
493
	
485
	private void peuplerStructureConservation() {
494
	private void peuplerStructureConservation() {
486
		if (conservation != null) {
495
		if (conservation != null) {
487
			// FORMATION
496
			// FORMATION
488
			// Bouton oui, à toujours l'index 0 donc on teste en fonction...
497
			// Bouton oui, à toujours l'index 0 donc on teste en fonction...
489
			formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1)).setValue((conservation.getFormation().equals("1") ? true : false));
498
			formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1)).setValue(true);
490
			// FORMATION INFO
499
			// FORMATION INFO
491
			formationChp.setValue(conservation.getFormationInfo());
500
			formationChp.setValue(conservation.getFormationInfo());
492
			// FORMATION INTERET
501
			// FORMATION INTERET
Line 493... Line 502...
493
			interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue((conservation.getFormationInteret().equals("1") ? true : false));
502
			interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1)).setValue(true);
494
	
503
	
Line 495... Line 504...
495
			// STOCKAGE LOCAL		
504
			// STOCKAGE LOCAL		
Line 500... Line 509...
500
	
509
	
501
			// STOCKAGE PAREMETRE
510
			// STOCKAGE PAREMETRE
Line 502... Line 511...
502
			peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
511
			peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
503
			
512
			
504
			// COLLECTION COMMUNE
513
			// COLLECTION COMMUNE
505
			collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue((conservation.getCollectionCommune().equals("1") ? true : false));
514
			collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1)).setValue(true);
Line 506... Line 515...
506
			// COLLECTION AUTRE
515
			// COLLECTION AUTRE
507
			peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
516
			peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
Line 508... Line 517...
508
			
517
			
509
			// ACCÈS CONTROLÉ
518
			// ACCÈS CONTROLÉ
510
			accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1)).setValue((conservation.getAccesControle().equals("1") ? true : false));
519
			accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1)).setValue(true);
511
			
520
			
Line 512... Line 521...
512
			// RESTAURATION
521
			// RESTAURATION
513
			restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue((conservation.getRestauration().equals("1") ? true : false));
522
			restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1)).setValue(true);
Line 514... Line 523...
514
			// RESTAURATION OPÉRATION
523
			// RESTAURATION OPÉRATION
515
			peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
524
			peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
Line 516... Line 525...
516
			
525
			
517
			// MATERIEL CONSERVATION
526
			// MATERIEL CONSERVATION
518
			peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
527
			peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
519
			
528
			
Line 520... Line 529...
520
			// MATERIEL AUTRE
529
			// MATERIEL AUTRE
521
			peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
530
			peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
Line 522... Line 531...
522
			
531
			
523
			// TRAITEMENT
532
			// TRAITEMENT
Line 524... Line 533...
524
			traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue((conservation.getTraitement().equals("1") ? true : false));
533
			traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1)).setValue(true);
525
			// TRAITEMENTS
534
			// TRAITEMENTS
Line 526... Line 535...
526
			peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
535
			peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
527
			
536
			
528
			// ACQUISITION COLLECTION
537
			// ACQUISITION COLLECTION
529
			collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionCollection().equals("1") ? true : false));
538
			collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1)).setValue(true);
-
 
539
			
-
 
540
			// ACQUISITION ECHANTILLON
530
			
541
			echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue(true);
531
			// ACQUISITION ECHANTILLON
542
			
Line 532... Line 543...
532
			echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionEchantillon().equals("1") ? true : false));
543
			// ACQUISITION TRAITEMENT
-
 
544
			traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue(true);
533
			
545
			
-
 
546
			// ACQUISITION TRAITEMENT POISON
534
			// ACQUISITION TRAITEMENT
547
			peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
535
			traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1)).setValue((conservation.getAcquisitionTraitement().equals("1") ? true : false));
548
			// ACQUISITION TRAITEMENT INSECTE
536
			
549
			peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
537
			// ACQUISITION TRAITEMENT POISON
550
			
538
			peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
551
			conservationOnglet.layout();
Line 583... Line 596...
583
		structure.setTelephone(telChp.getValue());
596
			structure.setTelephone(telChp.getValue());
584
		structure.setFax(faxChp.getValue());
597
			structure.setFax(faxChp.getValue());
585
		structure.setCourriel(emailChp.getValue());
598
			structure.setCourriel(emailChp.getValue());
586
		structure.setUrl(Structure.URL_SITE, urlChp.getValue());
599
			structure.setUrl(Structure.URL_SITE, urlChp.getValue());
Line 587... Line -...
587
		
-
 
588
		// CONSERVATION
-
 
589
		
600
			
590
		return structure;
601
			return structure;
-
 
602
		}
Line 591... Line 603...
591
	}
603
	}
-
 
604
	
592
	
605
	private void peuplerStructureIdentification() {
593
	private void peuplerStructureIdentification(Structure str) {
606
		if (identification != null) {
594
		idStructureChp.setValue(str.getId());
607
			idStructureChp.setValue(identification.getId());
595
		nomStructureChp.setValue(str.getNom());
608
			nomStructureChp.setValue(identification.getNom());
596
		if (!str.getIdAlternatif().isEmpty()) {
609
			if (!identification.getIdAlternatif().isEmpty()) {
597
			String[] acronyme = str.getIdAlternatif().split("##");
610
				String[] acronyme = identification.getIdAlternatif().split("##");
598
			if (acronyme[0].matches("^IH$")) {
611
				if (acronyme[0].matches("^IH$")) {
599
				comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
612
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
600
				ihChp.setValue(acronyme[1]);
613
					ihChp.setValue(acronyme[1]);
601
			} else if (acronyme[0].matches("^MNHN$")) {
614
				} else if (acronyme[0].matches("^MNHN$")) {
602
				comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
615
					comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
603
				mnhnChp.setValue(acronyme[1]);
616
					mnhnChp.setValue(acronyme[1]);
604
			}
617
				}
605
		}
618
			}
606
		if (!str.getTypePrive().isEmpty()) {
619
			if (!identification.getTypePrive().isEmpty()) {
607
			if (str.getTypePrive().matches("^[0-9]+$")) {
620
				if (identification.getTypePrive().matches("^[0-9]+$")) {
608
				comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
621
					comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
609
				comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", str.getTypePrive()));
622
					comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
610
			}
623
				}
611
		} else if (!str.getTypePublic().isEmpty()) {
624
			} else if (!identification.getTypePublic().isEmpty()) {
612
			if (str.getTypePublic().matches("^[0-9]+$")) {
625
				if (identification.getTypePublic().matches("^[0-9]+$")) {
613
				comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
626
					comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
614
				comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", str.getTypePublic()));
627
					comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
615
			}
628
				}
Line 616... Line 629...
616
		}
629
			}
617
		dateFondationChp.setValue(str.getDateFondation());
630
			dateFondationChp.setValue(identification.getDateFondation());
618
		
631
			
619
		adrChp.setValue(str.getAdresse());
632
			adrChp.setValue(identification.getAdresse());
620
		cpChp.setValue(str.getCodePostal());
633
			cpChp.setValue(identification.getCodePostal());
621
		villeChp.setValue(str.getVille());
634
			villeChp.setValue(identification.getVille());
622
		regionChp.setValue(str.getRegion());
635
			regionChp.setValue(identification.getRegion());
623
		if (str.getPays().matches("^[A-Z]{2}$")) {
636
			if (identification.getPays().matches("^[A-Z]{2}$")) {
624
			comboPays.setValue(comboPays.getStore().findModel("abreviation", str.getPays()));
637
				comboPays.setValue(comboPays.getStore().findModel("abreviation", identification.getPays()));
Line 625... Line 638...
625
		} else {
638
			} else {
626
			comboPays.setRawValue(str.getPays());
639
				comboPays.setRawValue(identification.getPays());
627
		}
640
			}
628
		
641
			
-
 
642
			telChp.setValue(identification.getTelephone());
-
 
643
			faxChp.setValue(identification.getFax());
-
 
644
			emailChp.setValue(identification.getCourriel());
629
		telChp.setValue(str.getTelephone());
645
			urlChp.setValue(identification.getUrl("WEB"));
Line 630... Line 646...
630
		faxChp.setValue(str.getFax());
646
			
631
		emailChp.setValue(str.getCourriel());
647
			identificationOnglet.layout();
632
		urlChp.setValue(str.getUrl("WEB"));
648
		}
Line 835... Line 851...
835
		conservationOnglet.add(insecteTraitementTrukCp);
851
		conservationOnglet.add(insecteTraitementTrukCp);
Line 836... Line 852...
836
		
852
		
837
		return conservationOnglet;
853
		return conservationOnglet;
Line -... Line 854...
-
 
854
	}
-
 
855
	
-
 
856
	
-
 
857
	private void peuplerStructurePersonnel() {
-
 
858
		if (identification != null) {
-
 
859
			// NBRE PERSONNE
-
 
860
			nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
-
 
861
		}
-
 
862
		
-
 
863
		if (personnel != null) {
-
 
864
			personnelGrilleMagazin.removeAll();
-
 
865
			personnelGrilleMagazin.add(personnel);
-
 
866
			
-
 
867
			grillePersonnel.getColumnModel().getColumn(1).getEditor().fireEvent(Events.StateSave);
-
 
868
			/*
-
 
869
			int nbreLigne = personnelGrilleMagazin.getCount();
-
 
870
			for (int i = 0; i < nbreLigne; i++) {
-
 
871
				
-
 
872
			}
-
 
873
			*/
-
 
874
			personnelOnglet.layout();
-
 
875
		}
838
	}
876
	}
839
	
877
	
-
 
878
	private TabItem creerOngletPersonnel() {
840
	private TabItem creerOngletPersonnel() {
879
		personnelOnglet = new TabItem();
841
		personnelOnglet = new TabItem();
880
		
842
		personnelOnglet.setText("Personnel");
881
		personnelOnglet.setText("Personnel");
-
 
882
		personnelOnglet.setScrollMode(Scroll.AUTO);
-
 
883
		personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT, null));
-
 
884
		personnelOnglet.setData("acces", false); // Permet de savoir si l'onblet a été accédé par l'utilisateur
-
 
885
		personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
-
 
886
			public void handleEvent(ComponentEvent be) {
-
 
887
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
-
 
888
				personnelOnglet.setData("acces", true);
-
 
889
				peuplerStructurePersonnel();
-
 
890
			}
Line 843... Line 891...
843
		personnelOnglet.setScrollMode(Scroll.AUTO);
891
 
844
		personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT, null));
892
		});
845
		
893
		
846
		nbreTotalPersonneStructureChp = new NumberField();  
894
		nbreTotalPersonneStructureChp = new NumberField();  
Line 859... Line 907...
859
		
907
 
860
		return personnelOnglet;
908
		return personnelOnglet;
Line 861... Line 909...
861
	}
909
	}
-
 
910
	
Line 862... Line 911...
862
	
911
	private ContentPanel creerGrillePersonnel() {  
863
	private ContentPanel creerGrillePersonnel() {  
912
		ContentPanel cp = new ContentPanel();
864
		
913
		
Line 865... Line 914...
865
		List<Personne> personnes = new ArrayList<Personne>();
914
		List<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
866
		personnes.add(new Personne(Valeur.FONCTION_DIRECTEUR));
915
		personnes.add(new StructureAPersonne(Valeur.FONCTION_DIRECTEUR));
Line 867... Line 916...
867
		personnes.add(new Personne(Valeur.FONCTION_CONSERVATEUR));
916
		personnes.add(new StructureAPersonne(Valeur.FONCTION_CONSERVATEUR));
Line 868... Line 917...
868
		
917
		
869
		personnelGrilleMagazin = new ListStore<Personne>();  
918
		personnelGrilleMagazin = new ListStore<StructureAPersonne>();  
Line 870... Line 919...
870
		personnelGrilleMagazin.add(personnes);  
919
		personnelGrilleMagazin.add(personnes);  
871
 
920
 
872
		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
921
		List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
Line 883... Line 932...
883
		comboLiFonction.setTriggerAction(TriggerAction.ALL);  
932
		comboLiFonction.setTriggerAction(TriggerAction.ALL);  
884
		comboLiFonction.setEditable(true);
933
		comboLiFonction.setEditable(true);
885
		comboLiFonction.setDisplayField("nom");
934
		comboLiFonction.setDisplayField("nom");
886
		//comboLiStatut.setEmptyText("Sélectionez une fonction...");
935
		//comboLiStatut.setEmptyText("Sélectionez une fonction...");
887
		comboLiFonction.setStore(magazinLiFonction);
936
		comboLiFonction.setStore(magazinLiFonction);
-
 
937
		/*
-
 
938
		comboLiFonction.addListener(Events.Blur, new Listener<BaseEvent>() {
-
 
939
 
-
 
940
			@Override
-
 
941
			public void handleEvent(BaseEvent be) {
-
 
942
				//grillePersonnel..comboLiFonction.getRawValue();
-
 
943
				
-
 
944
			}
-
 
945
			
-
 
946
		});*/
Line 888... Line 947...
888
		
947
		
889
		CellEditor fonctionEditor = new CellEditor(comboLiFonction) {  
948
		CellEditor fonctionEditor = new CellEditor(comboLiFonction) {  
890
			@Override  
949
			@Override  
891
			public Object preProcessValue(Object value) {  
950
			public Object preProcessValue(Object valeur) {  
892
				if (value == null) {  
951
				if (valeur == null) {
-
 
952
					return valeur; 
-
 
953
				}
-
 
954
				GWT.log("pre : "+valeur.toString(), null);
-
 
955
				Object retour = null;
-
 
956
				if (((String) valeur).matches("^[0-9]+$")) {
-
 
957
					retour = comboLiFonction.getStore().findModel("id_valeur", (String) valeur);
-
 
958
				} else {
893
					return value;  
959
					retour = comboLiFonction.getStore().findModel("nom", (String) valeur);
894
				}
960
				}
895
				//GWT.log("pre : "+value.toString(), null);
961
				GWT.log("pre - retour : \n"+retour.toString(), null);
896
				return comboLiFonction.getStore().findModel("nom", (String) value);  
962
				return retour;
Line 897... Line 963...
897
			}  
963
			}  
898
			
964
			
899
			@Override  
965
			@Override  
-
 
966
			public Object postProcessValue(Object valeur) {  
-
 
967
				if (valeur == null) {
-
 
968
					// Si la combobox n'a pas été utilisé, nous renvoyons la valeur brute saisie par l'utilisateur
-
 
969
					return this.getField().getRawValue();
-
 
970
				} else {
-
 
971
					this.setUpdateEl(false);
-
 
972
					GWT.log("post : \n"+valeur.toString(), null);
-
 
973
					if (valeur instanceof String && ((String) valeur).matches("^[0-9]+$")) {
-
 
974
						GWT.log("ici", null);
-
 
975
						return (comboLiFonction.getStore().findModel("id_valeur", (String) valeur)).getNom();
-
 
976
					} else {
900
			public Object postProcessValue(Object value) {  
977
						String nom = (((Valeur) valeur).getNom());
-
 
978
						GWT.log("la "+nom, null);
901
				if (value == null) {  
979
						return nom;
902
					return value;  
-
 
903
				}
-
 
904
				//GWT.log("post : "+value.toString(), null);
980
					}
905
				return ((Valeur) value).get("nom");  
981
				}
906
			}  
982
			}
907
		};
983
		};
Line 928... Line 1004...
928
		nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
1004
		nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
929
		nomChp.setAutoValidate(true);  
1005
		nomChp.setAutoValidate(true);  
930
		column.setEditor(new CellEditor(nomChp));
1006
		column.setEditor(new CellEditor(nomChp));
931
		configs.add(column);  
1007
		configs.add(column);  
Line 932... Line 1008...
932
 
1008
 
933
		column = new ColumnConfig("tel", "Téléphone", 100);
1009
		column = new ColumnConfig("telephone", "Téléphone fixe", 100);
934
		TextField<String> telChp = new TextField<String>();  
1010
		TextField<String> telChp = new TextField<String>();  
935
		column.setEditor(new CellEditor(telChp));
1011
		column.setEditor(new CellEditor(telChp));
Line 936... Line 1012...
936
		configs.add(column);
1012
		configs.add(column);
Line 977... Line 1053...
977
		};  
1053
		};  
978
		column = new ColumnConfig("statut", "Statut", 100);
1054
		column = new ColumnConfig("statut", "Statut", 100);
979
		column.setEditor(statutEditor);
1055
		column.setEditor(statutEditor);
980
		configs.add(column);
1056
		configs.add(column);
Line 981... Line 1057...
981
		
1057
		
982
		column = new ColumnConfig("tps_w", "Temps travail", 100);
1058
		column = new ColumnConfig("travail", "Temps travail", 100);
983
		column.setNumberFormat(NumberFormat.getFormat("##"));
1059
		column.setNumberFormat(NumberFormat.getFormat("##"));
984
		NumberField tpsWChp = new NumberField();
1060
		NumberField tpsWChp = new NumberField();
985
		tpsWChp.setFormat(NumberFormat.getFormat("##"));
1061
		tpsWChp.setFormat(NumberFormat.getFormat("##"));
986
		tpsWChp.setToolTip("Ce champ doit contenir un nombre");
1062
		tpsWChp.setToolTip("Ce champ doit contenir un nombre");
987
		column.setEditor(new CellEditor(tpsWChp));
1063
		column.setEditor(new CellEditor(tpsWChp));
Line 988... Line 1064...
988
		configs.add(column);
1064
		configs.add(column);
989
		
1065
		
990
		column = new ColumnConfig("specialites", "Spécialités botaniques", 150);
1066
		column = new ColumnConfig("specialite", "Spécialité principale", 150);
991
		TextField<String> speChp = new TextField<String>();  
1067
		TextField<String> speChp = new TextField<String>();  
Line 992... Line 1068...
992
		column.setEditor(new CellEditor(speChp));
1068
		column.setEditor(new CellEditor(speChp));
993
		configs.add(column);
1069
		configs.add(column);
Line 994... Line -...
994
		
-
 
-
 
1070
		
995
		CheckColumnConfig checkColumn = new CheckColumnConfig("mark_contact", "Contact ?", 60);
1071
		CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
996
		configs.add(checkColumn);
1072
		configs.add(checkColumn);
997
		
1073
		
998
		ContentPanel cp = new ContentPanel();
1074
		
999
		cp.setHeading("Personnes travaillant sur les collections");
1075
		cp.setHeading("Personnes travaillant sur les collections");
Line 1007... Line 1083...
1007
		
1083
		
1008
		TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
1084
		TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
1009
		ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {  
1085
		ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {  
1010
			@Override  
1086
			@Override  
1011
			public void componentSelected(ToolBarEvent ce) {  
1087
			public void componentSelected(ToolBarEvent ce) {  
1012
				Personne personne = new Personne();  
1088
				StructureAPersonne personne = new StructureAPersonne();  
1013
				grillePersonnel.stopEditing();  
1089
				grillePersonnel.stopEditing();  
1014
				personnelGrilleMagazin.insert(personne, 0);  
1090
				personnelGrilleMagazin.insert(personne, 0);  
1015
				grillePersonnel.startEditing(0, 0);
1091
				grillePersonnel.startEditing(0, 0);
1016
				// Mise à jour du nombre de personnel travaillant sur les collections
1092
				// Mise à jour du nombre de personnel travaillant sur les collections
Line 1039... Line 1115...
1039
		toolBar.add(supprimerPersonnelBtn);  
1115
		toolBar.add(supprimerPersonnelBtn);  
1040
		cp.setTopComponent(toolBar);  
1116
		cp.setTopComponent(toolBar);  
Line 1041... Line 1117...
1041
 
1117
 
Line 1042... Line 1118...
1042
		ColumnModel cm = new ColumnModel(configs);
1118
		ColumnModel cm = new ColumnModel(configs);
1043
		
1119
		
1044
		grillePersonnel = new EditorGrid<Personne>(personnelGrilleMagazin, cm);  
1120
		grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);  
1045
		grillePersonnel.setBorders(true);
1121
		grillePersonnel.setBorders(true);
1046
		grillePersonnel.setSelectionModel(sm);
1122
		grillePersonnel.setSelectionModel(sm);
1047
		grillePersonnel.addPlugin(sm);
1123
		grillePersonnel.addPlugin(sm);
1048
		grillePersonnel.addPlugin(checkColumn);
-
 
-
 
1124
		grillePersonnel.addPlugin(checkColumn);
-
 
1125
  		grillePersonnel.setAutoExpandColumn("specialite");
1049
  		grillePersonnel.setAutoExpandColumn("specialites");
1126
  		grillePersonnel.setStripeRows(true);
-
 
1127
  		grillePersonnel.setTrackMouseOver(true);
1050
  		
1128
		cp.add(grillePersonnel);
1051
		cp.add(grillePersonnel);
1129
			
Line 1052... Line 1130...
1052
		return cp;  
1130
		return cp;
1053
	}  
1131
	}  
1054
	
1132
	
1055
	private TabItem creerOngletIdentification() {
1133
	private TabItem creerOngletIdentification() {
1056
		//+-----------------------------------------------------------------------------------------------------------+
1134
		//+-----------------------------------------------------------------------------------------------------------+
1057
		// Onlget formulaire IDENTIFICATION
1135
		// Onlget formulaire IDENTIFICATION
1058
		identificationOnglet = new TabItem();
1136
		identificationOnglet = new TabItem();
-
 
1137
		identificationOnglet.setId("identification");
-
 
1138
		identificationOnglet.setText("Identification");
-
 
1139
		identificationOnglet.setLayout(new FormLayout());
-
 
1140
		identificationOnglet.setData("acces", false);
-
 
1141
		identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
-
 
1142
			public void handleEvent(ComponentEvent be) {  
-
 
1143
				// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
-
 
1144
				identificationOnglet.setData("acces", true);
Line 1059... Line 1145...
1059
		identificationOnglet.setId("identification");
1145
				peuplerStructureIdentification();
1060
		identificationOnglet.setText("Identification");
1146
			}  
1061
		identificationOnglet.setLayout(new FormLayout());
1147
		});
Line 1478... Line 1564...
1478
			composants.add(autreMaterielTrukCp);
1564
			composants.add(autreMaterielTrukCp);
1479
			valeurPourAfficher = "non";
1565
			valeurPourAfficher = "non";
1480
		}
1566
		}
Line 1481... Line 1567...
1481
		
1567
		
1482
		// Nous affichons/cachons les composant de la liste
1568
		// Nous affichons/cachons les composant de la liste
1483
		final int tailleMax = composants.size();
1569
		final int nbreComposants = composants.size();
1484
		//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
1570
		//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
1485
		//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
1571
		//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
1486
		for (int i = 0; i < tailleMax; i++) {
1572
		for (int i = 0; i < nbreComposants; i++) {
1487
			// En fonction du type de bouton cliquer, on affiche ou cache les champs
1573
			// En fonction du type de bouton cliquer, on affiche ou cache les champs
1488
			String type = radioBtn.getBoxLabel().toLowerCase();
1574
			String type = radioBtn.getBoxLabel().toLowerCase();
1489
			//GWT.log(type, null);
1575
			//GWT.log(type, null);
1490
			if (radioBtn.getValue() == true) {
1576
			if (radioBtn.getValue() == true) {
Line 1557... Line 1643...
1557
		
1643
		
1558
		cp.layout();
1644
		cp.layout();
Line 1559... Line 1645...
1559
	}
1645
	}
-
 
1646
	
1560
	
1647
	public void rafraichir(Object nouvelleDonnees) {
1561
	public void rafraichir(Object nouvelleDonnees) {
1648
		try {
1562
		if (nouvelleDonnees instanceof Information) {
1649
			if (nouvelleDonnees instanceof Information) {
1563
			Information info = (Information) nouvelleDonnees;
1650
				Information info = (Information) nouvelleDonnees;
1564
			if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
1651
				if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
Line 1572... Line 1659...
1572
				Info.display("Modification d'une institution", info.toString());
1659
					Info.display("Modification d'une institution", info.toString());
1573
				mode = "MODIF";
1660
					mode = "MODIF";
1574
				GWT.log("Mode du formulaire : "+mode, null);
1661
					GWT.log("Mode du formulaire : "+mode, null);
1575
				String titre = i18nC.titreModifFormStructurePanneau();
1662
					String titre = i18nC.titreModifFormStructurePanneau();
1576
				if (info.getDonnee(0) != null) {
1663
					if (info.getDonnee(0) != null) {
1577
					Structure str = (Structure) info.getDonnee(0);
1664
						identification = (Structure) info.getDonnee(0);
1578
					titre += " - ID : "+str.getId();
1665
						if (onglets.getSelectedItem().equals(identificationOnglet)) {
1579
					peuplerStructureIdentification(str);
1666
							peuplerStructureIdentification();
-
 
1667
						}
-
 
1668
						// Composition du titre
-
 
1669
						titre += " - ID : "+identification.getId();
1580
				}
1670
					}
1581
				if (info.getDonnee(1) != null) {
1671
					if (info.getDonnee(1) != null) {
1582
					conservation = (StructureConservation) info.getDonnee(1);
1672
						conservation = (StructureConservation) info.getDonnee(1);
1583
					if (onglets.getSelectedItem().equals(conservationOnglet)) {
1673
						if (onglets.getSelectedItem().equals(conservationOnglet)) {
1584
						peuplerStructureConservation();
1674
							peuplerStructureConservation();
1585
					}
1675
						}
1586
				}
1676
					}
1587
				if (info.getDonnee(2) != null) {
1677
					if (info.getDonnee(2) != null) {
1588
					valorisation = (StructureValorisation) info.getDonnee(2);
1678
						valorisation = (StructureValorisation) info.getDonnee(2);
1589
					if (valorisation != null) {
1679
						if (valorisation != null) {
1590
						GWT.log(valorisation.toString(), null);
-
 
1591
						if (onglets.getSelectedItem().equals(valorisationOnglet)) {
1680
							if (onglets.getSelectedItem().equals(valorisationOnglet)) {
1592
							peuplerStructureValorisation();
1681
								peuplerStructureValorisation();
1593
						}
1682
							}
1594
					}
1683
						}
1595
				}
1684
					}
1596
				structureFormPanneau.setHeading(titre);
1685
					structureFormPanneau.setHeading(titre);
-
 
1686
				} else if (info.getType().equals("liste_structure_a_personne")) {
-
 
1687
					if (info.getDonnee(0) != null) {
-
 
1688
						StructureAPersonneListe personnes = (StructureAPersonneListe) info.getDonnee(0);
-
 
1689
						personnel = new ArrayList<StructureAPersonne>();
-
 
1690
						for (Iterator<String> it = personnes.keySet().iterator(); it.hasNext();) {
-
 
1691
							String index = it.next();
-
 
1692
							personnes.get(index).set("fonction", magazinLiFonction.findModel("id_valeur", personnes.get(index).getFonction()).getNom());
-
 
1693
							personnel.add(personnes.get(index));
-
 
1694
						}
-
 
1695
						
-
 
1696
						//GWT.log(personnel.toString(), null);
-
 
1697
						if (onglets.getSelectedItem().equals(personnelOnglet)) {
-
 
1698
							peuplerStructurePersonnel();
-
 
1699
						}
-
 
1700
					}
1597
			}
1701
				}
1598
		} else if (nouvelleDonnees instanceof ValeurListe) {
1702
			} else if (nouvelleDonnees instanceof ValeurListe) {
1599
			ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
1703
				ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
Line 1600... Line 1704...
1600
			
1704
				
Line 1698... Line 1802...
1698
				//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
1802
					//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
1699
			} else {
1803
				} else {
1700
				GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
1804
					GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
1701
			}
1805
				}
1702
		}
1806
			}
-
 
1807
		} catch (Exception e) {
-
 
1808
			GWT.log("rafraichir()", e);
-
 
1809
		}
1703
	}
1810
	}
Line 1704... Line 1811...
1704
	 
1811
	 
1705
}
1812
}