Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1784 Rev 1802
Line 3... Line 3...
3
import java.util.Iterator;
3
import java.util.Iterator;
Line 4... Line 4...
4
 
4
 
5
import org.tela_botanica.client.ComposantClass;
5
import org.tela_botanica.client.ComposantClass;
6
import org.tela_botanica.client.ComposantId;
6
import org.tela_botanica.client.ComposantId;
-
 
7
import org.tela_botanica.client.Mediateur;
-
 
8
import org.tela_botanica.client.RegistreId;
7
import org.tela_botanica.client.Mediateur;
9
import org.tela_botanica.client.configuration.Configuration;
8
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.Information;
-
 
12
import org.tela_botanica.client.modeles.ValeurListe;
-
 
13
import org.tela_botanica.client.modeles.collection.CollectionAStructure;
10
import org.tela_botanica.client.modeles.ValeurListe;
14
import org.tela_botanica.client.modeles.collection.CollectionAStructureListe;
11
import org.tela_botanica.client.modeles.structure.Structure;
15
import org.tela_botanica.client.modeles.structure.Structure;
12
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
16
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
13
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
17
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
14
import org.tela_botanica.client.modeles.structure.StructureConservation;
18
import org.tela_botanica.client.modeles.structure.StructureConservation;
15
import org.tela_botanica.client.modeles.structure.StructureValorisation;
19
import org.tela_botanica.client.modeles.structure.StructureValorisation;
16
import org.tela_botanica.client.synchronisation.Sequenceur;
-
 
17
import org.tela_botanica.client.util.Debug;
20
import org.tela_botanica.client.synchronisation.Sequenceur;
Line -... Line 21...
-
 
21
import org.tela_botanica.client.vues.DetailVue;
18
import org.tela_botanica.client.vues.DetailVue;
22
 
19
 
23
import com.extjs.gxt.ui.client.Registry;
20
import com.extjs.gxt.ui.client.Style.Scroll;
24
import com.extjs.gxt.ui.client.Style.Scroll;
21
import com.extjs.gxt.ui.client.util.Format;
25
import com.extjs.gxt.ui.client.util.Format;
22
import com.extjs.gxt.ui.client.util.Params;
26
import com.extjs.gxt.ui.client.util.Params;
23
import com.extjs.gxt.ui.client.widget.ContentPanel;
27
import com.extjs.gxt.ui.client.widget.ContentPanel;
24
import com.extjs.gxt.ui.client.widget.Html;
28
import com.extjs.gxt.ui.client.widget.Html;
25
import com.extjs.gxt.ui.client.widget.TabItem;
29
import com.extjs.gxt.ui.client.widget.TabItem;
26
import com.extjs.gxt.ui.client.widget.TabPanel;
30
import com.extjs.gxt.ui.client.widget.TabPanel;
27
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
31
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
28
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
-
 
Line 29... Line 32...
29
import com.google.gwt.core.client.GWT;
32
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
Line 30... Line 33...
30
import com.google.gwt.user.client.Window;
33
import com.google.gwt.core.client.GWT;
31
 
34
 
Line 39... Line 42...
39
	private String conservationTpl = null;
42
	private String conservationTpl = null;
40
	private String traitementConservationTpl = null;
43
	private String traitementConservationTpl = null;
41
	private String valorisationTpl = null;
44
	private String valorisationTpl = null;
42
	private String typeTraitementConservationTpl = null;
45
	private String typeTraitementConservationTpl = null;
43
	private String rechercheValorisationTpl = null;
46
	private String rechercheValorisationTpl = null;
-
 
47
	private String collectionTpl = null;
-
 
48
	private String ligneCollectionTpl = null;
-
 
49
	private String tableauCollectionTpl = null;
Line 44... Line 50...
44
	
50
	
45
	private Structure structure = null;
51
	private Structure structure = null;
46
	private boolean structureChargementOk = false;
52
	private boolean structureChargementOk = false;
47
	private StructureAPersonneListe personnel = null;
53
	private StructureAPersonneListe personnel = null;
48
	private boolean personnelChargementOk = false;
54
	private boolean personnelChargementOk = false;
49
	private StructureValorisation valorisation = null;
55
	private StructureValorisation valorisation = null;
-
 
56
	private StructureConservation conservation = null;
-
 
57
	private CollectionAStructureListe collection = null;
Line 50... Line 58...
50
	private StructureConservation conservation = null;
58
	private boolean collectionChargementOk = false;
51
	
59
	
52
	private ContentPanel panneauPrincipal = null;
60
	private ContentPanel panneauPrincipal = null;
53
	private Html entete = null;
61
	private Html entete = null;
54
	private TabPanel onglets = null;
62
	private TabPanel onglets = null;
-
 
63
	private TabItem identificationOnglet = null;
55
	private TabItem identificationOnglet = null;
64
	private TabItem personnelOnglet = null;
56
	private TabItem personnelOnglet = null;
65
	private TabItem collectionOnglet = null;
Line 57... Line 66...
57
	private TabItem conservationOnglet = null;
66
	private TabItem conservationOnglet = null;
Line 87... Line 96...
87
		personnelOnglet = new TabItem(i18nC.structureInfoPersonnel());
96
		personnelOnglet = new TabItem(i18nC.structureInfoPersonnel());
88
		personnelOnglet.setLayout(new AnchorLayout());
97
		personnelOnglet.setLayout(new AnchorLayout());
89
		personnelOnglet.setScrollMode(Scroll.AUTO);
98
		personnelOnglet.setScrollMode(Scroll.AUTO);
90
		onglets.add(personnelOnglet);
99
		onglets.add(personnelOnglet);
Line -... Line 100...
-
 
100
		
-
 
101
		collectionOnglet = new TabItem(i18nC.structureInfoCollection());
-
 
102
		collectionOnglet.setLayout(new AnchorLayout());
-
 
103
		collectionOnglet.setScrollMode(Scroll.AUTO);
-
 
104
		onglets.add(collectionOnglet); 
91
		
105
		
92
		conservationOnglet = new TabItem(i18nC.structureInfoConservation());
106
		conservationOnglet = new TabItem(i18nC.structureInfoConservation());
93
		conservationOnglet.setLayout(new AnchorLayout());
107
		conservationOnglet.setLayout(new AnchorLayout());
94
		conservationOnglet.setScrollMode(Scroll.AUTO);
108
		conservationOnglet.setScrollMode(Scroll.AUTO);
Line 127... Line 141...
127
				afficherConservation();
141
				afficherConservation();
128
			}
142
			}
129
			if (valorisation != null) {
143
			if (valorisation != null) {
130
				afficherValorisation();
144
				afficherValorisation();
131
			}
145
			}
-
 
146
			if (collection != null) {
-
 
147
				afficherCollection();
-
 
148
			}
132
		}
149
		}
133
		layout();
150
		layout();
134
	}
151
	}
Line 135... Line 152...
135
	
152
	
Line 429... Line 446...
429
		}
446
		}
Line 430... Line 447...
430
		
447
		
431
		return cHtml;
448
		return cHtml;
Line -... Line 449...
-
 
449
	}
-
 
450
	
-
 
451
	private void afficherCollection() {
-
 
452
		Params collectionParams  = new Params();
-
 
453
		
-
 
454
		collectionParams.set("i18n_titre_collection", i18nC.structureInfoCollection());
-
 
455
		collectionParams.set("i18n_indication_collection", i18nC.structureIndicationCollection());
-
 
456
		collectionParams.set("i18n_indication_lien_collection", i18nC.structureIndicationLienCollection());
-
 
457
		collectionParams.set("css_indication_titre_petit", ComposantClass.INDICATION_TITRE_PETIT);
-
 
458
		
-
 
459
		String guidTpl = ((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("consultationCollectionsLieesStructures");
-
 
460
		String guid = guidTpl.replace("{str_id}", structure.getId());
-
 
461
		collectionParams.set("guid_structure", guid);
-
 
462
		
-
 
463
		String tableauCollectionHtml = "";
-
 
464
		if (collection.size() > 0) {
-
 
465
			tableauCollectionHtml = construireTableauCollection();
-
 
466
		}
-
 
467
		collectionParams.set("tableau_collection", tableauCollectionHtml);
-
 
468
		
-
 
469
		afficherOnglet(collectionTpl, collectionParams, collectionOnglet);
-
 
470
	}
-
 
471
	
-
 
472
	private String construireTableauCollection() {
-
 
473
		Params contenuParams = new Params();
-
 
474
		String lignesCollection = ""; 
-
 
475
		
-
 
476
		contenuParams.set("i18n_nom_collection", i18nC.nomCollection());
-
 
477
		contenuParams.set("i18n_id_collection", i18nC.id());
-
 
478
		contenuParams.set("i18n_lien_collection", i18nC.structureLienCollection());
-
 
479
		contenuParams.set("css_largeur_colonne_id", ComposantClass.LARGEUR_COLONNE_ID);
-
 
480
		
-
 
481
		String guidTpl = ((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("consultationCollections");
-
 
482
		
-
 
483
		Iterator<String> it = collection.keySet().iterator();
-
 
484
		while (it.hasNext()) {
-
 
485
			CollectionAStructure collectionCourante = collection.get(it.next());
-
 
486
			Params ligneParams = new Params();
-
 
487
			
-
 
488
			String guidCollection = guidTpl.replace("{col_id}", collectionCourante.getIdCollection());
-
 
489
			ligneParams.set("guid_structure", guidCollection);
-
 
490
			
-
 
491
			ligneParams.set("id_collection", collectionCourante.getIdCollection());
-
 
492
			ligneParams.set("nom_collection", collectionCourante.getNom());
-
 
493
			ligneParams.set("lien_collection", guidCollection);
-
 
494
			
-
 
495
			lignesCollection += Format.substitute(ligneCollectionTpl, ligneParams);
-
 
496
		}
-
 
497
		contenuParams.set("lignes", lignesCollection);
-
 
498
		
-
 
499
		String cHtml = Format.substitute(tableauCollectionTpl, contenuParams);
-
 
500
		return cHtml;
432
	}
501
	}
433
	
502
	
434
	private void initialiserTousLesTpl() {
503
	private void initialiserTousLesTpl() {
435
		initialiserEnteteTpl();
504
		initialiserEnteteTpl();
436
		initialiserIdentificationTpl();
505
		initialiserIdentificationTpl();
Line 440... Line 509...
440
		initialiserConservationTpl();
509
		initialiserConservationTpl();
441
		initialiserTraitementConservationTpl();
510
		initialiserTraitementConservationTpl();
442
		initialiserTypeTraitementConservationTpl();
511
		initialiserTypeTraitementConservationTpl();
443
		initialiserValorisationTpl();
512
		initialiserValorisationTpl();
444
		initialiserRechercheValorisationTpl();
513
		initialiserRechercheValorisationTpl();
-
 
514
		initialiserCollectionTpl();
-
 
515
		initialiserTableauCollectionTpl();
-
 
516
		initialiserLigneCollectionTpl();
445
	}
517
	}
Line 446... Line 518...
446
	
518
	
447
	private void initialiserEnteteTpl() {
519
	private void initialiserEnteteTpl() {
448
		enteteTpl = 	
520
		enteteTpl = 	
Line 552... Line 624...
552
			"		<span class='{css_label}'>{i18n_meuble_specifique} :</span> {meuble_specifique}<br />"+
624
			"		<span class='{css_label}'>{i18n_meuble_specifique} :</span> {meuble_specifique}<br />"+
553
			"		<span class='{css_label}'>{i18n_local_parametre} :</span> {local_parametre}<br />"+
625
			"		<span class='{css_label}'>{i18n_local_parametre} :</span> {local_parametre}<br />"+
554
			"		<span class='{css_label}'>{i18n_conservation_en_commun} :</span> {conservation_en_commun} {collection_autre}<br />"+
626
			"		<span class='{css_label}'>{i18n_conservation_en_commun} :</span> {conservation_en_commun} {collection_autre}<br />"+
555
			"		<span class='{css_label}'>{i18n_acces_controle} :</span> {acces_controle}<br />"+
627
			"		<span class='{css_label}'>{i18n_acces_controle} :</span> {acces_controle}<br />"+
556
			"	</div>"+
628
			"	</div>"+
557
			"	<hr class='{css_clear}'/>"+
629
			"	<hr class='{css_clear}'Window/>"+
558
			"	<div class='{css_fieldset}'>"+
630
			"	<div class='{css_fieldset}'>"+
559
			"		<h2>{i18n_titre_operation}</h2>"+
631
			"		<h2>{i18n_titre_operation}</h2>"+
560
			"		<span class='{css_label}'>{i18n_restauration} :</span> {restauration} {restauration_operation}<br />"+
632
			"		<span class='{css_label}'>{i18n_restauration} :</span> {restauration} {restauration_operation}<br />"+
561
			"		<span class='{css_label}'>{i18n_materiel_conservation} :</span> {materiel_conservation} {materiel_autre}<br />"+
633
			"		<span class='{css_label}'>{i18n_materiel_conservation} :</span> {materiel_conservation} {materiel_autre}<br />"+
562
			"		<span class='{css_label}'>{i18n_traitement} :</span> {traitement} {traitements}<br />"+
634
			"		<span class='{css_label}'>{i18n_traitement} :</span> {traitement} {traitements}<br />"+
Line 612... Line 684...
612
		rechercheValorisationTpl =
684
		rechercheValorisationTpl =
613
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
685
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
614
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
686
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
615
	}
687
	}
Line -... Line 688...
-
 
688
	
-
 
689
	private void initialiserCollectionTpl() {
-
 
690
		collectionTpl =
-
 
691
			"<div class='{css_corps}'>"+
-
 
692
			"	<h2>{i18n_titre_collection} (<span class='{css_label} {css_indication_titre_petit}'>{i18n_indication_collection}</span>)</h2>"+
-
 
693
			"	{tableau_collection}"+
-
 
694
			"	<p> "+
-
 
695
			"		<a href=\"{guid_structure}\" class=\"{css_indication_titre_petit}\" target=\"_blank\">{i18n_indication_lien_collection}</a>"+
-
 
696
			"	</p>"+
-
 
697
			"</div>";
-
 
698
	}
-
 
699
	
-
 
700
	private void initialiserTableauCollectionTpl() {
-
 
701
		tableauCollectionTpl =		
-
 
702
			"<table>"+
-
 
703
			"	<thead>"+
-
 
704
			"		<tr>" +
-
 
705
			"			<th class=\"{css_largeur_colonne_id}\">{i18n_id_collection}</th>" +
-
 
706
			"			<th>{i18n_nom_collection}</th>" +
-
 
707
			"			<th>{i18n_lien_collection}</th>" +
-
 
708
			"		</tr>"+
-
 
709
			"	</thead>"+
-
 
710
			"	<tbody>"+
-
 
711
			"		{lignes}"+
-
 
712
			"	</tbody>"+
-
 
713
			"</table>";
-
 
714
	}
-
 
715
	
-
 
716
	private void initialiserLigneCollectionTpl() {
-
 
717
		ligneCollectionTpl =
-
 
718
			"<tr>"+
-
 
719
			"	<td>{id_collection}</td>"+
-
 
720
			"	<td>{nom_collection}</td>"+
-
 
721
			"	<td><a href=\"{lien_collection}\" target=\"_blank\">{lien_collection}</a></td>"+
-
 
722
			"</tr>";
-
 
723
	}
616
	
724
	
617
	public void rafraichir(Object nouvellesDonnees) {
-
 
618
		
725
	public void rafraichir(Object nouvellesDonnees) {
619
		if (nouvellesDonnees instanceof Structure) {
726
		if (nouvellesDonnees instanceof Structure) {
620
			structure = (Structure) nouvellesDonnees;
727
			structure = (Structure) nouvellesDonnees;
621
			structureChargementOk = true;
728
			structureChargementOk = true;
622
		} else if (nouvellesDonnees instanceof ValeurListe) {
729
		} else if (nouvellesDonnees instanceof ValeurListe) {
Line 625... Line 732...
625
		} else if (nouvellesDonnees instanceof Information) {
732
		} else if (nouvellesDonnees instanceof Information) {
626
			Information info = (Information) nouvellesDonnees;
733
			Information info = (Information) nouvellesDonnees;
627
			if (info.getType().equals("liste_structure_a_personne")) {
734
			if (info.getType().equals("liste_structure_a_personne")) {
628
				allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
735
				allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
629
				personnelChargementOk = true;
736
				personnelChargementOk = true;
-
 
737
			} else if (info.getType().equals("liste_collection_a_structure")) {
-
 
738
				allouerCollectionAStructure((CollectionAStructureListe) info.getDonnee(0));
-
 
739
				collectionChargementOk = true;
630
			} else if (info.getType().equals("ontologie_chargee")) {
740
			} else if (info.getType().equals("ontologie_chargee")) {
631
				ontologieChargementOk = true;
741
				ontologieChargementOk = true;
632
			}
742
			}
633
		} else {
743
		} else {
634
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
744
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
Line 636... Line 746...
636
		if (avoirDonneesChargees()) {
746
		if (avoirDonneesChargees()) {
637
			afficherDetailInstitution();
747
			afficherDetailInstitution();
638
		}
748
		}
639
	}
749
	}
Line -... Line 750...
-
 
750
	
-
 
751
	private void allouerCollectionAStructure(CollectionAStructureListe donnee) {
-
 
752
		collection = donnee;
-
 
753
	}
640
	
754
 
641
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
755
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
642
		structure.setPersonnel(personnel);
756
		structure.setPersonnel(personnel);
Line 643... Line 757...
643
	}
757
	}