Subversion Repositories eFlore/Applications.coel

Rev

Go to most recent revision | Details | 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);
1284 gduche 207
		identificationParams.set("date_fondation", structure.getAnneOuDateFondationFormatLong());
1690 raphael 208
		identificationParams.set("nbre_personnel", structure.getNbrePersonne() != null ? structure.getNbrePersonne() : "");
390 jp_milcent 209
 
406 jp_milcent 210
		identificationParams.set("description", structure.getDescription());
1173 jpm 211
		identificationParams.set("acces", structure.getConditionAcces());
212
		identificationParams.set("usage", structure.getConditionUsage());
390 jp_milcent 213
 
406 jp_milcent 214
		identificationParams.set("adresse", structure.getAdresse());
215
		identificationParams.set("cp", structure.getCodePostal());
216
		identificationParams.set("ville", structure.getVille());
1373 cyprien 217
 
420 jp_milcent 218
		identificationParams.set("pays", pays);
1173 jpm 219
		identificationParams.set("latitude_longitude", latitudeLongitude);
390 jp_milcent 220
 
1284 gduche 221
		identificationParams.set("tel", structure.getTelephoneFixe());
222
		identificationParams.set("fax", structure.getFax());
1239 cyprien 223
 
406 jp_milcent 224
		identificationParams.set("courriel", structure.getCourriel());
420 jp_milcent 225
		identificationParams.set("web", web);
379 jp_milcent 226
 
406 jp_milcent 227
		afficherOnglet(identificationTpl, identificationParams, identificationOnglet);
373 jp_milcent 228
	}
229
 
379 jp_milcent 230
	private void afficherPersonnel() {
390 jp_milcent 231
		String tableauPersonnelHtml = "";
232
		if (personnel.size() > 0) {
233
			tableauPersonnelHtml = construireTableauDuPersonnel();
234
		}
235
 
420 jp_milcent 236
		Params personnelParams = new Params();
406 jp_milcent 237
		personnelParams.set("i18n_titre_personnel", i18nC.titrePersonnel());
238
		personnelParams.set("i18n_nbre_personnel_collection", i18nC.nbrePersonnelCollection());
239
		personnelParams.set("nbre_personnel_collection", personnel.size());
240
		personnelParams.set("tableau_personnel", tableauPersonnelHtml);
379 jp_milcent 241
 
406 jp_milcent 242
		afficherOnglet(personnelTpl, personnelParams, personnelOnglet);
390 jp_milcent 243
	}
244
 
245
	private String construireTableauDuPersonnel() {
246
		Params contenuParams = new Params();
406 jp_milcent 247
		contenuParams.set("i18n_titre_membre", i18nC.titreMembre());
248
		contenuParams.set("i18n_fonction", i18nC.fonction());
696 jp_milcent 249
		contenuParams.set("i18n_prenom", i18nC.personnePrenom());
250
		contenuParams.set("i18n_nom", i18nC.personneNom());
251
		contenuParams.set("i18n_tel", i18nC.FIX());
252
		contenuParams.set("i18n_fax", i18nC.FAX());
406 jp_milcent 253
		contenuParams.set("i18n_courriel", i18nC.courrielPrincipal());
254
		contenuParams.set("i18n_statut", i18nC.statut());
255
		contenuParams.set("i18n_tps_w", i18nC.tpsTravail());
256
		contenuParams.set("i18n_specialite", i18nC.specialite());
257
		contenuParams.set("i18n_contact", i18nC.boolContact());
390 jp_milcent 258
 
379 jp_milcent 259
		String lignesPersonnel = "";
602 jp_milcent 260
 
379 jp_milcent 261
		Iterator<String> it = personnel.keySet().iterator();
262
		while (it.hasNext()) {
263
			StructureAPersonne personne = personnel.get(it.next());
264
			Params ligneParams = new Params();
420 jp_milcent 265
 
266
			String fonction = construireTxtListeOntologie(personne.getFonction());
267
			String statut = construireTxtListeOntologie(personne.getStatut());
268
			String contact = formaterOuiNon(personne.getContact());
269
 
270
			ligneParams.set("fonction", fonction);
379 jp_milcent 271
			ligneParams.set("prenom", personne.getPrenom());
272
			ligneParams.set("nom", personne.getNom());
602 jp_milcent 273
			ligneParams.set("tel_fix", personne.getTelephoneFixe());
274
			ligneParams.set("tel_fax", personne.getFax());
379 jp_milcent 275
			ligneParams.set("courriel", personne.getCourriel());
420 jp_milcent 276
			ligneParams.set("statut", statut);
379 jp_milcent 277
			ligneParams.set("tps_w", personne.getBotaTravailHebdoTps());
278
			ligneParams.set("specialite", personne.afficherSpecialite());
420 jp_milcent 279
			ligneParams.set("contact", contact);
379 jp_milcent 280
			lignesPersonnel += Format.substitute(lignePersonnelTpl, ligneParams);
281
		}
282
		contenuParams.set("lignes", lignesPersonnel);
283
 
390 jp_milcent 284
		String cHtml = Format.substitute(tableauPersonnelTpl, contenuParams);
285
		return cHtml;
379 jp_milcent 286
	}
406 jp_milcent 287
 
288
	private void afficherConservation() {
420 jp_milcent 289
		Params conservationParams  = new Params();
406 jp_milcent 290
		conservationParams.set("i18n_titre_conservation_personnel", i18nC.titreConservationPersonnel());
291
		conservationParams.set("i18n_formation", i18nC.formation());
292
		conservationParams.set("i18n_formation_interet", i18nC.formationInteret());
293
 
294
		conservationParams.set("i18n_titre_local", i18nC.titreLocal());
295
		conservationParams.set("i18n_local_specifique", i18nC.localSpecifique());
296
		conservationParams.set("i18n_meuble_specifique", i18nC.meubleSpecifique());
297
		conservationParams.set("i18n_local_parametre", i18nC.localParametre());
420 jp_milcent 298
		conservationParams.set("i18n_conservation_en_commun", i18nC.conservationEnCommun());
299
		conservationParams.set("i18n_acces_controle", i18nC.accesControle());
406 jp_milcent 300
 
420 jp_milcent 301
		conservationParams.set("i18n_titre_operation", i18nC.titreOperation());
302
		conservationParams.set("i18n_restauration", i18nC.restauration());
303
		conservationParams.set("i18n_materiel_conservation", i18nC.materielConservation());
304
		conservationParams.set("i18n_traitement", i18nC.traitement());
305
 
306
		conservationParams.set("i18n_titre_acquisition", i18nC.titreAcquisition());
307
		conservationParams.set("i18n_acquisition_collection", i18nC.acquisitionCollection());
308
		conservationParams.set("i18n_acquisition_echantillon", i18nC.acquisitionEchantillon());
309
 
406 jp_milcent 310
		conservationParams.set("formation", formaterOuiNon(conservation.getFormation()));
311
		conservationParams.set("formation_info", formaterSautDeLigne(conservation.getFormationInfo()));
312
		conservationParams.set("formation_interet", formaterOuiNon(conservation.getFormationInteret()));
313
		conservationParams.set("meuble_specifique", conservation.getStockageMeuble());
314
 
420 jp_milcent 315
		String chaineAAnalyser = conservation.getStockageLocal();
316
		String chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
317
		conservationParams.set("local_specifique", chaineAAfficher);
406 jp_milcent 318
 
420 jp_milcent 319
		chaineAAnalyser = conservation.getStockageMeuble();
320
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
321
		conservationParams.set("meuble_specifique", chaineAAfficher);
322
 
323
		chaineAAnalyser = conservation.getStockageParametre();
324
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
325
		conservationParams.set("local_parametre", chaineAAfficher);
326
 
327
		conservationParams.set("conservation_en_commun", formaterOuiNon(conservation.getCollectionCommune()));
328
		chaineAAnalyser = conservation.getCollectionAutre();
329
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
330
		conservationParams.set("collection_autre", formaterParenthese(chaineAAfficher));
331
 
332
		conservationParams.set("acces_controle", formaterOuiNon(conservation.getAccesControle()));
333
 
334
		conservationParams.set("restauration", formaterOuiNon(conservation.getRestauration()));
335
		chaineAAnalyser = conservation.getRestaurationOperation();
336
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
337
		conservationParams.set("restauration_operation", formaterParenthese(chaineAAfficher));
338
 
339
		chaineAAnalyser = conservation.getMaterielConservation();
340
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
341
		conservationParams.set("materiel_conservation", chaineAAfficher);
342
		chaineAAnalyser = conservation.getMaterielAutre();
343
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
344
		conservationParams.set("materiel_autre", formaterParenthese(chaineAAfficher));
345
 
346
		conservationParams.set("traitement", formaterOuiNon(conservation.getTraitement()));
347
		chaineAAnalyser = conservation.getTraitements();
348
		chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
349
		conservationParams.set("traitements", formaterParenthese(chaineAAfficher));
350
 
351
		conservationParams.set("acquisition_collection", formaterOuiNon(conservation.getAcquisitionCollection()));
352
		conservationParams.set("acquisition_echantillon", formaterOuiNon(conservation.getAcquisitionEchantillon()));
353
		conservationParams.set("acquisition_traitement_info", construireTraitement());
354
 
406 jp_milcent 355
		afficherOnglet(conservationTpl, conservationParams, conservationOnglet);
356
	}
357
 
420 jp_milcent 358
	private String construireTraitement() {
359
		String cHtml = "";
1695 raphael 360
		Integer echantillon = conservation.getAcquisitionEchantillon();
420 jp_milcent 361
 
1695 raphael 362
		if (echantillon != null && echantillon.intValue() == 1) {
420 jp_milcent 363
			Params traitementConservationParams  = new Params();
364
			traitementConservationParams.set("i18n_acquisition_traitement", i18nC.acquisitionTraitement());
365
 
366
			traitementConservationParams.set("acquisition_traitement", formaterOuiNon(conservation.getAcquisitionTraitement()));
367
 
368
			traitementConservationParams.set("acquisition_traitement_type_info", construireTraitementType());
369
 
370
			cHtml = Format.substitute(traitementConservationTpl, traitementConservationParams);
371
		}
372
 
373
		return cHtml;
374
	}
375
 
376
	private String construireTraitementType() {
377
		String cHtml = "";
378
		String traitement = conservation.getAcquisitionTraitement();
379
 
380
		if (traitement.equals("1")) {
381
			Params typeTraitementParams  = new Params();
382
			typeTraitementParams.set("i18n_acquisition_traitement_insecte", i18nC.acquisitionTraitementInsecte());
383
			typeTraitementParams.set("i18n_acquisition_traitement_poison", i18nC.acquisitionTraitementPoison());
384
 
385
			String acquisitionTraitementInsecte = construireTxtListeOntologie(conservation.getAcquisitionTraitementInsecte());
386
			typeTraitementParams.set("acquisition_traitement_insecte", acquisitionTraitementInsecte);
387
			String acquisitionTraitementPoison = construireTxtListeOntologie(conservation.getAcquisitionTraitementPoison());
388
			typeTraitementParams.set("acquisition_traitement_poison", acquisitionTraitementPoison);
389
 
390
			cHtml = Format.substitute(typeTraitementConservationTpl, typeTraitementParams);
391
		}
392
 
393
		return cHtml;
394
	}
395
 
426 jp_milcent 396
	private void afficherValorisation() {
397
		Params valorisationParams  = new Params();
398
		valorisationParams.set("i18n_titre_action_valorisation", i18nC.titreActionValorisation());
399
		valorisationParams.set("i18n_action", i18nC.action());
400
		valorisationParams.set("i18n_action_publication", i18nC.actionPublication());
401
		valorisationParams.set("i18n_collection_autre", i18nC.collectionAutre());
402
		valorisationParams.set("i18n_action_future", i18nC.actionFuture());
403
 
404
		valorisationParams.set("action", formaterOuiNon(valorisation.getAction()));
405
		String actionInfo = construireTxtListeOntologie(valorisation.getActionInfo());
406
		valorisationParams.set("action_info", formaterParenthese(actionInfo));
407
		valorisationParams.set("action_publication", valorisation.getPublication());
408
		String collectionAutre = construireTxtListeOntologie(valorisation.getCollectionAutre());
409
		valorisationParams.set("collection_autre", collectionAutre);
410
		valorisationParams.set("action_future", formaterOuiNon(valorisation.getActionFuture()));
411
		valorisationParams.set("action_future_info", formaterParenthese(valorisation.getActionFutureInfo()));
412
 
413
		valorisationParams.set("i18n_titre_recherche_scientifique", i18nC.titreRechercherScientifique());
414
		valorisationParams.set("i18n_recherche", i18nC.recherche());
415
 
416
		valorisationParams.set("recherche", formaterOuiNon(valorisation.getRecherche()));
417
		valorisationParams.set("recherche_info", construireRecherche());
418
 
419
		valorisationParams.set("i18n_titre_acces_usage", i18nC.titreAccesUsage());
420
		valorisationParams.set("i18n_acces", i18nC.acces());
421
		valorisationParams.set("i18n_visite", i18nC.visite());
422
 
423
		valorisationParams.set("acces", formaterOuiNon(valorisation.getAccesSansMotif()));
424
		valorisationParams.set("acces_info", formaterParenthese(valorisation.getAccesSansMotifInfo()));
425
		valorisationParams.set("visite", formaterOuiNon(valorisation.getVisiteAvecMotif()));
426
		valorisationParams.set("visite_info", formaterParenthese(valorisation.getVisiteAvecMotifInfo()));
427
 
428
		afficherOnglet(valorisationTpl, valorisationParams, valorisationOnglet);
406 jp_milcent 429
	}
430
 
426 jp_milcent 431
	private String construireRecherche() {
432
		String cHtml = "";
1733 raphael 433
		Integer recherche = valorisation.getRecherche();
426 jp_milcent 434
 
1733 raphael 435
		if (recherche != null && recherche.intValue() == 1) {
426 jp_milcent 436
			Params rechercheParams  = new Params();
437
			rechercheParams.set("i18n_recherche_provenance", i18nC.rechercheProvenance());
438
			rechercheParams.set("i18n_recherche_type", i18nC.rechercheType());
439
 
440
			String rechercheProvenance = construireTxtListeOntologie(valorisation.getRechercheProvenance());
441
			rechercheParams.set("recherche_provenance", rechercheProvenance);
442
			String rechercheType = construireTxtListeOntologie(valorisation.getRechercheType());
443
			rechercheParams.set("recherche_type", rechercheType);
444
 
445
			cHtml = Format.substitute(rechercheValorisationTpl, rechercheParams);
420 jp_milcent 446
		}
426 jp_milcent 447
 
448
		return cHtml;
420 jp_milcent 449
	}
450
 
1802 aurelien 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;
501
	}
502
 
379 jp_milcent 503
	private void initialiserTousLesTpl() {
814 jpm 504
		initialiserEnteteTpl();
379 jp_milcent 505
		initialiserIdentificationTpl();
506
		initialiserPersonnelTpl();
390 jp_milcent 507
		initialiserTableauPersonnelTpl();
379 jp_milcent 508
		initialiserLignePersonnelTpl();
390 jp_milcent 509
		initialiserConservationTpl();
420 jp_milcent 510
		initialiserTraitementConservationTpl();
511
		initialiserTypeTraitementConservationTpl();
390 jp_milcent 512
		initialiserValorisationTpl();
426 jp_milcent 513
		initialiserRechercheValorisationTpl();
1802 aurelien 514
		initialiserCollectionTpl();
515
		initialiserTableauCollectionTpl();
516
		initialiserLigneCollectionTpl();
379 jp_milcent 517
	}
518
 
814 jpm 519
	private void initialiserEnteteTpl() {
420 jp_milcent 520
		enteteTpl =
521
			"<div id='{css_id}'>"+
522
			"	<h1>{nom}</h1>"+
1764 aurelien 523
			"	<h2>{ville}<span class='{css_meta}'> <br /> {i18n_id}:{id} - {guid}</span></h2>" +
420 jp_milcent 524
			"	" +
525
			"</div>";
373 jp_milcent 526
	}
527
 
379 jp_milcent 528
	private void initialiserIdentificationTpl() {
529
		identificationTpl =
420 jp_milcent 530
			"<div class='{css_corps}'>"+
531
			"	<div class='{css_fieldset}'>"+
532
			"		<h2>{i18n_titre_administratif}</h2>"+
533
			"		<span class='{css_label}'>{i18n_acronyme} :</span> {acronyme}<br />"+
534
			"		<span class='{css_label}'>{i18n_statut} :</span> {statut}<br />"+
535
			"		<span class='{css_label}'>{i18n_date_fondation} :</span> {date_fondation}<br />"+
536
			"		<span class='{css_label}'>{i18n_nbre_personnel} :</span> {nbre_personnel}<br />"+
537
			"	</div>"+
538
			"	<div class='{css_fieldset}'>"+
539
			"		<h2>{i18n_titre_description}</h2>"+
1173 jpm 540
			"		<span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
541
			"		<span class='{css_label}'>{i18n_acces} :</span> {acces}<br />"+
542
			"		<span class='{css_label}'>{i18n_usage} :</span> {usage}<br />"+
420 jp_milcent 543
			"	</div>"+
544
			"	<hr class='{css_clear}'/>"+
545
			"	<div class='{css_fieldset}'>"+
546
			"		<h2>{i18n_titre_adresse}</h2>"+
547
			"		<span class='{css_label}'>{i18n_adresse} :</span> {adresse}<br />" +
548
			"		<span class='{css_label}'>{i18n_cp} :</span> {cp}<br />" +
549
			"		<span class='{css_label}'>{i18n_ville} :</span> {ville}<br />" +
550
			"		<span class='{css_label}'>{i18n_pays} :</span> {pays}<br />" +
1173 jpm 551
			"		<span class='{css_label}'>{i18n_latitude} / {i18n_longitude} :</span> {latitude_longitude}<br />" +
420 jp_milcent 552
			"	</div>"+
553
			"	<div class='{css_fieldset}'>"+
554
			"		<h2>{i18n_titre_communication}</h2>"+
555
			"		<span class='{css_label}'>{i18n_tel} :</span> {tel}<br />"+
556
			"		<span class='{css_label}'>{i18n_fax} :</span> {fax}<br />"+
557
			"		<span class='{css_label}'>{i18n_courriel} :</span> {courriel}<br />"+
558
			"		<span class='{css_label}'>{i18n_web} :</span> {web}<br />"+
559
			"	</div>"+
560
			"</div>";
373 jp_milcent 561
	}
562
 
379 jp_milcent 563
	private void initialiserPersonnelTpl() {
564
		personnelTpl =
420 jp_milcent 565
			"<div class='{css_corps}'>"+
566
			"	<h2>{i18n_titre_personnel}</h2>"+
567
			"	<p><span class='{css_label}'>{i18n_nbre_personnel_collection} :</span> {nbre_personnel_collection}</p>"+
568
			"	{tableau_personnel}"+
569
			"</div>";
379 jp_milcent 570
	}
571
 
390 jp_milcent 572
	private void initialiserTableauPersonnelTpl() {
573
		tableauPersonnelTpl =
420 jp_milcent 574
			"<h3>{i18n_titre_membre}</h3>"+
575
			"<table>"+
576
			"	<thead>"+
577
			"		<tr>" +
578
			"			<th>{i18n_fonction}</th>" +
579
			"			<th>{i18n_prenom}</th>" +
580
			"			<th>{i18n_nom}</th>" +
581
			"			<th>{i18n_tel}</th>" +
582
			"			<th>{i18n_fax}</th>" +
583
			"			<th>{i18n_courriel}</th>" +
584
			"			<th>{i18n_statut}</th>" +
585
			"			<th>{i18n_tps_w}</th>" +
586
			"			<th>{i18n_specialite}</th>" +
587
			"			<th>{i18n_contact}</th>" +
588
			"		</tr>"+
589
			"	</thead>"+
590
			"	<tbody>"+
591
			"		{lignes}"+
592
			"	</tbody>"+
593
			"</table>";
390 jp_milcent 594
	}
595
 
379 jp_milcent 596
	private void initialiserLignePersonnelTpl() {
597
		lignePersonnelTpl =
420 jp_milcent 598
			"<tr>"+
599
			"	<td>{fonction}</td>"+
600
			"	<td>{prenom}</td>"+
601
			"	<td>{nom}</td>"+
602 jp_milcent 602
			"	<td>{tel_fix}</td>" +
603
			"	<td>{tel_fax}</td>" +
420 jp_milcent 604
			"	<td>{courriel}</td>" +
605
			"	<td>{statut}</td>" +
606
			"	<td>{tps_w}</td>" +
607
			"	<td>{specialite}</td>" +
608
			"	<td>{contact}</td>" +
609
			"</tr>";
379 jp_milcent 610
	}
611
 
390 jp_milcent 612
	private void initialiserConservationTpl() {
613
		conservationTpl =
420 jp_milcent 614
			"<div class='{css_corps}'>"+
615
			"	<div class='{css_fieldset}'>"+
616
			"		<h2>{i18n_titre_conservation_personnel}</h2>"+
617
			"		<span class='{css_label}'>{i18n_formation} :</span> {formation}<br />"+
618
			"		{formation_info}<br />"+
619
			"		<span class='{css_label}'>{i18n_formation_interet} :</span> {formation_interet}<br />"+
620
			"	</div>"+
621
			"	<div class='{css_fieldset}'>"+
622
			"		<h2>{i18n_titre_local}</h2>"+
623
			"		<span class='{css_label}'>{i18n_local_specifique} :</span> {local_specifique}<br />"+
624
			"		<span class='{css_label}'>{i18n_meuble_specifique} :</span> {meuble_specifique}<br />"+
625
			"		<span class='{css_label}'>{i18n_local_parametre} :</span> {local_parametre}<br />"+
626
			"		<span class='{css_label}'>{i18n_conservation_en_commun} :</span> {conservation_en_commun} {collection_autre}<br />"+
627
			"		<span class='{css_label}'>{i18n_acces_controle} :</span> {acces_controle}<br />"+
628
			"	</div>"+
1802 aurelien 629
			"	<hr class='{css_clear}'Window/>"+
420 jp_milcent 630
			"	<div class='{css_fieldset}'>"+
631
			"		<h2>{i18n_titre_operation}</h2>"+
632
			"		<span class='{css_label}'>{i18n_restauration} :</span> {restauration} {restauration_operation}<br />"+
633
			"		<span class='{css_label}'>{i18n_materiel_conservation} :</span> {materiel_conservation} {materiel_autre}<br />"+
634
			"		<span class='{css_label}'>{i18n_traitement} :</span> {traitement} {traitements}<br />"+
635
			"	</div>"+
636
			"	<div class='{css_fieldset}'>"+
637
			"		<h2>{i18n_titre_acquisition}</h2>"+
638
			"		<span class='{css_label}'>{i18n_acquisition_collection} :</span> {acquisition_collection}<br />"+
639
			"		<span class='{css_label}'>{i18n_acquisition_echantillon} :</span> {acquisition_echantillon}<br />"+
640
			"			{acquisition_traitement_info}" +
641
			"	</div>"+
642
			"</div>";
390 jp_milcent 643
	}
644
 
420 jp_milcent 645
	private void initialiserTraitementConservationTpl() {
646
		traitementConservationTpl =
426 jp_milcent 647
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement} :</span> {acquisition_traitement}<br />"+
648
			"	<div class='{css_indentation}'>"+
649
			"		{acquisition_traitement_type_info}"+
650
			"	</div>";
420 jp_milcent 651
	}
652
 
653
	private void initialiserTypeTraitementConservationTpl() {
654
		typeTraitementConservationTpl =
655
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_insecte} :</span> {acquisition_traitement_insecte}<br />"+
656
			"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_poison} :</span> {acquisition_traitement_poison}<br />";
657
	}
658
 
390 jp_milcent 659
	private void initialiserValorisationTpl() {
660
		valorisationTpl =
420 jp_milcent 661
			"<div class='{css_corps}'>"+
662
			"	<div class='{css_fieldset}'>"+
663
			"		<h2>{i18n_titre_action_valorisation}</h2>"+
426 jp_milcent 664
			"		<span class='{css_label}'>{i18n_action} :</span> {action} {action_info}<br />"+
665
			"		<span class='{css_label}'>{i18n_action_publication} :</span> {action_publication}<br />"+
666
			"		<span class='{css_label}'>{i18n_collection_autre} :</span> {collection_autre}<br />"+
667
			"		<span class='{css_label}'>{i18n_action_future} :</span> {action_future} {action_future_info}<br />"+
420 jp_milcent 668
			"	</div>"+
669
			"	<div class='{css_fieldset}'>"+
670
			"		<h2>{i18n_titre_recherche_scientifique}</h2>"+
426 jp_milcent 671
			"		<span class='{css_label}'>{i18n_recherche} :</span> {recherche}<br />"+
672
			"			{recherche_info}"+
420 jp_milcent 673
			"	</div>"+
674
			"	<hr class='{css_clear}'/>"+
675
			"	<div class='{css_fieldset}'>"+
676
			"		<h2>{i18n_titre_acces_usage}</h2>"+
426 jp_milcent 677
			"		<span class='{css_label}'>{i18n_visite} :</span> {visite} {visite_info}<br />"+
678
			"		<span class='{css_label}'>{i18n_acces} :</span> {acces} {acces_info}<br />"+
420 jp_milcent 679
			"	</div>"+
680
			"</div>";
390 jp_milcent 681
	}
682
 
426 jp_milcent 683
	private void initialiserRechercheValorisationTpl() {
684
		rechercheValorisationTpl =
685
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
686
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
687
	}
688
 
1802 aurelien 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
	}
724
 
814 jpm 725
	public void rafraichir(Object nouvellesDonnees) {
726
		if (nouvellesDonnees instanceof Structure) {
727
			structure = (Structure) nouvellesDonnees;
728
			structureChargementOk = true;
729
		} else if (nouvellesDonnees instanceof ValeurListe) {
730
			ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
816 jpm 731
			receptionerListeValeurs(listeValeursReceptionnee);
814 jpm 732
		} else if (nouvellesDonnees instanceof Information) {
733
			Information info = (Information) nouvellesDonnees;
379 jp_milcent 734
			if (info.getType().equals("liste_structure_a_personne")) {
735
				allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
814 jpm 736
				personnelChargementOk = true;
1802 aurelien 737
			} else if (info.getType().equals("liste_collection_a_structure")) {
738
				allouerCollectionAStructure((CollectionAStructureListe) info.getDonnee(0));
739
				collectionChargementOk = true;
1322 gduche 740
			} else if (info.getType().equals("ontologie_chargee")) {
741
				ontologieChargementOk = true;
379 jp_milcent 742
			}
373 jp_milcent 743
		} else {
1322 gduche 744
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
60 jpm 745
		}
814 jpm 746
		if (avoirDonneesChargees()) {
747
			afficherDetailInstitution();
748
		}
60 jpm 749
	}
814 jpm 750
 
1802 aurelien 751
	private void allouerCollectionAStructure(CollectionAStructureListe donnee) {
752
		collection = donnee;
753
	}
754
 
426 jp_milcent 755
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
756
		structure.setPersonnel(personnel);
757
	}
814 jpm 758
 
759
	private boolean avoirDonneesChargees() {
760
		boolean ok = false;
1764 aurelien 761
		if (structureChargementOk && personnelChargementOk && ontologieChargementOk) {
814 jpm 762
			ok = true;
420 jp_milcent 763
		}
814 jpm 764
		return ok;
420 jp_milcent 765
	}
1690 raphael 766
}