Subversion Repositories eFlore/Applications.coel

Rev

Rev 1802 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
935 jpm 1
package org.tela_botanica.client.vues.structure;
60 jpm 2
 
379 jp_milcent 3
import java.util.Iterator;
4
 
5
import org.tela_botanica.client.ComposantClass;
373 jp_milcent 6
import org.tela_botanica.client.ComposantId;
7
import org.tela_botanica.client.Mediateur;
1802 aurelien 8
import org.tela_botanica.client.RegistreId;
9
import org.tela_botanica.client.configuration.Configuration;
60 jpm 10
import org.tela_botanica.client.interfaces.Rafraichissable;
379 jp_milcent 11
import org.tela_botanica.client.modeles.Information;
406 jp_milcent 12
import org.tela_botanica.client.modeles.ValeurListe;
1802 aurelien 13
import org.tela_botanica.client.modeles.collection.CollectionAStructure;
14
import org.tela_botanica.client.modeles.collection.CollectionAStructureListe;
935 jpm 15
import org.tela_botanica.client.modeles.structure.Structure;
16
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
17
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
18
import org.tela_botanica.client.modeles.structure.StructureConservation;
19
import org.tela_botanica.client.modeles.structure.StructureValorisation;
1322 gduche 20
import org.tela_botanica.client.synchronisation.Sequenceur;
936 jpm 21
import org.tela_botanica.client.vues.DetailVue;
60 jpm 22
 
1802 aurelien 23
import com.extjs.gxt.ui.client.Registry;
60 jpm 24
import com.extjs.gxt.ui.client.Style.Scroll;
25
import com.extjs.gxt.ui.client.util.Format;
26
import com.extjs.gxt.ui.client.util.Params;
27
import com.extjs.gxt.ui.client.widget.ContentPanel;
374 jp_milcent 28
import com.extjs.gxt.ui.client.widget.Html;
373 jp_milcent 29
import com.extjs.gxt.ui.client.widget.TabItem;
30
import com.extjs.gxt.ui.client.widget.TabPanel;
390 jp_milcent 31
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
60 jpm 32
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
373 jp_milcent 33
import com.google.gwt.core.client.GWT;
60 jpm 34
 
453 jp_milcent 35
public class StructureDetailVue extends DetailVue implements Rafraichissable {
60 jpm 36
 
374 jp_milcent 37
	private String enteteTpl = null;
379 jp_milcent 38
	private String identificationTpl = null;
39
	private String personnelTpl = null;
390 jp_milcent 40
	private String tableauPersonnelTpl = null;
379 jp_milcent 41
	private String lignePersonnelTpl = null;
390 jp_milcent 42
	private String conservationTpl = null;
420 jp_milcent 43
	private String traitementConservationTpl = null;
390 jp_milcent 44
	private String valorisationTpl = null;
426 jp_milcent 45
	private String typeTraitementConservationTpl = null;
46
	private String rechercheValorisationTpl = null;
1802 aurelien 47
	private String collectionTpl = null;
48
	private String ligneCollectionTpl = null;
49
	private String tableauCollectionTpl = null;
373 jp_milcent 50
 
51
	private Structure structure = null;
814 jpm 52
	private boolean structureChargementOk = false;
379 jp_milcent 53
	private StructureAPersonneListe personnel = null;
814 jpm 54
	private boolean personnelChargementOk = false;
379 jp_milcent 55
	private StructureValorisation valorisation = null;
56
	private StructureConservation conservation = null;
1802 aurelien 57
	private CollectionAStructureListe collection = null;
58
	private boolean collectionChargementOk = false;
373 jp_milcent 59
 
60
	private ContentPanel panneauPrincipal = null;
374 jp_milcent 61
	private Html entete = null;
373 jp_milcent 62
	private TabPanel onglets = null;
63
	private TabItem identificationOnglet = null;
379 jp_milcent 64
	private TabItem personnelOnglet = null;
1802 aurelien 65
	private TabItem collectionOnglet = null;
390 jp_milcent 66
	private TabItem conservationOnglet = null;
67
	private TabItem valorisationOnglet = null;
406 jp_milcent 68
 
1322 gduche 69
	private Sequenceur sequenceur;
70
 
71
	public StructureDetailVue(Mediateur mediateurCourant, Sequenceur sequenceur) {
453 jp_milcent 72
		super(mediateurCourant);
1322 gduche 73
		this.sequenceur = sequenceur;
453 jp_milcent 74
 
379 jp_milcent 75
		initialiserTousLesTpl();
420 jp_milcent 76
		chargerOntologie();
60 jpm 77
 
373 jp_milcent 78
		panneauPrincipal = new ContentPanel();
522 gduche 79
		panneauPrincipal.setLayout(new FitLayout());
374 jp_milcent 80
		panneauPrincipal.setHeaderVisible(false);
81
		panneauPrincipal.setBodyBorder(false);
390 jp_milcent 82
 
374 jp_milcent 83
	    entete = new Html();
379 jp_milcent 84
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
374 jp_milcent 85
	    panneauPrincipal.setTopComponent(entete);
86
 
373 jp_milcent 87
		onglets = new TabPanel();
379 jp_milcent 88
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
374 jp_milcent 89
		onglets.setBodyBorder(false);
522 gduche 90
 
426 jp_milcent 91
		identificationOnglet = new TabItem(i18nC.structureInfoGeneral());
390 jp_milcent 92
		identificationOnglet.setLayout(new AnchorLayout());
379 jp_milcent 93
		identificationOnglet.setScrollMode(Scroll.AUTO);
373 jp_milcent 94
		onglets.add(identificationOnglet);
95
 
426 jp_milcent 96
		personnelOnglet = new TabItem(i18nC.structureInfoPersonnel());
390 jp_milcent 97
		personnelOnglet.setLayout(new AnchorLayout());
379 jp_milcent 98
		personnelOnglet.setScrollMode(Scroll.AUTO);
99
		onglets.add(personnelOnglet);
100
 
1802 aurelien 101
		collectionOnglet = new TabItem(i18nC.structureInfoCollection());
102
		collectionOnglet.setLayout(new AnchorLayout());
103
		collectionOnglet.setScrollMode(Scroll.AUTO);
104
		onglets.add(collectionOnglet);
105
 
426 jp_milcent 106
		conservationOnglet = new TabItem(i18nC.structureInfoConservation());
390 jp_milcent 107
		conservationOnglet.setLayout(new AnchorLayout());
108
		conservationOnglet.setScrollMode(Scroll.AUTO);
109
		onglets.add(conservationOnglet);
110
 
426 jp_milcent 111
		valorisationOnglet = new TabItem(i18nC.structureInfoValorisation());
390 jp_milcent 112
		valorisationOnglet.setLayout(new AnchorLayout());
113
		valorisationOnglet.setScrollMode(Scroll.AUTO);
114
		onglets.add(valorisationOnglet);
115
 
373 jp_milcent 116
		panneauPrincipal.add(onglets);
117
		add(panneauPrincipal);
60 jpm 118
	}
119
 
420 jp_milcent 120
	private void chargerOntologie() {
1322 gduche 121
		String[] listesCodes = {"stpr", "stpu", "pays", "statut", "fonction",  "localStockage", "meubleStockage",
814 jpm 122
			"parametreStockage", "autreCollection", "onep", "opRestau", "autreMateriel", "poisonTraitement",
123
			"insecteTraitement", "actionValorisation", "continentEtFr", "typeRecherche"};
1322 gduche 124
		lancerChargementListesValeurs(listesCodes, this.sequenceur);
1373 cyprien 125
		sequenceur.enfilerRafraichissement(this, new Information("ontologie_chargee"));
1322 gduche 126
 
420 jp_milcent 127
	}
128
 
390 jp_milcent 129
	private void afficherDetailInstitution() {
130
		if (structure != null) {
379 jp_milcent 131
			personnel = structure.getPersonnel();
132
			valorisation = structure.getValorisation();
133
			conservation = structure.getConservation();
134
 
373 jp_milcent 135
			afficherEntete();
136
			afficherIdentification();
390 jp_milcent 137
			if (personnel != null) {
138
				afficherPersonnel();
139
			}
140
			if (conservation != null) {
406 jp_milcent 141
				afficherConservation();
390 jp_milcent 142
			}
143
			if (valorisation != null) {
426 jp_milcent 144
				afficherValorisation();
390 jp_milcent 145
			}
1802 aurelien 146
			if (collection != null) {
147
				afficherCollection();
148
			}
60 jpm 149
		}
374 jp_milcent 150
		layout();
60 jpm 151
	}
373 jp_milcent 152
 
153
	private void afficherEntete() {
154
		Params enteteParams = new Params();
390 jp_milcent 155
		enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
156
		enteteParams.set("css_meta", ComposantClass.META);
157
 
814 jpm 158
		enteteParams.set("i18n_id", i18nC.id());
159
 
379 jp_milcent 160
		enteteParams.set("nom", structure.getNom());
161
		enteteParams.set("ville", structure.getVille());
390 jp_milcent 162
		enteteParams.set("id", structure.getId());
163
		enteteParams.set("guid", structure.getGuid());
373 jp_milcent 164
 
374 jp_milcent 165
		String eHtml = Format.substitute(enteteTpl, enteteParams);
373 jp_milcent 166
		entete.getElement().setInnerHTML(eHtml);
167
	}
168
 
169
	private void afficherIdentification() {
420 jp_milcent 170
		Params identificationParams = new Params();
406 jp_milcent 171
		identificationParams.set("i18n_titre_administratif", i18nC.titreAdministratif());
172
		identificationParams.set("i18n_acronyme", i18nC.acronyme());
173
		identificationParams.set("i18n_statut", i18nC.statut());
602 jp_milcent 174
		identificationParams.set("i18n_date_fondation", i18nC.dateFondation());
175
		identificationParams.set("i18n_nbre_personnel", i18nC.nbrePersonnel());
390 jp_milcent 176
 
602 jp_milcent 177
		identificationParams.set("i18n_titre_description", i18nC.description());
178
		identificationParams.set("i18n_description", i18nC.description());
1173 jpm 179
		identificationParams.set("i18n_acces", i18nC.acces());
180
		identificationParams.set("i18n_usage", i18nC.usage());
390 jp_milcent 181
 
602 jp_milcent 182
		identificationParams.set("i18n_titre_adresse", i18nC.adresse());
183
		identificationParams.set("i18n_adresse", i18nC.adresse());
184
		identificationParams.set("i18n_cp", i18nC.codePostal());
185
		identificationParams.set("i18n_ville", i18nC.ville());
186
		identificationParams.set("i18n_pays", i18nC.pays());
1173 jpm 187
		identificationParams.set("i18n_latitude", i18nC.latitude());
188
		identificationParams.set("i18n_longitude", i18nC.longitude());
390 jp_milcent 189
 
602 jp_milcent 190
		identificationParams.set("i18n_titre_communication", i18nC.titreCommunication());
191
		identificationParams.set("i18n_tel", i18nC.telephone());
696 jp_milcent 192
		identificationParams.set("i18n_fax", i18nC.FAX());
602 jp_milcent 193
		identificationParams.set("i18n_courriel", i18nC.courriel());
194
		identificationParams.set("i18n_web", i18nC.siteWeb());
420 jp_milcent 195
 
196
		String acronyme = construireTxtTruck(structure.getIdAlternatif());
197
		String typePrive = construireTxtListeOntologie(structure.getTypePrive());
198
		String typePublic = construireTxtListeOntologie(structure.getTypePublic());
1322 gduche 199
		String pays = 	construireTxtListeOntologie(structure.getPays());
1369 cyprien 200
		String web = construireTxtTruck(structure.getUrl(), false);
1173 jpm 201
		String latitude = structure.getLatitude();
202
		String longitude = structure.getLongitude();
203
		String latitudeLongitude = (!longitude.equals("") && !latitude.equals("")) ? latitude+" / "+longitude : "";
390 jp_milcent 204
 
420 jp_milcent 205
		identificationParams.set("acronyme", acronyme);
206
		identificationParams.set("statut", typePrive+typePublic);
1898 aurelien 207
 
208
		String dateFondation = structure.getAnneOuDateFondationFormatLong();
209
		dateFondation = dateFondation.equals("0000") ? "" : dateFondation;
210
		identificationParams.set("date_fondation", dateFondation);
1690 raphael 211
		identificationParams.set("nbre_personnel", structure.getNbrePersonne() != null ? structure.getNbrePersonne() : "");
390 jp_milcent 212
 
406 jp_milcent 213
		identificationParams.set("description", structure.getDescription());
1173 jpm 214
		identificationParams.set("acces", structure.getConditionAcces());
215
		identificationParams.set("usage", structure.getConditionUsage());
390 jp_milcent 216
 
406 jp_milcent 217
		identificationParams.set("adresse", structure.getAdresse());
218
		identificationParams.set("cp", structure.getCodePostal());
219
		identificationParams.set("ville", structure.getVille());
1373 cyprien 220
 
420 jp_milcent 221
		identificationParams.set("pays", pays);
1173 jpm 222
		identificationParams.set("latitude_longitude", latitudeLongitude);
390 jp_milcent 223
 
1284 gduche 224
		identificationParams.set("tel", structure.getTelephoneFixe());
225
		identificationParams.set("fax", structure.getFax());
1239 cyprien 226
 
406 jp_milcent 227
		identificationParams.set("courriel", structure.getCourriel());
420 jp_milcent 228
		identificationParams.set("web", web);
379 jp_milcent 229
 
406 jp_milcent 230
		afficherOnglet(identificationTpl, identificationParams, identificationOnglet);
373 jp_milcent 231
	}
232
 
379 jp_milcent 233
	private void afficherPersonnel() {
390 jp_milcent 234
		String tableauPersonnelHtml = "";
235
		if (personnel.size() > 0) {
236
			tableauPersonnelHtml = construireTableauDuPersonnel();
237
		}
238
 
420 jp_milcent 239
		Params personnelParams = new Params();
406 jp_milcent 240
		personnelParams.set("i18n_titre_personnel", i18nC.titrePersonnel());
241
		personnelParams.set("i18n_nbre_personnel_collection", i18nC.nbrePersonnelCollection());
242
		personnelParams.set("nbre_personnel_collection", personnel.size());
243
		personnelParams.set("tableau_personnel", tableauPersonnelHtml);
379 jp_milcent 244
 
406 jp_milcent 245
		afficherOnglet(personnelTpl, personnelParams, personnelOnglet);
390 jp_milcent 246
	}
247
 
248
	private String construireTableauDuPersonnel() {
249
		Params contenuParams = new Params();
406 jp_milcent 250
		contenuParams.set("i18n_titre_membre", i18nC.titreMembre());
251
		contenuParams.set("i18n_fonction", i18nC.fonction());
696 jp_milcent 252
		contenuParams.set("i18n_prenom", i18nC.personnePrenom());
253
		contenuParams.set("i18n_nom", i18nC.personneNom());
254
		contenuParams.set("i18n_tel", i18nC.FIX());
255
		contenuParams.set("i18n_fax", i18nC.FAX());
406 jp_milcent 256
		contenuParams.set("i18n_courriel", i18nC.courrielPrincipal());
257
		contenuParams.set("i18n_statut", i18nC.statut());
258
		contenuParams.set("i18n_tps_w", i18nC.tpsTravail());
259
		contenuParams.set("i18n_specialite", i18nC.specialite());
260
		contenuParams.set("i18n_contact", i18nC.boolContact());
390 jp_milcent 261
 
379 jp_milcent 262
		String lignesPersonnel = "";
602 jp_milcent 263
 
379 jp_milcent 264
		Iterator<String> it = personnel.keySet().iterator();
265
		while (it.hasNext()) {
266
			StructureAPersonne personne = personnel.get(it.next());
267
			Params ligneParams = new Params();
420 jp_milcent 268
 
269
			String fonction = construireTxtListeOntologie(personne.getFonction());
270
			String statut = construireTxtListeOntologie(personne.getStatut());
271
			String contact = formaterOuiNon(personne.getContact());
272
 
273
			ligneParams.set("fonction", fonction);
379 jp_milcent 274
			ligneParams.set("prenom", personne.getPrenom());
275
			ligneParams.set("nom", personne.getNom());
602 jp_milcent 276
			ligneParams.set("tel_fix", personne.getTelephoneFixe());
277
			ligneParams.set("tel_fax", personne.getFax());
379 jp_milcent 278
			ligneParams.set("courriel", personne.getCourriel());
420 jp_milcent 279
			ligneParams.set("statut", statut);
379 jp_milcent 280
			ligneParams.set("tps_w", personne.getBotaTravailHebdoTps());
281
			ligneParams.set("specialite", personne.afficherSpecialite());
420 jp_milcent 282
			ligneParams.set("contact", contact);
379 jp_milcent 283
			lignesPersonnel += Format.substitute(lignePersonnelTpl, ligneParams);
284
		}
285
		contenuParams.set("lignes", lignesPersonnel);
286
 
390 jp_milcent 287
		String cHtml = Format.substitute(tableauPersonnelTpl, contenuParams);
288
		return cHtml;
379 jp_milcent 289
	}
406 jp_milcent 290
 
291
	private void afficherConservation() {
420 jp_milcent 292
		Params conservationParams  = new Params();
406 jp_milcent 293
		conservationParams.set("i18n_titre_conservation_personnel", i18nC.titreConservationPersonnel());
294
		conservationParams.set("i18n_formation", i18nC.formation());
295
		conservationParams.set("i18n_formation_interet", i18nC.formationInteret());
296
 
297
		conservationParams.set("i18n_titre_local", i18nC.titreLocal());
298
		conservationParams.set("i18n_local_specifique", i18nC.localSpecifique());
299
		conservationParams.set("i18n_meuble_specifique", i18nC.meubleSpecifique());
300
		conservationParams.set("i18n_local_parametre", i18nC.localParametre());
420 jp_milcent 301
		conservationParams.set("i18n_conservation_en_commun", i18nC.conservationEnCommun());
302
		conservationParams.set("i18n_acces_controle", i18nC.accesControle());
406 jp_milcent 303
 
420 jp_milcent 304
		conservationParams.set("i18n_titre_operation", i18nC.titreOperation());
305
		conservationParams.set("i18n_restauration", i18nC.restauration());
306
		conservationParams.set("i18n_materiel_conservation", i18nC.materielConservation());
307
		conservationParams.set("i18n_traitement", i18nC.traitement());
308
 
309
		conservationParams.set("i18n_titre_acquisition", i18nC.titreAcquisition());
310
		conservationParams.set("i18n_acquisition_collection", i18nC.acquisitionCollection());
311
		conservationParams.set("i18n_acquisition_echantillon", i18nC.acquisitionEchantillon());
312
 
406 jp_milcent 313
		conservationParams.set("formation", formaterOuiNon(conservation.getFormation()));
314
		conservationParams.set("formation_info", formaterSautDeLigne(conservation.getFormationInfo()));
315
		conservationParams.set("formation_interet", formaterOuiNon(conservation.getFormationInteret()));
316
		conservationParams.set("meuble_specifique", conservation.getStockageMeuble());
317
 
420 jp_milcent 318
		String chaineAAnalyser = conservation.getStockageLocal();
319
		String chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
320
		conservationParams.set("local_specifique", chaineAAfficher);
406 jp_milcent 321
 
420 jp_milcent 322
		chaineAAnalyser = conservation.getStockageMeuble();
323
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
324
		conservationParams.set("meuble_specifique", chaineAAfficher);
325
 
326
		chaineAAnalyser = conservation.getStockageParametre();
327
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
328
		conservationParams.set("local_parametre", chaineAAfficher);
329
 
330
		conservationParams.set("conservation_en_commun", formaterOuiNon(conservation.getCollectionCommune()));
331
		chaineAAnalyser = conservation.getCollectionAutre();
332
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
333
		conservationParams.set("collection_autre", formaterParenthese(chaineAAfficher));
334
 
335
		conservationParams.set("acces_controle", formaterOuiNon(conservation.getAccesControle()));
336
 
337
		conservationParams.set("restauration", formaterOuiNon(conservation.getRestauration()));
338
		chaineAAnalyser = conservation.getRestaurationOperation();
339
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
340
		conservationParams.set("restauration_operation", formaterParenthese(chaineAAfficher));
341
 
342
		chaineAAnalyser = conservation.getMaterielConservation();
343
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
344
		conservationParams.set("materiel_conservation", chaineAAfficher);
345
		chaineAAnalyser = conservation.getMaterielAutre();
346
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
347
		conservationParams.set("materiel_autre", formaterParenthese(chaineAAfficher));
348
 
349
		conservationParams.set("traitement", formaterOuiNon(conservation.getTraitement()));
350
		chaineAAnalyser = conservation.getTraitements();
351
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
352
		conservationParams.set("traitements", formaterParenthese(chaineAAfficher));
353
 
354
		conservationParams.set("acquisition_collection", formaterOuiNon(conservation.getAcquisitionCollection()));
355
		conservationParams.set("acquisition_echantillon", formaterOuiNon(conservation.getAcquisitionEchantillon()));
356
		conservationParams.set("acquisition_traitement_info", construireTraitement());
357
 
406 jp_milcent 358
		afficherOnglet(conservationTpl, conservationParams, conservationOnglet);
359
	}
360
 
420 jp_milcent 361
	private String construireTraitement() {
362
		String cHtml = "";
1695 raphael 363
		Integer echantillon = conservation.getAcquisitionEchantillon();
420 jp_milcent 364
 
1695 raphael 365
		if (echantillon != null && echantillon.intValue() == 1) {
420 jp_milcent 366
			Params traitementConservationParams  = new Params();
367
			traitementConservationParams.set("i18n_acquisition_traitement", i18nC.acquisitionTraitement());
368
 
369
			traitementConservationParams.set("acquisition_traitement", formaterOuiNon(conservation.getAcquisitionTraitement()));
370
 
371
			traitementConservationParams.set("acquisition_traitement_type_info", construireTraitementType());
372
 
373
			cHtml = Format.substitute(traitementConservationTpl, traitementConservationParams);
374
		}
375
 
376
		return cHtml;
377
	}
378
 
379
	private String construireTraitementType() {
380
		String cHtml = "";
381
		String traitement = conservation.getAcquisitionTraitement();
382
 
383
		if (traitement.equals("1")) {
384
			Params typeTraitementParams  = new Params();
385
			typeTraitementParams.set("i18n_acquisition_traitement_insecte", i18nC.acquisitionTraitementInsecte());
386
			typeTraitementParams.set("i18n_acquisition_traitement_poison", i18nC.acquisitionTraitementPoison());
387
 
388
			String acquisitionTraitementInsecte = construireTxtListeOntologie(conservation.getAcquisitionTraitementInsecte());
389
			typeTraitementParams.set("acquisition_traitement_insecte", acquisitionTraitementInsecte);
390
			String acquisitionTraitementPoison = construireTxtListeOntologie(conservation.getAcquisitionTraitementPoison());
391
			typeTraitementParams.set("acquisition_traitement_poison", acquisitionTraitementPoison);
392
 
393
			cHtml = Format.substitute(typeTraitementConservationTpl, typeTraitementParams);
394
		}
395
 
396
		return cHtml;
397
	}
398
 
426 jp_milcent 399
	private void afficherValorisation() {
400
		Params valorisationParams  = new Params();
401
		valorisationParams.set("i18n_titre_action_valorisation", i18nC.titreActionValorisation());
402
		valorisationParams.set("i18n_action", i18nC.action());
403
		valorisationParams.set("i18n_action_publication", i18nC.actionPublication());
404
		valorisationParams.set("i18n_collection_autre", i18nC.collectionAutre());
405
		valorisationParams.set("i18n_action_future", i18nC.actionFuture());
406
 
407
		valorisationParams.set("action", formaterOuiNon(valorisation.getAction()));
408
		String actionInfo = construireTxtListeOntologie(valorisation.getActionInfo());
409
		valorisationParams.set("action_info", formaterParenthese(actionInfo));
410
		valorisationParams.set("action_publication", valorisation.getPublication());
411
		String collectionAutre = construireTxtListeOntologie(valorisation.getCollectionAutre());
412
		valorisationParams.set("collection_autre", collectionAutre);
413
		valorisationParams.set("action_future", formaterOuiNon(valorisation.getActionFuture()));
414
		valorisationParams.set("action_future_info", formaterParenthese(valorisation.getActionFutureInfo()));
415
 
416
		valorisationParams.set("i18n_titre_recherche_scientifique", i18nC.titreRechercherScientifique());
417
		valorisationParams.set("i18n_recherche", i18nC.recherche());
418
 
419
		valorisationParams.set("recherche", formaterOuiNon(valorisation.getRecherche()));
420
		valorisationParams.set("recherche_info", construireRecherche());
421
 
422
		valorisationParams.set("i18n_titre_acces_usage", i18nC.titreAccesUsage());
423
		valorisationParams.set("i18n_acces", i18nC.acces());
424
		valorisationParams.set("i18n_visite", i18nC.visite());
425
 
426
		valorisationParams.set("acces", formaterOuiNon(valorisation.getAccesSansMotif()));
427
		valorisationParams.set("acces_info", formaterParenthese(valorisation.getAccesSansMotifInfo()));
428
		valorisationParams.set("visite", formaterOuiNon(valorisation.getVisiteAvecMotif()));
429
		valorisationParams.set("visite_info", formaterParenthese(valorisation.getVisiteAvecMotifInfo()));
430
 
431
		afficherOnglet(valorisationTpl, valorisationParams, valorisationOnglet);
406 jp_milcent 432
	}
433
 
426 jp_milcent 434
	private String construireRecherche() {
435
		String cHtml = "";
1733 raphael 436
		Integer recherche = valorisation.getRecherche();
426 jp_milcent 437
 
1733 raphael 438
		if (recherche != null && recherche.intValue() == 1) {
426 jp_milcent 439
			Params rechercheParams  = new Params();
440
			rechercheParams.set("i18n_recherche_provenance", i18nC.rechercheProvenance());
441
			rechercheParams.set("i18n_recherche_type", i18nC.rechercheType());
442
 
443
			String rechercheProvenance = construireTxtListeOntologie(valorisation.getRechercheProvenance());
444
			rechercheParams.set("recherche_provenance", rechercheProvenance);
445
			String rechercheType = construireTxtListeOntologie(valorisation.getRechercheType());
446
			rechercheParams.set("recherche_type", rechercheType);
447
 
448
			cHtml = Format.substitute(rechercheValorisationTpl, rechercheParams);
420 jp_milcent 449
		}
426 jp_milcent 450
 
451
		return cHtml;
420 jp_milcent 452
	}
453
 
1802 aurelien 454
	private void afficherCollection() {
455
		Params collectionParams  = new Params();
456
 
457
		collectionParams.set("i18n_titre_collection", i18nC.structureInfoCollection());
458
		collectionParams.set("i18n_indication_collection", i18nC.structureIndicationCollection());
459
		collectionParams.set("i18n_indication_lien_collection", i18nC.structureIndicationLienCollection());
460
		collectionParams.set("css_indication_titre_petit", ComposantClass.INDICATION_TITRE_PETIT);
461
 
462
		String guidTpl = ((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("consultationCollectionsLieesStructures");
463
		String guid = guidTpl.replace("{str_id}", structure.getId());
464
		collectionParams.set("guid_structure", guid);
465
 
466
		String tableauCollectionHtml = "";
467
		if (collection.size() > 0) {
468
			tableauCollectionHtml = construireTableauCollection();
469
		}
470
		collectionParams.set("tableau_collection", tableauCollectionHtml);
471
 
472
		afficherOnglet(collectionTpl, collectionParams, collectionOnglet);
473
	}
474
 
475
	private String construireTableauCollection() {
476
		Params contenuParams = new Params();
477
		String lignesCollection = "";
478
 
479
		contenuParams.set("i18n_nom_collection", i18nC.nomCollection());
480
		contenuParams.set("i18n_id_collection", i18nC.id());
481
		contenuParams.set("i18n_lien_collection", i18nC.structureLienCollection());
482
		contenuParams.set("css_largeur_colonne_id", ComposantClass.LARGEUR_COLONNE_ID);
483
 
484
		String guidTpl = ((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("consultationCollections");
485
 
486
		Iterator<String> it = collection.keySet().iterator();
487
		while (it.hasNext()) {
488
			CollectionAStructure collectionCourante = collection.get(it.next());
489
			Params ligneParams = new Params();
490
 
491
			String guidCollection = guidTpl.replace("{col_id}", collectionCourante.getIdCollection());
492
			ligneParams.set("guid_structure", guidCollection);
493
 
494
			ligneParams.set("id_collection", collectionCourante.getIdCollection());
495
			ligneParams.set("nom_collection", collectionCourante.getNom());
496
			ligneParams.set("lien_collection", guidCollection);
497
 
498
			lignesCollection += Format.substitute(ligneCollectionTpl, ligneParams);
499
		}
500
		contenuParams.set("lignes", lignesCollection);
501
 
502
		String cHtml = Format.substitute(tableauCollectionTpl, contenuParams);
503
		return cHtml;
504
	}
505
 
379 jp_milcent 506
	private void initialiserTousLesTpl() {
814 jpm 507
		initialiserEnteteTpl();
379 jp_milcent 508
		initialiserIdentificationTpl();
509
		initialiserPersonnelTpl();
390 jp_milcent 510
		initialiserTableauPersonnelTpl();
379 jp_milcent 511
		initialiserLignePersonnelTpl();
390 jp_milcent 512
		initialiserConservationTpl();
420 jp_milcent 513
		initialiserTraitementConservationTpl();
514
		initialiserTypeTraitementConservationTpl();
390 jp_milcent 515
		initialiserValorisationTpl();
426 jp_milcent 516
		initialiserRechercheValorisationTpl();
1802 aurelien 517
		initialiserCollectionTpl();
518
		initialiserTableauCollectionTpl();
519
		initialiserLigneCollectionTpl();
379 jp_milcent 520
	}
521
 
814 jpm 522
	private void initialiserEnteteTpl() {
420 jp_milcent 523
		enteteTpl =
524
			"<div id='{css_id}'>"+
525
			"	<h1>{nom}</h1>"+
1764 aurelien 526
			"	<h2>{ville}<span class='{css_meta}'> <br /> {i18n_id}:{id} - {guid}</span></h2>" +
420 jp_milcent 527
			"	" +
528
			"</div>";
373 jp_milcent 529
	}
530
 
379 jp_milcent 531
	private void initialiserIdentificationTpl() {
532
		identificationTpl =
420 jp_milcent 533
			"<div class='{css_corps}'>"+
534
			"	<div class='{css_fieldset}'>"+
535
			"		<h2>{i18n_titre_administratif}</h2>"+
536
			"		<span class='{css_label}'>{i18n_acronyme} :</span> {acronyme}<br />"+
537
			"		<span class='{css_label}'>{i18n_statut} :</span> {statut}<br />"+
538
			"		<span class='{css_label}'>{i18n_date_fondation} :</span> {date_fondation}<br />"+
539
			"		<span class='{css_label}'>{i18n_nbre_personnel} :</span> {nbre_personnel}<br />"+
540
			"	</div>"+
541
			"	<div class='{css_fieldset}'>"+
542
			"		<h2>{i18n_titre_description}</h2>"+
1173 jpm 543
			"		<span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
544
			"		<span class='{css_label}'>{i18n_acces} :</span> {acces}<br />"+
545
			"		<span class='{css_label}'>{i18n_usage} :</span> {usage}<br />"+
420 jp_milcent 546
			"	</div>"+
547
			"	<hr class='{css_clear}'/>"+
548
			"	<div class='{css_fieldset}'>"+
549
			"		<h2>{i18n_titre_adresse}</h2>"+
550
			"		<span class='{css_label}'>{i18n_adresse} :</span> {adresse}<br />" +
551
			"		<span class='{css_label}'>{i18n_cp} :</span> {cp}<br />" +
552
			"		<span class='{css_label}'>{i18n_ville} :</span> {ville}<br />" +
553
			"		<span class='{css_label}'>{i18n_pays} :</span> {pays}<br />" +
1173 jpm 554
			"		<span class='{css_label}'>{i18n_latitude} / {i18n_longitude} :</span> {latitude_longitude}<br />" +
420 jp_milcent 555
			"	</div>"+
556
			"	<div class='{css_fieldset}'>"+
557
			"		<h2>{i18n_titre_communication}</h2>"+
558
			"		<span class='{css_label}'>{i18n_tel} :</span> {tel}<br />"+
559
			"		<span class='{css_label}'>{i18n_fax} :</span> {fax}<br />"+
560
			"		<span class='{css_label}'>{i18n_courriel} :</span> {courriel}<br />"+
561
			"		<span class='{css_label}'>{i18n_web} :</span> {web}<br />"+
562
			"	</div>"+
563
			"</div>";
373 jp_milcent 564
	}
565
 
379 jp_milcent 566
	private void initialiserPersonnelTpl() {
567
		personnelTpl =
420 jp_milcent 568
			"<div class='{css_corps}'>"+
569
			"	<h2>{i18n_titre_personnel}</h2>"+
570
			"	<p><span class='{css_label}'>{i18n_nbre_personnel_collection} :</span> {nbre_personnel_collection}</p>"+
571
			"	{tableau_personnel}"+
572
			"</div>";
379 jp_milcent 573
	}
574
 
390 jp_milcent 575
	private void initialiserTableauPersonnelTpl() {
576
		tableauPersonnelTpl =
420 jp_milcent 577
			"<h3>{i18n_titre_membre}</h3>"+
578
			"<table>"+
579
			"	<thead>"+
580
			"		<tr>" +
581
			"			<th>{i18n_fonction}</th>" +
582
			"			<th>{i18n_prenom}</th>" +
583
			"			<th>{i18n_nom}</th>" +
584
			"			<th>{i18n_tel}</th>" +
585
			"			<th>{i18n_fax}</th>" +
586
			"			<th>{i18n_courriel}</th>" +
587
			"			<th>{i18n_statut}</th>" +
588
			"			<th>{i18n_tps_w}</th>" +
589
			"			<th>{i18n_specialite}</th>" +
590
			"			<th>{i18n_contact}</th>" +
591
			"		</tr>"+
592
			"	</thead>"+
593
			"	<tbody>"+
594
			"		{lignes}"+
595
			"	</tbody>"+
596
			"</table>";
390 jp_milcent 597
	}
598
 
379 jp_milcent 599
	private void initialiserLignePersonnelTpl() {
600
		lignePersonnelTpl =
420 jp_milcent 601
			"<tr>"+
602
			"	<td>{fonction}</td>"+
603
			"	<td>{prenom}</td>"+
604
			"	<td>{nom}</td>"+
602 jp_milcent 605
			"	<td>{tel_fix}</td>" +
606
			"	<td>{tel_fax}</td>" +
420 jp_milcent 607
			"	<td>{courriel}</td>" +
608
			"	<td>{statut}</td>" +
609
			"	<td>{tps_w}</td>" +
610
			"	<td>{specialite}</td>" +
611
			"	<td>{contact}</td>" +
612
			"</tr>";
379 jp_milcent 613
	}
614
 
390 jp_milcent 615
	private void initialiserConservationTpl() {
616
		conservationTpl =
420 jp_milcent 617
			"<div class='{css_corps}'>"+
618
			"	<div class='{css_fieldset}'>"+
619
			"		<h2>{i18n_titre_conservation_personnel}</h2>"+
620
			"		<span class='{css_label}'>{i18n_formation} :</span> {formation}<br />"+
621
			"		{formation_info}<br />"+
622
			"		<span class='{css_label}'>{i18n_formation_interet} :</span> {formation_interet}<br />"+
623
			"	</div>"+
624
			"	<div class='{css_fieldset}'>"+
625
			"		<h2>{i18n_titre_local}</h2>"+
626
			"		<span class='{css_label}'>{i18n_local_specifique} :</span> {local_specifique}<br />"+
627
			"		<span class='{css_label}'>{i18n_meuble_specifique} :</span> {meuble_specifique}<br />"+
628
			"		<span class='{css_label}'>{i18n_local_parametre} :</span> {local_parametre}<br />"+
629
			"		<span class='{css_label}'>{i18n_conservation_en_commun} :</span> {conservation_en_commun} {collection_autre}<br />"+
630
			"		<span class='{css_label}'>{i18n_acces_controle} :</span> {acces_controle}<br />"+
631
			"	</div>"+
1802 aurelien 632
			"	<hr class='{css_clear}'Window/>"+
420 jp_milcent 633
			"	<div class='{css_fieldset}'>"+
634
			"		<h2>{i18n_titre_operation}</h2>"+
635
			"		<span class='{css_label}'>{i18n_restauration} :</span> {restauration} {restauration_operation}<br />"+
636
			"		<span class='{css_label}'>{i18n_materiel_conservation} :</span> {materiel_conservation} {materiel_autre}<br />"+
637
			"		<span class='{css_label}'>{i18n_traitement} :</span> {traitement} {traitements}<br />"+
638
			"	</div>"+
639
			"	<div class='{css_fieldset}'>"+
640
			"		<h2>{i18n_titre_acquisition}</h2>"+
641
			"		<span class='{css_label}'>{i18n_acquisition_collection} :</span> {acquisition_collection}<br />"+
642
			"		<span class='{css_label}'>{i18n_acquisition_echantillon} :</span> {acquisition_echantillon}<br />"+
643
			"			{acquisition_traitement_info}" +
644
			"	</div>"+
645
			"</div>";
390 jp_milcent 646
	}
647
 
420 jp_milcent 648
	private void initialiserTraitementConservationTpl() {
649
		traitementConservationTpl =
426 jp_milcent 650
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement} :</span> {acquisition_traitement}<br />"+
651
			"	<div class='{css_indentation}'>"+
652
			"		{acquisition_traitement_type_info}"+
653
			"	</div>";
420 jp_milcent 654
	}
655
 
656
	private void initialiserTypeTraitementConservationTpl() {
657
		typeTraitementConservationTpl =
658
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_insecte} :</span> {acquisition_traitement_insecte}<br />"+
659
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_poison} :</span> {acquisition_traitement_poison}<br />";
660
	}
661
 
390 jp_milcent 662
	private void initialiserValorisationTpl() {
663
		valorisationTpl =
420 jp_milcent 664
			"<div class='{css_corps}'>"+
665
			"	<div class='{css_fieldset}'>"+
666
			"		<h2>{i18n_titre_action_valorisation}</h2>"+
426 jp_milcent 667
			"		<span class='{css_label}'>{i18n_action} :</span> {action} {action_info}<br />"+
668
			"		<span class='{css_label}'>{i18n_action_publication} :</span> {action_publication}<br />"+
669
			"		<span class='{css_label}'>{i18n_collection_autre} :</span> {collection_autre}<br />"+
670
			"		<span class='{css_label}'>{i18n_action_future} :</span> {action_future} {action_future_info}<br />"+
420 jp_milcent 671
			"	</div>"+
672
			"	<div class='{css_fieldset}'>"+
673
			"		<h2>{i18n_titre_recherche_scientifique}</h2>"+
426 jp_milcent 674
			"		<span class='{css_label}'>{i18n_recherche} :</span> {recherche}<br />"+
675
			"			{recherche_info}"+
420 jp_milcent 676
			"	</div>"+
677
			"	<hr class='{css_clear}'/>"+
678
			"	<div class='{css_fieldset}'>"+
679
			"		<h2>{i18n_titre_acces_usage}</h2>"+
426 jp_milcent 680
			"		<span class='{css_label}'>{i18n_visite} :</span> {visite} {visite_info}<br />"+
681
			"		<span class='{css_label}'>{i18n_acces} :</span> {acces} {acces_info}<br />"+
420 jp_milcent 682
			"	</div>"+
683
			"</div>";
390 jp_milcent 684
	}
685
 
426 jp_milcent 686
	private void initialiserRechercheValorisationTpl() {
687
		rechercheValorisationTpl =
688
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
689
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
690
	}
691
 
1802 aurelien 692
	private void initialiserCollectionTpl() {
693
		collectionTpl =
694
			"<div class='{css_corps}'>"+
695
			"	<h2>{i18n_titre_collection} (<span class='{css_label} {css_indication_titre_petit}'>{i18n_indication_collection}</span>)</h2>"+
696
			"	{tableau_collection}"+
697
			"	<p> "+
698
			"		<a href=\"{guid_structure}\" class=\"{css_indication_titre_petit}\" target=\"_blank\">{i18n_indication_lien_collection}</a>"+
699
			"	</p>"+
700
			"</div>";
701
	}
702
 
703
	private void initialiserTableauCollectionTpl() {
704
		tableauCollectionTpl =
705
			"<table>"+
706
			"	<thead>"+
707
			"		<tr>" +
708
			"			<th class=\"{css_largeur_colonne_id}\">{i18n_id_collection}</th>" +
709
			"			<th>{i18n_nom_collection}</th>" +
710
			"			<th>{i18n_lien_collection}</th>" +
711
			"		</tr>"+
712
			"	</thead>"+
713
			"	<tbody>"+
714
			"		{lignes}"+
715
			"	</tbody>"+
716
			"</table>";
717
	}
718
 
719
	private void initialiserLigneCollectionTpl() {
720
		ligneCollectionTpl =
721
			"<tr>"+
722
			"	<td>{id_collection}</td>"+
723
			"	<td>{nom_collection}</td>"+
724
			"	<td><a href=\"{lien_collection}\" target=\"_blank\">{lien_collection}</a></td>"+
725
			"</tr>";
726
	}
727
 
814 jpm 728
	public void rafraichir(Object nouvellesDonnees) {
729
		if (nouvellesDonnees instanceof Structure) {
730
			structure = (Structure) nouvellesDonnees;
731
			structureChargementOk = true;
732
		} else if (nouvellesDonnees instanceof ValeurListe) {
733
			ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
816 jpm 734
			receptionerListeValeurs(listeValeursReceptionnee);
814 jpm 735
		} else if (nouvellesDonnees instanceof Information) {
736
			Information info = (Information) nouvellesDonnees;
379 jp_milcent 737
			if (info.getType().equals("liste_structure_a_personne")) {
738
				allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
814 jpm 739
				personnelChargementOk = true;
1802 aurelien 740
			} else if (info.getType().equals("liste_collection_a_structure")) {
741
				allouerCollectionAStructure((CollectionAStructureListe) info.getDonnee(0));
742
				collectionChargementOk = true;
1322 gduche 743
			} else if (info.getType().equals("ontologie_chargee")) {
744
				ontologieChargementOk = true;
379 jp_milcent 745
			}
373 jp_milcent 746
		} else {
1322 gduche 747
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
60 jpm 748
		}
814 jpm 749
		if (avoirDonneesChargees()) {
750
			afficherDetailInstitution();
751
		}
60 jpm 752
	}
814 jpm 753
 
1802 aurelien 754
	private void allouerCollectionAStructure(CollectionAStructureListe donnee) {
755
		collection = donnee;
756
	}
757
 
426 jp_milcent 758
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
759
		structure.setPersonnel(personnel);
760
	}
814 jpm 761
 
762
	private boolean avoirDonneesChargees() {
763
		boolean ok = false;
1764 aurelien 764
		if (structureChargementOk && personnelChargementOk && ontologieChargementOk) {
814 jpm 765
			ok = true;
420 jp_milcent 766
		}
814 jpm 767
		return ok;
420 jp_milcent 768
	}
1690 raphael 769
}