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