Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 975 Rev 997
Line 8... Line 8...
8
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.Mediateur;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.modeles.Information;
10
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.ValeurListe;
11
import org.tela_botanica.client.modeles.ValeurListe;
12
import org.tela_botanica.client.modeles.collection.Collection;
12
import org.tela_botanica.client.modeles.collection.Collection;
-
 
13
import org.tela_botanica.client.modeles.collection.CollectionACommentaire;
-
 
14
import org.tela_botanica.client.modeles.collection.CollectionACommentaireListe;
13
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
15
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
14
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
16
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
15
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
17
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
16
import org.tela_botanica.client.modeles.collection.CollectionAPublicationListe;
18
import org.tela_botanica.client.modeles.collection.CollectionAPublicationListe;
17
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
19
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
18
import org.tela_botanica.client.modeles.collection.UniteBase;
20
import org.tela_botanica.client.modeles.collection.UniteBase;
19
import org.tela_botanica.client.modeles.collection.UniteRangement;
21
import org.tela_botanica.client.modeles.collection.UniteRangement;
-
 
22
import org.tela_botanica.client.modeles.commentaire.Commentaire;
20
import org.tela_botanica.client.modeles.personne.Personne;
23
import org.tela_botanica.client.modeles.personne.Personne;
21
import org.tela_botanica.client.modeles.projet.ProjetListe;
24
import org.tela_botanica.client.modeles.projet.ProjetListe;
22
import org.tela_botanica.client.modeles.publication.Publication;
25
import org.tela_botanica.client.modeles.publication.Publication;
23
import org.tela_botanica.client.modeles.structure.Structure;
26
import org.tela_botanica.client.modeles.structure.Structure;
24
import org.tela_botanica.client.util.Debug;
27
import org.tela_botanica.client.util.Debug;
Line 40... Line 43...
40
 
43
 
41
	private Collection collection = null;
44
	private Collection collection = null;
42
	private boolean collectionChargementOk = false;
45
	private boolean collectionChargementOk = false;
43
	private boolean personnesLieesChargementOk = false;
46
	private boolean personnesLieesChargementOk = false;
-
 
47
	private boolean publicationsLieesChargementOk = false;
44
	private boolean publicationsLieesChargementOk = false;
48
	private boolean commentairesLieesChargementOk = false;
Line 45... Line 49...
45
	private Structure structure = null;
49
	private Structure structure = null;
46
 
50
 
47
	private String enteteTpl = null;
51
	private String enteteTpl = null;
Line 53... Line 57...
53
	private String tableauPublicationsLieesTpl = null;
57
	private String tableauPublicationsLieesTpl = null;
54
	private String lignePublicationLieeTpl = null;
58
	private String lignePublicationLieeTpl = null;
55
	private String descriptionTpl = null;
59
	private String descriptionTpl = null;
56
	private String contenuTpl = null;
60
	private String contenuTpl = null;
57
	private String inventaireTpl = null;
61
	private String inventaireTpl = null;
-
 
62
	private String commentaireTpl = null;
-
 
63
	private String tableauCommentairesLieesTpl = null;
-
 
64
	private String ligneCommentaireLieeTpl = null;
Line 58... Line 65...
58
	
65
	
59
	private ContentPanel panneauPrincipal = null;
66
	private ContentPanel panneauPrincipal = null;
60
	private Html entete = null;
67
	private Html entete = null;
61
	private TabPanel onglets = null;
68
	private TabPanel onglets = null;
62
	private TabItem generalOnglet = null;
69
	private TabItem generalOnglet = null;
63
	private TabItem personneOnglet = null;
70
	private TabItem personneOnglet = null;
64
	private TabItem publicationOnglet = null;
71
	private TabItem publicationOnglet = null;
65
	private TabItem descriptionOnglet = null;
72
	private TabItem descriptionOnglet = null;
66
	private TabItem contenuOnglet = null;
73
	private TabItem contenuOnglet = null;
-
 
74
	private TabItem inventaireOnglet = null;
67
	private TabItem inventaireOnglet = null;
75
	private TabItem commentaireOnglet = null;
68
	private String tableauUniteRangementTpl;
76
	private String tableauUniteRangementTpl;
69
	private String ligneUniteRangementTpl;
77
	private String ligneUniteRangementTpl;
70
	private String tableauUniteBaseTpl;
78
	private String tableauUniteBaseTpl;
Line 117... Line 125...
117
		inventaireOnglet = new TabItem(i18nC.collectionInventaire());
125
		inventaireOnglet = new TabItem(i18nC.collectionInventaire());
118
		inventaireOnglet.setLayout(new AnchorLayout());
126
		inventaireOnglet.setLayout(new AnchorLayout());
119
		inventaireOnglet.setScrollMode(Scroll.AUTO);
127
		inventaireOnglet.setScrollMode(Scroll.AUTO);
120
		onglets.add(inventaireOnglet);
128
		onglets.add(inventaireOnglet);
Line -... Line 129...
-
 
129
		
-
 
130
		commentaireOnglet = new TabItem(i18nC.collectionCommentaire());
-
 
131
		commentaireOnglet.setLayout(new AnchorLayout());
-
 
132
		commentaireOnglet.setScrollMode(Scroll.AUTO);
-
 
133
		onglets.add(commentaireOnglet);
121
		
134
		
122
		panneauPrincipal.add(onglets);
135
		panneauPrincipal.add(onglets);
123
		add(panneauPrincipal);
136
		add(panneauPrincipal);
Line 124... Line 137...
124
	}
137
	}
Line 137... Line 150...
137
		initialiserTableauUniteRangementTpl();
150
		initialiserTableauUniteRangementTpl();
138
		initialiserLigneUniteRangementTpl();
151
		initialiserLigneUniteRangementTpl();
139
		initialiserTableauUniteBaseTpl();
152
		initialiserTableauUniteBaseTpl();
140
		initialiserLigneUniteBaseTpl();
153
		initialiserLigneUniteBaseTpl();
141
		initialiserInventaireTpl();
154
		initialiserInventaireTpl();
-
 
155
		initialiserCommentaireTpl();
-
 
156
		initialiserTableauCommentairesLieesTpl();
-
 
157
		initialiserLigneCommentaireLieeTpl();
142
	}
158
	}
Line 143... Line 159...
143
	
159
	
144
	private void initialiserEnteteHtmlTpl() {
160
	private void initialiserEnteteHtmlTpl() {
145
		enteteTpl = 	
161
		enteteTpl = 	
Line 440... Line 456...
440
			"	</div>"+
456
			"	</div>"+
441
			"	<hr class='{css_clear}'/>"+
457
			"	<hr class='{css_clear}'/>"+
442
			"</div>";
458
			"</div>";
443
	}
459
	}
Line -... Line 460...
-
 
460
	
-
 
461
	private void initialiserCommentaireTpl() {
-
 
462
		commentaireTpl =
-
 
463
			"<div class='{css_corps}'>"+
-
 
464
			"	<h2>{i18n_titre_commentaire}</h2>"+
-
 
465
			"	{tableau_commentaires_liees}"+
-
 
466
			"</div>";
-
 
467
	}
-
 
468
	
-
 
469
	private void initialiserTableauCommentairesLieesTpl() {
-
 
470
		tableauCommentairesLieesTpl =
-
 
471
			"<table>"+
-
 
472
			"	<thead>"+
-
 
473
			"		<tr>" +
-
 
474
			"			<th>{i18n_type}</th>" +
-
 
475
			"			<th>{i18n_titre}</th>" +
-
 
476
			"			<th>{i18n_ponderation}</th>" +
-
 
477
			"			<th>{i18n_public}</th>" +
-
 
478
			"		</tr>"+
-
 
479
			"	</thead>"+
-
 
480
			"	<tbody>"+
-
 
481
			"		{lignes}"+
-
 
482
			"	</tbody>"+
-
 
483
			"</table>";
-
 
484
	}
-
 
485
	
-
 
486
	private void initialiserLigneCommentaireLieeTpl() {
-
 
487
		ligneCommentaireLieeTpl =
-
 
488
			"<tr>"+
-
 
489
			"	<td>{type}</td>"+
-
 
490
			"	<td>{titre}</td>"+
-
 
491
			"	<td>{ponderation}</td>"+
-
 
492
			"	<td>{public}</td>"+
-
 
493
			"</tr>"+
-
 
494
			"<tr>"+
-
 
495
			"	<td colspan='4'>{texte}</td>"+
-
 
496
			"</tr>";
-
 
497
	}
444
	
498
	
445
	private void chargerOntologie() {
499
	private void chargerOntologie() {
446
		String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot", "groupementPrincipe", 
500
		String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot", "groupementPrincipe", 
447
			"realisationBut", "onpi", "ea", "typeClassement", "relationPersonneCollection", "ion",
501
			"realisationBut", "onpi", "ea", "typeClassement", "relationPersonneCollection", "ion",
448
			"typeUniteRangement", "etat", "typeUniteBase", "typePapier", "methodeRangement", "methodeFixation",  
502
			"typeUniteRangement", "etat", "typeUniteBase", "typePapier", "methodeRangement", "methodeFixation",  
449
			"methodeFixationSurSpecimen", "typeEcriture", "poisonTraitement", "insecteTraitement", "specimenDegradation",  
503
			"methodeFixationSurSpecimen", "typeEcriture", "poisonTraitement", "insecteTraitement", "specimenDegradation",  
450
			"niveauImportance", "supportDegradation", "niveauDetermination", "natureVegetale", "siecleNaturaliste", 
504
			"niveauImportance", "supportDegradation", "niveauDetermination", "natureVegetale", "siecleNaturaliste", 
451
			"dateDebut", "dateFin", "etat", "onep", "onp", "inventaireForme", "inventaireLogiciel", "inventaireEtat",
505
			"dateDebut", "dateFin", "etat", "onep", "onp", "inventaireForme", "inventaireLogiciel", "inventaireEtat",
452
			"etatClassement"};
506
			"etatClassement", "typeCommentaireCollection"};
453
		lancerChargementListesValeurs(listesCodes);
507
		lancerChargementListesValeurs(listesCodes);
Line 454... Line 508...
454
	}
508
	}
455
	
509
	
Line 467... Line 521...
467
			Information info = (Information) nouvellesDonnees;
521
			Information info = (Information) nouvellesDonnees;
468
			if (info.getType().equals("liste_collection_a_personne")) {
522
			if (info.getType().equals("liste_collection_a_personne")) {
469
				lierCollectionAPersonne((CollectionAPersonneListe) info.getDonnee(0));
523
				lierCollectionAPersonne((CollectionAPersonneListe) info.getDonnee(0));
470
			} else if (info.getType().equals("liste_collection_a_publication")) {
524
			} else if (info.getType().equals("liste_collection_a_publication")) {
471
				lierCollectionAPublication((CollectionAPublicationListe) info.getDonnee(0));
525
				lierCollectionAPublication((CollectionAPublicationListe) info.getDonnee(0));
-
 
526
			} else if (info.getType().equals("liste_collection_a_commentaire")) {
-
 
527
				lierCollectionACommentaire((CollectionACommentaireListe) info.getDonnee(0));
472
			}
528
			}
473
		} else {
529
		} else {
474
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
530
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
475
		}
531
		}
Line 487... Line 543...
487
	protected void lierCollectionAPublication(CollectionAPublicationListe publications) {
543
	protected void lierCollectionAPublication(CollectionAPublicationListe publications) {
488
		collection.setPublicationsLiees(publications);
544
		collection.setPublicationsLiees(publications);
489
		publicationsLieesChargementOk = true;
545
		publicationsLieesChargementOk = true;
490
	}
546
	}
Line -... Line 547...
-
 
547
	
-
 
548
	protected void lierCollectionACommentaire(CollectionACommentaireListe commentaires) {
-
 
549
		collection.setCommentairesLiees(commentaires);
-
 
550
		commentairesLieesChargementOk = true;
-
 
551
	}
491
	
552
	
492
	private boolean avoirDonneesChargees() {
553
	private boolean avoirDonneesChargees() {
493
		boolean ok = false;
554
		boolean ok = false;
494
		//Debug.log("projetsChargementOk:"+projetsChargementOk+"-collectionChargementOk:"+collectionChargementOk+"-ontologieChargementOk:"+ontologieChargementOk+"-personnesLieesChargementOk:"+personnesLieesChargementOk+"-publicationsLieesChargementOk:"+publicationsLieesChargementOk);
555
		//Debug.log("projetsChargementOk:"+projetsChargementOk+"-collectionChargementOk:"+collectionChargementOk+"-ontologieChargementOk:"+ontologieChargementOk+"-personnesLieesChargementOk:"+personnesLieesChargementOk+"-publicationsLieesChargementOk:"+publicationsLieesChargementOk);
495
		if (projetsChargementOk && collectionChargementOk && ontologieChargementOk && personnesLieesChargementOk && publicationsLieesChargementOk) {
556
		if (projetsChargementOk && collectionChargementOk && ontologieChargementOk && personnesLieesChargementOk && publicationsLieesChargementOk && commentairesLieesChargementOk) {
496
			ok = true;
557
			ok = true;
497
		}
558
		}
498
		return ok;
559
		return ok;
Line 505... Line 566...
505
			afficherPersonne();
566
			afficherPersonne();
506
			afficherPublication();
567
			afficherPublication();
507
			afficherDescription();
568
			afficherDescription();
508
			afficherContenu();
569
			afficherContenu();
509
			afficherInventaire();
570
			afficherInventaire();
-
 
571
			afficherCommentaire();
510
		}
572
		}
511
		layout();
573
		layout();
512
	}
574
	}
Line 513... Line 575...
513
	
575
	
Line 990... Line 1052...
990
		inventaireParams.set("type_donnee", collectionBotanique.getInventaireDonneesTypes());
1052
		inventaireParams.set("type_donnee", collectionBotanique.getInventaireDonneesTypes());
Line 991... Line 1053...
991
		
1053
		
992
		afficherOnglet(inventaireTpl, inventaireParams, inventaireOnglet);
1054
		afficherOnglet(inventaireTpl, inventaireParams, inventaireOnglet);
Line -... Line 1055...
-
 
1055
	}
-
 
1056
	
-
 
1057
	private void afficherCommentaire() {
-
 
1058
		String tableauCommentaireHtml = "";
-
 
1059
		if (collection.getCommentairesLiees() != null && collection.getCommentairesLiees().size() > 0) {
-
 
1060
			tableauCommentaireHtml = construireTableauCommentairesLiees();
-
 
1061
		}
-
 
1062
		
-
 
1063
		Params personneParams = new Params();
-
 
1064
		personneParams.set("i18n_titre_commentaire", i18nC.collectionCommentaireTitre());
-
 
1065
		personneParams.set("tableau_commentaires_liees", tableauCommentaireHtml);
-
 
1066
		
-
 
1067
		afficherOnglet(commentaireTpl, personneParams, commentaireOnglet);
-
 
1068
	}
-
 
1069
	
-
 
1070
	private String construireTableauCommentairesLiees() {
-
 
1071
		Params contenuParams = new Params();
-
 
1072
		contenuParams.set("i18n_type", i18nC.commentaireType());
-
 
1073
		contenuParams.set("i18n_titre", i18nC.commentaireTitre());
-
 
1074
		contenuParams.set("i18n_texte", i18nC.commentaireTexte());
-
 
1075
		contenuParams.set("i18n_ponderation", i18nC.commentairePonderation());
-
 
1076
		contenuParams.set("i18n_public", i18nC.commentairePublic());
-
 
1077
		
-
 
1078
		String lignesCommentaire = ""; 
-
 
1079
		if (collection.getCommentairesLiees() != null) {
-
 
1080
			Iterator<String> it = collection.getCommentairesLiees().keySet().iterator();
-
 
1081
			while (it.hasNext()) {
-
 
1082
				CollectionACommentaire relationCollectionACommentaire = collection.getCommentairesLiees().get(it.next());
-
 
1083
				Commentaire commentaire = relationCollectionACommentaire.getCommentaire();
-
 
1084
				
-
 
1085
				String type = construireTxtListeOntologie(relationCollectionACommentaire.getType());
-
 
1086
				String acces = (commentaire.etrePublic() ? i18nC.donneePublic() : i18nC.donneePrivee());
-
 
1087
				
-
 
1088
				Params ligneParams = new Params();
-
 
1089
				ligneParams.set("type", type);
-
 
1090
				ligneParams.set("titre", commentaire.getTitre());
-
 
1091
				ligneParams.set("texte", commentaire.getTexte());
-
 
1092
				ligneParams.set("ponderation", commentaire.getPonderation()+"/100");
-
 
1093
				ligneParams.set("public", acces);
-
 
1094
				
-
 
1095
				lignesCommentaire += Format.substitute(ligneCommentaireLieeTpl, ligneParams);
-
 
1096
			}
-
 
1097
		}
-
 
1098
		
-
 
1099
		String cHtml = i18nC.nonRenseigne();
-
 
1100
		if (!UtilString.isEmpty(lignesCommentaire)) {
-
 
1101
			contenuParams.set("lignes", lignesCommentaire);
-
 
1102
			cHtml = Format.substitute(tableauCommentairesLieesTpl, contenuParams);
-
 
1103
		}
-
 
1104
		return cHtml;
993
	}
1105
	}
994
	
1106
	
995
	protected String getNomStructure() {
1107
	protected String getNomStructure() {
996
		String nomStructure = "";
1108
		String nomStructure = "";
997
		if (structure != null) {
1109
		if (structure != null) {