Subversion Repositories eFlore/Applications.coel

Rev

Rev 950 | Rev 966 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
934 jpm 1
package org.tela_botanica.client.vues.collection;
453 jp_milcent 2
 
961 jpm 3
import java.util.HashMap;
883 jpm 4
import java.util.Iterator;
5
 
453 jp_milcent 6
import org.tela_botanica.client.ComposantClass;
7
import org.tela_botanica.client.ComposantId;
8
import org.tela_botanica.client.Mediateur;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
883 jpm 10
import org.tela_botanica.client.modeles.Information;
453 jp_milcent 11
import org.tela_botanica.client.modeles.ValeurListe;
935 jpm 12
import org.tela_botanica.client.modeles.collection.Collection;
13
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
14
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
15
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
16
import org.tela_botanica.client.modeles.collection.CollectionAPublicationListe;
961 jpm 17
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
18
import org.tela_botanica.client.modeles.collection.UniteBase;
19
import org.tela_botanica.client.modeles.collection.UniteRangement;
935 jpm 20
import org.tela_botanica.client.modeles.personne.Personne;
21
import org.tela_botanica.client.modeles.projet.ProjetListe;
22
import org.tela_botanica.client.modeles.publication.Publication;
23
import org.tela_botanica.client.modeles.structure.Structure;
938 jpm 24
import org.tela_botanica.client.util.Debug;
961 jpm 25
import org.tela_botanica.client.util.UtilNombre;
26
import org.tela_botanica.client.util.UtilString;
936 jpm 27
import org.tela_botanica.client.vues.DetailVue;
453 jp_milcent 28
 
29
import com.extjs.gxt.ui.client.Style.Scroll;
30
import com.extjs.gxt.ui.client.util.Format;
31
import com.extjs.gxt.ui.client.util.Params;
32
import com.extjs.gxt.ui.client.widget.ContentPanel;
33
import com.extjs.gxt.ui.client.widget.Html;
34
import com.extjs.gxt.ui.client.widget.TabItem;
35
import com.extjs.gxt.ui.client.widget.TabPanel;
36
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
938 jpm 37
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
453 jp_milcent 38
 
39
public class CollectionDetailVue extends DetailVue implements Rafraichissable {
40
 
883 jpm 41
	private Collection collection = null;
42
	private boolean collectionChargementOk = false;
43
	private boolean personnesLieesChargementOk = false;
44
	private boolean publicationsLieesChargementOk = false;
468 jp_milcent 45
	private Structure structure = null;
883 jpm 46
 
453 jp_milcent 47
	private String enteteTpl = null;
48
	private String generalTpl = null;
883 jpm 49
	private String personneTpl = null;
50
	private String tableauPersonnesLieesTpl = null;
51
	private String lignePersonneLieeTpl = null;
687 jp_milcent 52
	private String publicationTpl = null;
883 jpm 53
	private String tableauPublicationsLieesTpl = null;
54
	private String lignePublicationLieeTpl = null;
630 jp_milcent 55
	private String descriptionTpl = null;
56
	private String contenuTpl = null;
57
	private String inventaireTpl = null;
453 jp_milcent 58
 
59
	private ContentPanel panneauPrincipal = null;
60
	private Html entete = null;
61
	private TabPanel onglets = null;
62
	private TabItem generalOnglet = null;
862 jpm 63
	private TabItem personneOnglet = null;
687 jp_milcent 64
	private TabItem publicationOnglet = null;
630 jp_milcent 65
	private TabItem descriptionOnglet = null;
66
	private TabItem contenuOnglet = null;
67
	private TabItem inventaireOnglet = null;
961 jpm 68
	private String tableauUniteRangementTpl;
69
	private String ligneUniteRangementTpl;
70
	private String tableauUniteBaseTpl;
71
	private String ligneUniteBaseTpl;
883 jpm 72
 
453 jp_milcent 73
 
74
	public CollectionDetailVue(Mediateur mediateurCourant) {
75
		super(mediateurCourant);
76
		initialiserTousLesTpl();
77
		chargerOntologie();
78
 
79
		panneauPrincipal = new ContentPanel();
938 jpm 80
		panneauPrincipal.setLayout(new FitLayout());
453 jp_milcent 81
		panneauPrincipal.setHeaderVisible(false);
82
		panneauPrincipal.setBodyBorder(false);
83
 
84
	    entete = new Html();
85
	    entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
86
	    panneauPrincipal.setTopComponent(entete);
87
 
88
		onglets = new TabPanel();
89
		onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
90
		onglets.setBodyBorder(false);
91
 
92
		generalOnglet = new TabItem(i18nC.structureInfoGeneral());
93
		generalOnglet.setLayout(new AnchorLayout());
94
		generalOnglet.setScrollMode(Scroll.AUTO);
95
		onglets.add(generalOnglet);
96
 
862 jpm 97
		personneOnglet = new TabItem(i18nC.collectionPersonne());
98
		personneOnglet.setLayout(new AnchorLayout());
99
		personneOnglet.setScrollMode(Scroll.AUTO);
100
		onglets.add(personneOnglet);
630 jp_milcent 101
 
687 jp_milcent 102
		publicationOnglet = new TabItem(i18nC.collectionPublication());
103
		publicationOnglet.setLayout(new AnchorLayout());
104
		publicationOnglet.setScrollMode(Scroll.AUTO);
105
		onglets.add(publicationOnglet);
106
 
630 jp_milcent 107
		descriptionOnglet = new TabItem(i18nC.collectionDescription());
108
		descriptionOnglet.setLayout(new AnchorLayout());
109
		descriptionOnglet.setScrollMode(Scroll.AUTO);
110
		onglets.add(descriptionOnglet);
111
 
112
		contenuOnglet = new TabItem(i18nC.collectionContenu());
113
		contenuOnglet.setLayout(new AnchorLayout());
114
		contenuOnglet.setScrollMode(Scroll.AUTO);
115
		onglets.add(contenuOnglet);
862 jpm 116
 
630 jp_milcent 117
		inventaireOnglet = new TabItem(i18nC.collectionInventaire());
118
		inventaireOnglet.setLayout(new AnchorLayout());
119
		inventaireOnglet.setScrollMode(Scroll.AUTO);
120
		onglets.add(inventaireOnglet);
121
 
453 jp_milcent 122
		panneauPrincipal.add(onglets);
123
		add(panneauPrincipal);
124
	}
125
 
126
	private void initialiserTousLesTpl() {
127
		initialiserEnteteHtmlTpl();
128
		initialiserGeneralTpl();
883 jpm 129
		initialiserPersonneTpl();
130
		initialiserTableauPersonnesLieesTpl();
131
		initialiserLignePersonneLieeTpl();
687 jp_milcent 132
		initialiserPublicationTpl();
883 jpm 133
		initialiserTableauPublicationsLieesTpl();
134
		initialiserLignePublicationLieeTpl();
630 jp_milcent 135
		initialiserContenuTpl();
136
		initialiserDescriptionTpl();
961 jpm 137
		initialiserTableauUniteRangementTpl();
138
		initialiserLigneUniteRangementTpl();
139
		initialiserTableauUniteBaseTpl();
140
		initialiserLigneUniteBaseTpl();
630 jp_milcent 141
		initialiserInventaireTpl();
453 jp_milcent 142
	}
143
 
144
	private void initialiserEnteteHtmlTpl() {
145
		enteteTpl =
146
			"<div id='{css_id}'>"+
147
			"	<h1>{nom}</h1>"+
813 jpm 148
			"	<h2>{structure}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
453 jp_milcent 149
			"</div>";
150
	}
151
 
152
	private void initialiserGeneralTpl() {
153
		generalTpl =
154
			"<div class='{css_corps}'>"+
155
			"	<div class='{css_fieldset}'>"+
156
			"		<h2>{i18n_titre_identification}</h2>"+
630 jp_milcent 157
			"		<span class='{css_label}'>{i18n_nom_alternatif} :</span> {nom_alternatif}<br />"+
158
			"		<span class='{css_label}'>{i18n_mere} :</span> {mere}<br />"+
687 jp_milcent 159
			"		<span class='{css_label}'>{i18n_type_ncd} :</span> {type_ncd}<br />"+
160
			"		<span class='{css_label}'>{i18n_type_depot} :</span> {type_depot}<br />"+
961 jpm 161
			"		<span class='{css_label}'>{i18n_id_alternatif} :</span> {id_alternatif}<br />"+
162
			"		<span class='{css_label}'>{i18n_code} :</span> {code}<br />"+
163
			"		<span class='{css_label}'>{i18n_cote} :</span> {cote}<br />"+
453 jp_milcent 164
			"	</div>"+
477 jp_milcent 165
			"	<div class='{css_fieldset}'>"+
630 jp_milcent 166
			"		<h2>{i18n_general_collection_titre}</h2>"+
477 jp_milcent 167
			"		<span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
168
			"		<span class='{css_label}'>{i18n_description_specialiste} :</span> {description_specialiste}<br />"+
630 jp_milcent 169
			"		<span class='{css_label}'>{i18n_historique} :</span> {historique}<br />"+
170
			"		<span class='{css_label}'>{i18n_web} :</span> {web}<br />"+
961 jpm 171
			"	</div>"+
172
			"	<hr class='{css_clear}'/>"+
173
			"	<div class='{css_fieldset}'>"+
174
			"		<h2>{i18n_couverture_collection_titre}</h2>"+
630 jp_milcent 175
			"		<span class='{css_label}'>{i18n_groupement_principe} :</span> {groupement_principe}<br />"+
176
			"		<span class='{css_label}'>{i18n_groupement_but} :</span> {groupement_but}<br />"+
961 jpm 177
			"		<span class='{css_label}'>{i18n_couverture_geo} :</span> {couverture_geo}<br />"+
477 jp_milcent 178
			"	</div>"+
961 jpm 179
			"	<div class='{css_fieldset}'>"+
180
			"		<h2>{i18n_specimen_type_titre}</h2>"+
181
			"		<span class='{css_label}'>{i18n_specimen_type_presence} :</span> {specimen_type_presence}<br />"+
182
			"		<span class='{css_label}'>{i18n_specimen_type_nombre} :</span> {specimen_type_nombre}<br />"+
183
			"		<span class='{css_label}'>{i18n_specimen_type_classement} :</span> {specimen_type_classement}<br />"+
184
			"	</div>"+
477 jp_milcent 185
			"	<hr class='{css_clear}'/>"+
453 jp_milcent 186
			"</div>";
187
	}
188
 
883 jpm 189
	private void initialiserPersonneTpl() {
190
		personneTpl =
630 jp_milcent 191
			"<div class='{css_corps}'>"+
961 jpm 192
			"	<h2>{i18n_titre_personne}</h2>"+
193
			"	{tableau_personnes_liees}"+
630 jp_milcent 194
			"</div>";
195
	}
196
 
883 jpm 197
 
198
	private void initialiserTableauPersonnesLieesTpl() {
199
		tableauPersonnesLieesTpl =
200
			"<table>"+
201
			"	<thead>"+
202
			"		<tr>" +
961 jpm 203
			"			<th>{i18n_relation}</th>" +
204
			"			<th>{i18n_nom_complet}</th>" +
205
			"			<th>{i18n_nom}</th>" +
883 jpm 206
			"			<th>{i18n_prenom}</th>" +
961 jpm 207
			"			<th>{i18n_naissance_date}</th>" +
208
			"			<th>{i18n_naissance_lieu}</th>" +
209
			"			<th>{i18n_etre_decede}</th>" +
210
			"			<th>{i18n_deces_date}</th>" +
211
			"			<th>{i18n_deces_lieu}</th>" +
883 jpm 212
			"		</tr>"+
213
			"	</thead>"+
214
			"	<tbody>"+
215
			"		{lignes}"+
216
			"	</tbody>"+
217
			"</table>";
218
	}
219
 
220
	private void initialiserLignePersonneLieeTpl() {
221
		lignePersonneLieeTpl =
222
			"<tr>"+
961 jpm 223
			"	<td>{relation}</td>"+
224
			"	<td>{nom_complet}</td>"+
225
			"	<td>{nom}</td>"+
883 jpm 226
			"	<td>{prenom}</td>"+
961 jpm 227
			"	<td>{naissance_date}</td>"+
228
			"	<td>{naissance_lieu}</td>"+
229
			"	<td>{etre_decede}</td>"+
230
			"	<td>{deces_date}</td>"+
231
			"	<td>{deces_lieu}</td>"+
883 jpm 232
			"</tr>";
233
	}
234
 
687 jp_milcent 235
	private void initialiserPublicationTpl() {
236
		publicationTpl =
237
			"<div class='{css_corps}'>"+
961 jpm 238
			"	<h2>{i18n_titre_publication}</h2>"+
239
			"	{tableau_publications_liees}"+
687 jp_milcent 240
			"</div>";
241
	}
242
 
883 jpm 243
	private void initialiserTableauPublicationsLieesTpl() {
244
		tableauPublicationsLieesTpl =
245
			"<table>"+
246
			"	<thead>"+
247
			"		<tr>" +
248
			"			<th>{i18n_auteur}</th>" +
249
			"			<th>{i18n_titre}</th>" +
961 jpm 250
			"			<th>{i18n_revue}</th>" +
251
			"			<th>{i18n_editeur}</th>" +
252
			"			<th>{i18n_annee}</th>" +
253
			"			<th>{i18n_nvt}</th>" +
254
			"			<th>{i18n_fascicule}</th>" +
255
			"			<th>{i18n_page}</th>" +
883 jpm 256
			"		</tr>"+
257
			"	</thead>"+
258
			"	<tbody>"+
259
			"		{lignes}"+
260
			"	</tbody>"+
261
			"</table>";
262
	}
263
 
264
	private void initialiserLignePublicationLieeTpl() {
265
		lignePublicationLieeTpl =
266
			"<tr>"+
267
			"	<td>{auteur}</td>"+
268
			"	<td>{titre}</td>"+
961 jpm 269
			"	<td>{revue}</td>"+
270
			"	<td>{editeur}</td>"+
271
			"	<td>{annee}</td>"+
272
			"	<td>{nvt}</td>"+
273
			"	<td>{fascicule}</td>"+
274
			"	<td>{page}</td>"+
883 jpm 275
			"</tr>";
276
	}
277
 
630 jp_milcent 278
	private void initialiserDescriptionTpl() {
279
		descriptionTpl =
280
			"<div class='{css_corps}'>"+
281
			"	<div class='{css_fieldset}'>"+
282
			"		<h2>{i18n_titre_description}</h2>"+
875 jpm 283
			"		<span class='{css_label}'>{i18n_type_botanique} :</span> {type_botanique}<br />"+
284
			"		<span class='{css_label}'>{i18n_nbre_echantillon} :</span> {nbre_echantillon}<br />"+
630 jp_milcent 285
			"	</div>"+
286
			"	<hr class='{css_clear}'/>"+
961 jpm 287
			"	<div>"+
288
			"		<h2>{i18n_titre_unite_rangement}</h2>"+
289
			"		<span class='{css_label}'>{i18n_etat_unite_rangement} :</span> {etat_unite_rangement}<br />"+
290
			"		{tableau_unite_rangement}"+
291
			"	</div>"+
292
			"	<div>"+
293
			"		<h2>{i18n_titre_unite_base}</h2>"+
294
			"		{tableau_unite_base}"+
295
			"	</div>"+
296
			"	<hr class='{css_clear}'/>"+
297
			"	<div>"+
298
			"		<h2>{i18n_titre_conservation}</h2>"+
299
			"		<span class='{css_label}'>{i18n_type_papier} :</span> {type_papier}<br />"+
300
			"		<span class='{css_label}'>{i18n_conservation_methode} :</span> {conservation_methode}<br />"+
301
			"	</div>"+
302
			"	<div>"+
303
			"		<h2>{i18n_titre_etiquette}</h2>"+
304
			"		<span class='{css_label}'>{i18n_specimen_fixation_pourcent} :</span> {specimen_fixation_pourcent}<br />"+
305
			"		<span class='{css_label}'>{i18n_etiquette_fixation_pourcent} :</span> {etiquette_fixation_pourcent}<br />"+
306
			"		<span class='{css_label}'>{i18n_specimen_fixation_methode} :</span> {specimen_fixation_methode}<br />"+
307
			"		<span class='{css_label}'>{i18n_etiquette_fixation_methode_support} :</span> {etiquette_fixation_methode_support}<br />"+
308
			"		<span class='{css_label}'>{i18n_etiquette_fixation_methode_specimen} :</span> {etiquette_fixation_methode_specimen}<br />"+
309
			"		<span class='{css_label}'>{i18n_etiquette_type_ecriture} :</span> {etiquette_type_ecriture}<br />"+
310
			"	</div>"+
311
			"	<div>"+
312
			"		<h2>{i18n_titre_traitement}</h2>"+
313
			"		<span class='{css_label}'>{i18n_traitement} :</span> {traitement}<br />"+
314
			"		<span class='{css_label}'>{i18n_traitement_poison} :</span> {traitement_poison}<br />"+
315
			"		<span class='{css_label}'>{i18n_traitement_insecte} :</span> {traitement_insecte}<br />"+
316
			"	</div>"+
317
			"	<hr class='{css_clear}'/>"+
630 jp_milcent 318
			"</div>";
319
	}
320
 
961 jpm 321
	private void initialiserTableauUniteRangementTpl() {
322
		tableauUniteRangementTpl =
323
			"<table>"+
324
			"	<thead>"+
325
			"		<tr>" +
326
			"			<th>{i18n_type}</th>" +
327
			"			<th>{i18n_nombre}</th>" +
328
			"			<th>{i18n_precision}</th>" +
329
			"			<th>{i18n_format}</th>" +
330
			"		</tr>"+
331
			"	</thead>"+
332
			"	<tbody>"+
333
			"		{lignes}"+
334
			"	</tbody>"+
335
			"</table>";
336
	}
337
 
338
	private void initialiserLigneUniteRangementTpl() {
339
		ligneUniteRangementTpl =
340
			"<tr>"+
341
			"	<td>{type}</td>"+
342
			"	<td>{nombre}</td>"+
343
			"	<td>{precision}</td>"+
344
			"	<td>{format}</td>"+
345
			"</tr>";
346
	}
347
 
348
	private void initialiserTableauUniteBaseTpl() {
349
		tableauUniteBaseTpl =
350
			"<table>"+
351
			"	<thead>"+
352
			"		<tr>" +
353
			"			<th colspan='4'>{i18n_unite_base}</th>" +
354
			"			<th colspan='2'>{i18n_part}</th>" +
355
			"			<th colspan='2'>{i18n_sp}</th>" +
356
			"		</tr>"+
357
			"		<tr>" +
358
			"			<th>{i18n_type}</th>" +
359
			"			<th>{i18n_nombre}</th>" +
360
			"			<th>{i18n_precision}</th>" +
361
			"			<th>{i18n_format}</th>" +
362
			"			<th>{i18n_nombre}</th>" +
363
			"			<th>{i18n_precision}</th>" +
364
			"			<th>{i18n_nombre}</th>" +
365
			"			<th>{i18n_precision}</th>" +
366
			"		</tr>"+
367
			"	</thead>"+
368
			"	<tbody>"+
369
			"		{lignes}"+
370
			"	</tbody>"+
371
			"</table>";
372
	}
373
 
374
	private void initialiserLigneUniteBaseTpl() {
375
		ligneUniteBaseTpl =
376
			"<tr>"+
377
			"	<td>{type}</td>"+
378
			"	<td>{nombre}</td>"+
379
			"	<td>{precision}</td>"+
380
			"	<td>{format}</td>"+
381
			"	<td>{part_nombre}</td>"+
382
			"	<td>{part_precision}</td>"+
383
			"	<td>{sp_nombre}</td>"+
384
			"	<td>{sp_precision}</td>"+
385
			"</tr>";
386
	}
387
 
630 jp_milcent 388
	private void initialiserContenuTpl() {
389
		contenuTpl =
390
			"<div class='{css_corps}'>"+
391
			"	<div class='{css_fieldset}'>"+
392
			"		<h2>{i18n_titre_contenu}</h2>"+
393
			"	</div>"+
394
			"	<hr class='{css_clear}'/>"+
395
			"</div>";
396
	}
397
 
398
	private void initialiserInventaireTpl() {
399
		inventaireTpl =
400
			"<div class='{css_corps}'>"+
401
			"	<div class='{css_fieldset}'>"+
402
			"		<h2>{i18n_titre_inventaire}</h2>"+
403
			"	</div>"+
404
			"	<hr class='{css_clear}'/>"+
405
			"</div>";
406
	}
407
 
453 jp_milcent 408
	private void chargerOntologie() {
961 jpm 409
		String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot", "groupementPrincipe",
410
			"realisationBut", "onpi", "ea", "typeClassement", "relationPersonneCollection", "ion",
411
			"typeUniteRangement", "etat", "typePapier", "methodeRangement", "methodeFixation", "methodeFixationSurSpecimen", "typeEcriture",
412
			"poisonTraitement", "insecteTraitement", "specimenDegradation", "niveauImportance", "supportDegradation", "niveauDetermination"};
813 jpm 413
		lancerChargementListesValeurs(listesCodes);
453 jp_milcent 414
	}
415
 
811 jpm 416
	public void rafraichir(Object nouvellesDonnees) {
417
		if (nouvellesDonnees instanceof Collection) {
418
			collection = (Collection) nouvellesDonnees;
813 jpm 419
			collectionChargementOk = true;
811 jpm 420
		} else if (nouvellesDonnees instanceof ProjetListe) {
421
			projets = (ProjetListe) nouvellesDonnees;
813 jpm 422
			projetsChargementOk = true;
811 jpm 423
		} else if (nouvellesDonnees instanceof ValeurListe) {
813 jpm 424
			ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
816 jpm 425
			receptionerListeValeurs(listeValeursReceptionnee);
883 jpm 426
		} else if (nouvellesDonnees instanceof Information) {
427
			Information info = (Information) nouvellesDonnees;
428
			if (info.getType().equals("liste_collection_a_personne")) {
429
				lierCollectionAPersonne((CollectionAPersonneListe) info.getDonnee(0));
430
			} else if (info.getType().equals("liste_collection_a_publication")) {
431
				lierCollectionAPublication((CollectionAPublicationListe) info.getDonnee(0));
432
			}
453 jp_milcent 433
		} else {
950 jpm 434
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
453 jp_milcent 435
		}
813 jpm 436
 
437
		if (avoirDonneesChargees()) {
438
			afficherDetail();
439
		}
453 jp_milcent 440
	}
441
 
883 jpm 442
	protected void lierCollectionAPersonne(CollectionAPersonneListe personnes) {
443
		collection.setPersonnesLiees(personnes);
444
		personnesLieesChargementOk = true;
445
	}
446
 
447
	protected void lierCollectionAPublication(CollectionAPublicationListe publications) {
448
		collection.setPublicationsLiees(publications);
449
		publicationsLieesChargementOk = true;
450
	}
451
 
813 jpm 452
	private boolean avoirDonneesChargees() {
453
		boolean ok = false;
948 jpm 454
		//Debug.log("projetsChargementOk:"+projetsChargementOk+"-collectionChargementOk:"+collectionChargementOk+"-ontologieChargementOk:"+ontologieChargementOk+"-personnesLieesChargementOk:"+personnesLieesChargementOk+"-publicationsLieesChargementOk:"+publicationsLieesChargementOk);
883 jpm 455
		if (projetsChargementOk && collectionChargementOk && ontologieChargementOk && personnesLieesChargementOk && publicationsLieesChargementOk) {
813 jpm 456
			ok = true;
457
		}
458
		return ok;
459
	}
460
 
453 jp_milcent 461
	private void afficherDetail() {
462
		if (collection != null) {
463
			afficherEntete();
464
			afficherIdentification();
883 jpm 465
			afficherPersonne();
687 jp_milcent 466
			afficherPublication();
630 jp_milcent 467
			afficherDescription();
468
			afficherContenu();
469
			afficherInventaire();
453 jp_milcent 470
		}
471
		layout();
472
	}
473
 
474
	private void afficherEntete() {
475
		Params enteteParams = new Params();
476
		enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
477
		enteteParams.set("css_meta", ComposantClass.META);
478
 
813 jpm 479
		enteteParams.set("i18n_id", i18nC.id());
480
 
453 jp_milcent 481
		enteteParams.set("nom", collection.getNom());
468 jp_milcent 482
		enteteParams.set("structure", collection.getStructureNom());
453 jp_milcent 483
		enteteParams.set("id", collection.getId());
484
		enteteParams.set("guid", collection.getGuid());
485
		enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
486
 
487
		String eHtml = Format.substitute(enteteTpl, enteteParams);
488
		entete.getElement().setInnerHTML(eHtml);
489
	}
490
 
491
	private void afficherIdentification() {
492
		Params generalParams = new Params();
493
		generalParams.set("i18n_titre_identification", i18nC.titreAdministratif());
961 jpm 494
		generalParams.set("i18n_nom_alternatif", i18nC.intituleAlternatifCollection());
477 jp_milcent 495
		generalParams.set("i18n_mere", i18nC.collectionMere());
687 jp_milcent 496
		generalParams.set("i18n_type_ncd", i18nC.typeCollectionNcd());
497
		generalParams.set("i18n_type_depot", i18nC.typeDepot());
961 jpm 498
		generalParams.set("i18n_id_alternatif", i18nC.idAlternatifCollection());
499
		generalParams.set("i18n_code", i18nC.codeAlternatifCollection());
500
		generalParams.set("i18n_cote", i18nC.cote());
501
 
630 jp_milcent 502
		generalParams.set("i18n_general_collection_titre", i18nC.collectionGeneralTitre());
477 jp_milcent 503
		generalParams.set("i18n_description", i18nC.description());
504
		generalParams.set("i18n_description_specialiste", i18nC.descriptionSpecialiste());
505
		generalParams.set("i18n_historique", i18nC.historique());
506
		generalParams.set("i18n_web", i18nC.siteWeb());
961 jpm 507
 
508
		generalParams.set("i18n_couverture_collection_titre", i18nC.collectionCouvertureTitre());
477 jp_milcent 509
		generalParams.set("i18n_groupement_principe", i18nC.groupementPrincipe());
510
		generalParams.set("i18n_groupement_but", i18nC.groupementBut());
961 jpm 511
		generalParams.set("i18n_couverture_geo", i18nC.couvertureGeo());
477 jp_milcent 512
 
961 jpm 513
		generalParams.set("i18n_specimen_type_titre", i18nC.collectionSpecimenTypeTitre());
514
		generalParams.set("i18n_specimen_type_presence", i18nC.specimenTypeCollectionDetail());
515
		generalParams.set("i18n_specimen_type_nombre", i18nC.nbreSpecimenTypeCollectionDetail());
516
		generalParams.set("i18n_specimen_type_classement", i18nC.classementSpecimenTypeCollectionDetail());
517
 
630 jp_milcent 518
		String nomAlternatif = construireTxtTruck(collection.getNomAlternatif());
519
		String typeNcd = construireTxtListeOntologie(collection.getTypeNcd());
520
		String typeDepot = construireTxtListeOntologie(collection.getTypeDepot());
961 jpm 521
		String idAlternatif = construireTxtTruck(collection.getIdAlternatif());
522
		String code = construireTxtTruck(collection.getCode());
523
 
524
		String urls = construireTxtTruck(collection.getUrls());
525
 
875 jpm 526
		String groupementBut = construireTxtListeOntologie(collection.getGroupementBut());
527
		String groupementPrincipe = construireTxtListeOntologie(collection.getGroupementPrincipe());
961 jpm 528
		String couvertureGeo = construireTxtTruck(collection.getCouvertureLieu());
529
		String specimenTypePresence = construireTxtListeOntologie(collection.getSpecimenType());
530
		String specimenTypeNombrePrecision = construireTxtListeOntologie(collection.getSpecimenTypeNbrePrecision());
531
		String specimenTypeNombre = "";
532
		if (!collection.getSpecimenTypeNbre().equals("0")) {
533
			specimenTypeNombre = collection.getSpecimenTypeNbre()+" ("+specimenTypeNombrePrecision+")";
534
		}
535
		String specimenTypeClassement = construireTxtListeOntologie(collection.getSpecimenTypeClassement());
630 jp_milcent 536
 
537
		generalParams.set("nom_alternatif", nomAlternatif);
538
		generalParams.set("mere", collection.getCollectionMereNom());
687 jp_milcent 539
		generalParams.set("type_ncd", typeNcd);
540
		generalParams.set("type_depot", typeDepot);
961 jpm 541
		generalParams.set("id_alternatif", idAlternatif);
542
		generalParams.set("code", code);
543
		generalParams.set("cote", collection.getCote());
544
 
477 jp_milcent 545
		generalParams.set("description", collection.getDescription());
546
		generalParams.set("description_specialiste", collection.getDescriptionSpecialiste());
630 jp_milcent 547
		generalParams.set("historique", collection.getHistorique());
548
		generalParams.set("web", urls);
961 jpm 549
 
875 jpm 550
		generalParams.set("groupement_principe", groupementPrincipe);
551
		generalParams.set("groupement_but", groupementBut);
961 jpm 552
		generalParams.set("couverture_geo", couvertureGeo);
453 jp_milcent 553
 
961 jpm 554
		generalParams.set("specimen_type_presence", specimenTypePresence);
555
		generalParams.set("specimen_type_nombre", specimenTypeNombre);
556
		generalParams.set("specimen_type_classement", specimenTypeClassement);
557
 
453 jp_milcent 558
		afficherOnglet(generalTpl, generalParams, generalOnglet);
559
	}
560
 
883 jpm 561
	private void afficherPersonne() {
562
		String tableauPersonneHtml = "";
914 jpm 563
		if (collection.getPersonnesLiees() != null && collection.getPersonnesLiees().size() > 0) {
883 jpm 564
			tableauPersonneHtml = construireTableauPersonnesLiees();
565
		}
630 jp_milcent 566
 
883 jpm 567
		Params personneParams = new Params();
568
		personneParams.set("i18n_titre_personne", i18nC.collectionPersonneTitre());
569
		personneParams.set("tableau_personnes_liees", tableauPersonneHtml);
570
 
571
		afficherOnglet(personneTpl, personneParams, personneOnglet);
630 jp_milcent 572
	}
573
 
883 jpm 574
	private String construireTableauPersonnesLiees() {
575
		Params contenuParams = new Params();
961 jpm 576
		contenuParams.set("i18n_relation", i18nC.typeRelationPersonneCollection());
577
		contenuParams.set("i18n_nom_complet", i18nC.personneNomComplet());
883 jpm 578
		contenuParams.set("i18n_prenom", i18nC.personnePrenom());
579
		contenuParams.set("i18n_nom", i18nC.personneNom());
961 jpm 580
		contenuParams.set("i18n_naissance_date", i18nC.personneDateNaissance());
581
		contenuParams.set("i18n_naissance_lieu", i18nC.personneLieuNaissance());
582
		contenuParams.set("i18n_etre_decede", i18nC.personneDeces());
583
		contenuParams.set("i18n_deces_date", i18nC.personneDateDeces());
584
		contenuParams.set("i18n_deces_lieu", i18nC.personneLieuDeces());
883 jpm 585
 
586
		String lignesPersonnel = "";
587
 
588
		Iterator<String> it = collection.getPersonnesLiees().keySet().iterator();
589
		while (it.hasNext()) {
590
			CollectionAPersonne relationCollectionAPersonne = collection.getPersonnesLiees().get(it.next());
591
			Personne personne = relationCollectionAPersonne.getPersonne();
961 jpm 592
 
593
			String relation = construireTxtListeOntologie(relationCollectionAPersonne.getIdRole());
594
			String etreDecede = construireTxtListeOntologie(personne.getDeces());
595
 
883 jpm 596
			Params ligneParams = new Params();
961 jpm 597
			ligneParams.set("relation", relation);
598
			ligneParams.set("nom_complet", personne.getNomComplet());
599
			ligneParams.set("nom", personne.getNom());
600
			ligneParams.set("prenom", personne.getPrenom());
601
			ligneParams.set("naissance_date", personne.getNaissanceDate());
602
			ligneParams.set("naissance_lieu", personne.getNaissanceLieu());
603
			ligneParams.set("etre_decede", etreDecede);
604
			ligneParams.set("deces_date", personne.getDecesDate());
605
			ligneParams.set("deces_lieu", personne.getDecesLieu());
883 jpm 606
 
607
			lignesPersonnel += Format.substitute(lignePersonneLieeTpl, ligneParams);
608
		}
609
		contenuParams.set("lignes", lignesPersonnel);
610
 
611
		String cHtml = Format.substitute(tableauPersonnesLieesTpl, contenuParams);
612
		return cHtml;
613
	}
614
 
687 jp_milcent 615
	private void afficherPublication() {
616
		Params publicationParams = new Params();
617
		publicationParams.set("i18n_titre_publication", i18nC.collectionPublicationTitre());
618
 
883 jpm 619
		String tableauPublicationHtml = "";
914 jpm 620
		if (collection.getPersonnesLiees() != null && collection.getPersonnesLiees().size() > 0) {
883 jpm 621
			tableauPublicationHtml = construireTableauPublicationsLiees();
622
		}
623
		publicationParams.set("tableau_publications_liees", tableauPublicationHtml);
624
 
687 jp_milcent 625
		afficherOnglet(publicationTpl, publicationParams, publicationOnglet);
626
	}
627
 
883 jpm 628
	private String construireTableauPublicationsLiees() {
629
		Params contenuParams = new Params();
630
		contenuParams.set("i18n_auteur", i18nC.publicationAuteurs());
631
		contenuParams.set("i18n_titre", i18nC.publicationTitre());
961 jpm 632
		contenuParams.set("i18n_revue", i18nC.publicationRevueCollection());
633
		contenuParams.set("i18n_editeur", i18nC.publicationEditeur());
634
		contenuParams.set("i18n_annee", i18nC.publicationDateParution());
635
		contenuParams.set("i18n_nvt", i18nC.publicationNvt());
636
		contenuParams.set("i18n_fascicule", i18nC.publicationFascicule());
637
		contenuParams.set("i18n_page", i18nC.publicationPage());
883 jpm 638
 
639
		String lignesPublication = "";
640
 
641
		Iterator<String> it = collection.getPublicationsLiees().keySet().iterator();
642
		while (it.hasNext()) {
643
			CollectionAPublication relationCollectionAPublication = collection.getPublicationsLiees().get(it.next());
644
			Publication publication = relationCollectionAPublication.getPublication();
645
			Params ligneParams = new Params();
646
 
647
			ligneParams.set("auteur", publication.getAuteur());
648
			ligneParams.set("titre", publication.getTitre());
961 jpm 649
			ligneParams.set("revue", publication.getCollection());
650
			ligneParams.set("editeur", publication.getEditeur());
651
			ligneParams.set("annee", publication.getAnneeParution());
652
			ligneParams.set("nvt", publication.getIndicationNvt());
653
			ligneParams.set("fascicule", publication.getFascicule());
654
			ligneParams.set("page", publication.getPages());
883 jpm 655
			lignesPublication += Format.substitute(lignePublicationLieeTpl, ligneParams);
656
		}
657
		contenuParams.set("lignes", lignesPublication);
658
 
659
		String cHtml = Format.substitute(tableauPublicationsLieesTpl, contenuParams);
660
		return cHtml;
661
	}
662
 
630 jp_milcent 663
	private void afficherDescription() {
664
		Params descriptionParams = new Params();
665
		descriptionParams.set("i18n_titre_description", i18nC.collectionDescriptionTitre());
875 jpm 666
		descriptionParams.set("i18n_type_botanique", i18nC.typeCollectionBotanique());
667
		descriptionParams.set("i18n_nbre_echantillon", i18nC.nbreEchantillon());
630 jp_milcent 668
 
961 jpm 669
		descriptionParams.set("i18n_titre_unite_rangement", i18nC.collectionUniteRangementTitre());
670
		descriptionParams.set("i18n_etat_unite_rangement", i18nC.collectionEtatGeneralDetail());
671
		descriptionParams.set("i18n_titre_unite_base", i18nC.collectionUniteBaseTitre());
672
 
673
		descriptionParams.set("i18n_titre_conservation", i18nC.collectionTitreConservation());
674
		descriptionParams.set("i18n_type_papier", i18nC.typePapierConservationDetail());
675
		descriptionParams.set("i18n_conservation_methode", i18nC.methodeConservationDetail());
676
 
677
		descriptionParams.set("i18n_titre_etiquette", i18nC.collectionTitreEtiquette());
678
		descriptionParams.set("i18n_specimen_fixation_pourcent", i18nC.specimenFixationPourcent());
679
		descriptionParams.set("i18n_etiquette_fixation_pourcent", i18nC.etiquetteFixationPourcent());
680
		descriptionParams.set("i18n_specimen_fixation_methode", i18nC.specimenMethodeFixationDetail());
681
		descriptionParams.set("i18n_etiquette_fixation_methode_support", i18nC.etiquetteMethodeFixationSurSupportDetail());
682
		descriptionParams.set("i18n_etiquette_fixation_methode_specimen", i18nC.etiquetteMethodeFixationSurSpecimenDetail());
683
		descriptionParams.set("i18n_etiquette_type_ecriture", i18nC.typeEcritureDetail());
684
 
685
		descriptionParams.set("i18n_titre_traitement", i18nC.collectionTitreTraitement());
686
		descriptionParams.set("i18n_traitement", i18nC.collectionTraitementDetail());
687
		descriptionParams.set("i18n_traitement_poison", i18nC.collectionTraitementPoisonDetail());
688
		descriptionParams.set("i18n_traitement_insecte", i18nC.collectionTraitementInsecteDetail());
689
 
875 jpm 690
		String typeBota = construireTxtListeOntologie(collection.getBotanique().getType());
691
		descriptionParams.set("type_botanique", typeBota);
692
		descriptionParams.set("nbre_echantillon", collection.getBotanique().getNbreEchantillon());
693
 
961 jpm 694
		CollectionBotanique collectionBotanique = collection.getBotanique();
695
		String etatUniteRangement = construireTxtListeOntologie(collectionBotanique.getUniteRangementEtat());
696
		String tableauUniteRangementHtml = construireTableauUniteRangement();
697
		String tableauUniteBaseHtml = construireTableauUniteBase();
698
		descriptionParams.set("tableau_unite_rangement", tableauUniteRangementHtml);
699
		descriptionParams.set("etat_unite_rangement", etatUniteRangement);
700
		descriptionParams.set("tableau_unite_base", tableauUniteBaseHtml);
701
 
702
		String typePapier = construireTxtListeOntologie(collectionBotanique.getConservationPapierType());
703
		String conservationMethode = construireTxtListeOntologie(collectionBotanique.getConservationMethode());
704
		descriptionParams.set("type_papier", typePapier);
705
		descriptionParams.set("conservation_methode", conservationMethode);
706
 
707
		String specimenFixationMethode = construireTxtListeOntologie(collectionBotanique.getSpecimenFixationMethode());
708
		String etiquetteFixationMethodeSupport = construireTxtListeOntologie(collectionBotanique.getEtiquetteFixationSupport());
709
		String etiquetteFixationMethodeSpecimen = construireTxtListeOntologie(collectionBotanique.getEtiquetteFixationSpecimen());
710
		String etiquetteTypeEcriture = construireTxtListeOntologie(collectionBotanique.getEtiquetteEcriture());
711
		descriptionParams.set("specimen_fixation_pourcent", collectionBotanique.getSpecimenFixationPourcent());
712
		descriptionParams.set("etiquette_fixation_pourcent", collectionBotanique.getEtiquetteFixationPourcent());
713
		descriptionParams.set("specimen_fixation_methode", specimenFixationMethode);
714
		descriptionParams.set("etiquette_fixation_methode_support", etiquetteFixationMethodeSupport);
715
		descriptionParams.set("etiquette_fixation_methode_specimen", etiquetteFixationMethodeSpecimen);
716
		descriptionParams.set("etiquette_type_ecriture", etiquetteTypeEcriture);
717
 
718
		String traitement = construireTxtListeOntologie(collectionBotanique.getTraitement());
719
		String traitementPoison = construireTxtListeOntologie(collectionBotanique.getTraitementPoison());
720
		String traitementInsecte = construireTxtListeOntologie(collectionBotanique.getTraitementInsecte());
721
		descriptionParams.set("traitement", traitement);
722
		descriptionParams.set("traitement_poison", traitementPoison);
723
		descriptionParams.set("traitement_insecte", traitementInsecte);
724
 
630 jp_milcent 725
		afficherOnglet(descriptionTpl, descriptionParams, descriptionOnglet);
726
	}
727
 
961 jpm 728
	private String construireTableauUniteRangement() {
729
		Params contenuParams = new Params();
730
		contenuParams.set("i18n_type", i18nC.collectionUniteType());
731
		contenuParams.set("i18n_nombre", i18nC.collectionUniteNbre());
732
		contenuParams.set("i18n_precision", i18nC.collectionUnitePrecision());
733
		contenuParams.set("i18n_format", i18nC.collectionUniteFormat());
734
 
735
		CollectionBotanique collectionBotanique = collection.getBotanique();
736
		HashMap<String,UniteRangement> unites = CollectionFormDescription.parserValeurUniteRangement(collectionBotanique.getUniteRangement());
737
 
738
		String lignesUnite = "";
739
		Iterator<String> it = unites.keySet().iterator();
740
		while (it.hasNext()) {
741
			String cle = it.next();
742
			UniteRangement unite = unites.get(cle);
743
			if (unite.getNombre() != 0) {
744
				Params ligneParams = new Params();
745
				if (unite.getTypeAutre()) {
746
					ligneParams.set("type", unite.getType());
747
				} else {
748
					ligneParams.set("type", construireTxtListeOntologie(unite.getId()));
749
				}
750
				ligneParams.set("nombre", UtilNombre.formaterEnEntier(unite.getNombre()));
751
				ligneParams.set("precision", unite.getPrecision());
752
				ligneParams.set("format", unite.getFormat());
753
 
754
				lignesUnite += Format.substitute(ligneUniteRangementTpl, ligneParams);
755
			}
756
		}
757
 
758
		String cHtml = i18nC.nonRenseigne();
759
		if (!UtilString.isEmpty(lignesUnite)) {
760
			contenuParams.set("lignes", lignesUnite);
761
			cHtml = Format.substitute(tableauUniteRangementTpl, contenuParams);
762
		}
763
		return cHtml;
764
	}
765
 
766
	private String construireTableauUniteBase() {
767
		Params contenuParams = new Params();
768
		contenuParams.set("i18n_unite_base", i18nC.collectionUniteBase());
769
		contenuParams.set("i18n_part", i18nC.collectionUniteBasePart());
770
		contenuParams.set("i18n_sp", i18nC.collectionUniteBaseSp());
771
 
772
		contenuParams.set("i18n_type", i18nC.collectionUniteType());
773
		contenuParams.set("i18n_nombre", i18nC.collectionUniteNbre());
774
		contenuParams.set("i18n_precision", i18nC.collectionUnitePrecision());
775
		contenuParams.set("i18n_format", i18nC.collectionUniteFormat());
776
 
777
		CollectionBotanique collectionBotanique = collection.getBotanique();
778
		HashMap<String,UniteBase> unites = CollectionFormDescription.parserValeurUniteBase(collectionBotanique.getUniteBase());
779
 
780
		String lignesUnite = "";
781
		Iterator<String> it = unites.keySet().iterator();
782
		while (it.hasNext()) {
783
			String cle = it.next();
784
			UniteBase unite = unites.get(cle);
785
			if (unite.getNombre() != 0 || unite.getNombrePart() != 0 || unite.getNombreSp() != 0) {
786
				Params ligneParams = new Params();
787
				if (unite.getTypeAutre()) {
788
					ligneParams.set("type", unite.getType());
789
				} else {
790
					ligneParams.set("type", construireTxtListeOntologie(unite.getId()));
791
				}
792
				ligneParams.set("nombre", UtilNombre.formaterEnEntier(unite.getNombre()));
793
				ligneParams.set("precision", unite.getPrecision());
794
				ligneParams.set("format", unite.getFormat());
795
				ligneParams.set("part_nombre", unite.getNombrePart());
796
				ligneParams.set("part_precision", unite.getPrecisionPart());
797
				ligneParams.set("sp_nombre", unite.getNombreSp());
798
				ligneParams.set("sp_precision", unite.getPrecisionSp());
799
 
800
				lignesUnite += Format.substitute(ligneUniteBaseTpl, ligneParams);
801
			}
802
		}
803
 
804
		String cHtml = i18nC.nonRenseigne();
805
		if (!UtilString.isEmpty(lignesUnite)) {
806
			contenuParams.set("lignes", lignesUnite);
807
			cHtml = Format.substitute(tableauUniteBaseTpl, contenuParams);
808
		}
809
		return cHtml;
810
	}
811
 
630 jp_milcent 812
	private void afficherContenu() {
813
		Params contenuParams = new Params();
814
		contenuParams.set("i18n_titre_contenu", i18nC.collectionContenuTitre());
815
 
816
		afficherOnglet(contenuTpl, contenuParams, contenuOnglet);
817
	}
818
 
819
	private void afficherInventaire() {
820
		Params inventaireParams = new Params();
821
		inventaireParams.set("i18n_titre_inventaire", i18nC.collectionInventaireTitre());
822
 
823
		afficherOnglet(inventaireTpl, inventaireParams, inventaireOnglet);
824
	}
825
 
468 jp_milcent 826
	protected String getNomStructure() {
827
		String nomStructure = "";
828
		if (structure != null) {
829
			nomStructure = structure.getNom();
830
		} else {
831
			nomStructure = collection.getIdStructure();
453 jp_milcent 832
		}
468 jp_milcent 833
		return nomStructure;
453 jp_milcent 834
	}
835
}