Subversion Repositories eFlore/Applications.coel

Rev

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

Rev Author Line No. Line
60 jpm 1
package org.tela_botanica.client;
2
 
231 jp_milcent 3
import java.util.Iterator;
134 jpm 4
import java.util.List;
5
 
61 jpm 6
import org.tela_botanica.client.composants.AideFenetre;
60 jpm 7
import org.tela_botanica.client.composants.IdentificationFenetre;
66 jpm 8
import org.tela_botanica.client.composants.ParametreFenetre;
119 jpm 9
import org.tela_botanica.client.interfaces.Rafraichissable;
61 jpm 10
import org.tela_botanica.client.modeles.Configuration;
156 jp_milcent 11
import org.tela_botanica.client.modeles.Information;
327 jp_milcent 12
import org.tela_botanica.client.modeles.MenuApplicationId;
142 gduche 13
import org.tela_botanica.client.modeles.Personne;
128 gduche 14
import org.tela_botanica.client.modeles.PersonneListe;
245 jp_milcent 15
import org.tela_botanica.client.modeles.Projet;
268 jp_milcent 16
import org.tela_botanica.client.modeles.ProjetListe;
107 aurelien 17
import org.tela_botanica.client.modeles.Publication;
18
import org.tela_botanica.client.modeles.PublicationListe;
60 jpm 19
import org.tela_botanica.client.modeles.Structure;
209 jp_milcent 20
import org.tela_botanica.client.modeles.StructureAPersonne;
231 jp_milcent 21
import org.tela_botanica.client.modeles.StructureAPersonneListe;
188 jp_milcent 22
import org.tela_botanica.client.modeles.StructureConservation;
69 jpm 23
import org.tela_botanica.client.modeles.StructureListe;
195 jp_milcent 24
import org.tela_botanica.client.modeles.StructureValorisation;
61 jpm 25
import org.tela_botanica.client.modeles.Utilisateur;
91 jpm 26
import org.tela_botanica.client.modeles.ValeurListe;
60 jpm 27
import org.tela_botanica.client.vues.ContenuPanneauVue;
28
import org.tela_botanica.client.vues.EntetePanneauVue;
196 gduche 29
import org.tela_botanica.client.vues.FormPersonneVue;
223 aurelien 30
import org.tela_botanica.client.vues.FormPublicationVue;
69 jpm 31
import org.tela_botanica.client.vues.FormStructureVue;
142 gduche 32
import org.tela_botanica.client.vues.PersonneDetailPanneauVue;
128 gduche 33
import org.tela_botanica.client.vues.PersonneVue;
332 gduche 34
import org.tela_botanica.client.vues.PopupChargement;
107 aurelien 35
import org.tela_botanica.client.vues.PublicationDetailPanneauVue;
36
import org.tela_botanica.client.vues.PublicationVue;
60 jpm 37
import org.tela_botanica.client.vues.StructureDetailPanneauVue;
38
import org.tela_botanica.client.vues.StructureVue;
39
import org.tela_botanica.client.vues.MenuPanneauVue;
40
 
41
import com.extjs.gxt.ui.client.Registry;
42
import com.extjs.gxt.ui.client.Style.LayoutRegion;
315 gduche 43
import com.extjs.gxt.ui.client.event.ComponentEvent;
44
import com.extjs.gxt.ui.client.event.Listener;
60 jpm 45
import com.extjs.gxt.ui.client.util.Margins;
315 gduche 46
import com.extjs.gxt.ui.client.widget.Dialog;
156 jp_milcent 47
import com.extjs.gxt.ui.client.widget.Info;
315 gduche 48
import com.extjs.gxt.ui.client.widget.MessageBox;
60 jpm 49
import com.extjs.gxt.ui.client.widget.Viewport;
315 gduche 50
import com.extjs.gxt.ui.client.widget.button.Button;
60 jpm 51
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
52
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
91 jpm 53
import com.google.gwt.core.client.GWT;
60 jpm 54
import com.google.gwt.user.client.Window;
55
import com.google.gwt.user.client.ui.RootPanel;
56
 
277 jp_milcent 57
public class Mediateur implements Rafraichissable {
60 jpm 58
 
119 jpm 59
	private Modele modele = null;
60
 
60 jpm 61
	private Viewport viewport;
62
	private EntetePanneauVue panneauNord = null;
63
	private MenuPanneauVue panneauOuest = null;
64
	private ContenuPanneauVue panneauCentre = null;
156 jp_milcent 65
	private Rafraichissable contenuPanneauCentre = null;
60 jpm 66
 
67
	public Mediateur() {
68
		// Enregistrement du Médiateur dans le Registre
69
		Registry.register(RegistreId.MEDIATEUR, this);
70
		// Création du Modèle qui s'enregistre lui même dans le Registre
119 jpm 71
		modele = new Modele();
277 jp_milcent 72
	    // Création de l'utilisateur courrant
73
		Registry.register(RegistreId.UTILISATEUR_COURANT, new Utilisateur(null, false));
65 jpm 74
		this.connecterUtilisateur(null, null);
277 jp_milcent 75
	    // Création du projet courrant
76
		Registry.register(RegistreId.PROJET_COURANT, new Projet());
65 jpm 77
 
60 jpm 78
		// Création du Viewport qui contient la disposition globale de l'application
79
		viewport = new Viewport();
80
		viewport.setLayout(new BorderLayout());
81
 
82
		// Création des différents panneaux
83
	    creerPanneauNord();
84
	    creerPanneauOuest();
85
	    creerPanneauCentral();
86
 
87
		// Registry utile car présent partout!
88
		Registry.register(RegistreId.VIEWPORT, viewport);
89
		Registry.register(RegistreId.PANNEAU_OUEST, panneauOuest);
90
		Registry.register(RegistreId.PANNEAU_CENTRE, panneauCentre);
91
 
92
		// Chargement du menu
327 jp_milcent 93
		chargeMenuApplication();
60 jpm 94
 
95
		// Retour à GWT du Viewport une fois constuit
96
		RootPanel.get().add(viewport);
332 gduche 97
 
98
		masquerPopinChargement();
60 jpm 99
	}
100
 
156 jp_milcent 101
	//+----------------------------------------------------------------------------------------------------------------+
102
	//												GESTION des PANNEAUX PRINCIPAUX
103
	//+----------------------------------------------------------------------------------------------------------------+
119 jpm 104
 
60 jpm 105
	private void creerPanneauNord() {
106
		panneauNord = new EntetePanneauVue();
107
 
108
		BorderLayoutData regionNord = new BorderLayoutData(LayoutRegion.NORTH, 100);
109
		regionNord.setCollapsible(true);
110
		regionNord.setFloatable(true);
111
		regionNord.setSplit(false);
112
		regionNord.setMargins(new Margins(5, 5, 0, 5));
113
 
114
		viewport.add(panneauNord, regionNord);
115
	}
116
 
117
	private void creerPanneauOuest() {
118
		panneauOuest = new MenuPanneauVue();
119
 
120
		BorderLayoutData regionOuest = new BorderLayoutData(LayoutRegion.WEST, 200);
121
		regionOuest.setSplit(true);
122
		regionOuest.setCollapsible(true);
123
		regionOuest.setMargins(new Margins(5));
124
 
125
		viewport.add(panneauOuest, regionOuest);
126
	}
127
 
128
	private void creerPanneauCentral() {
129
		panneauCentre = new ContenuPanneauVue();
130
 
131
		BorderLayoutData regionCentre = new BorderLayoutData(LayoutRegion.CENTER);
132
		regionCentre.setMargins(new Margins(5, 5, 5, 0));
133
 
134
		viewport.add(panneauCentre, regionCentre);
135
	}
136
 
156 jp_milcent 137
	//+----------------------------------------------------------------------------------------------------------------+
138
	//												GESTION du MENU
139
	//+----------------------------------------------------------------------------------------------------------------+
140
 
327 jp_milcent 141
	public void chargeMenuApplication() {
142
		((MenuPanneauVue) Registry.get(RegistreId.PANNEAU_OUEST)).chargerMenus();
60 jpm 143
	}
144
 
327 jp_milcent 145
	public void clicMenu(String codeMenuClique) {
332 gduche 146
 
147
		afficherPopinChargement();
148
 
60 jpm 149
		panneauCentre.removeAll();
327 jp_milcent 150
		if (codeMenuClique.equals(MenuApplicationId.STRUCTURE)) {
277 jp_milcent 151
			modele.selectionnerStructure(panneauCentre, getProjetId(), null);
327 jp_milcent 152
		} else if (codeMenuClique.equals(MenuApplicationId.PUBLICATION)) {
277 jp_milcent 153
			modele.selectionnerPublications(panneauCentre);
327 jp_milcent 154
		} else if (codeMenuClique.equals(MenuApplicationId.PERSONNE)) {
277 jp_milcent 155
			modele.selectionnerPersonne(panneauCentre, null, getProjetId(), null);
128 gduche 156
		}
107 aurelien 157
		else {
327 jp_milcent 158
			GWT.log("Non implémenté! Menu id : "+codeMenuClique, null);
60 jpm 159
		}
160
		panneauCentre.layout();
161
	}
162
 
156 jp_milcent 163
	//+----------------------------------------------------------------------------------------------------------------+
164
	//												GESTION DES FENÊTRES
165
	//+----------------------------------------------------------------------------------------------------------------+
60 jpm 166
 
61 jpm 167
	public void ouvrirAide() {
168
		AideFenetre aideFenetre = new AideFenetre();
169
		aideFenetre.show();
66 jpm 170
		// FIXME : apparament le fade In/Fade Out pose problème sur les navigateurs...
171
		//aideFenetre.el().fadeIn(FxConfig.NONE);
61 jpm 172
	}
173
 
174
	public void ouvrirParametres() {
66 jpm 175
		ParametreFenetre parametresFenetre = new ParametreFenetre();
176
		parametresFenetre.show();
61 jpm 177
	}
178
 
179
	public void ouvrirIdentification() {
180
		IdentificationFenetre identifFenetre = new IdentificationFenetre();
181
		identifFenetre.show();
182
	}
183
 
184
	public void ouvrirApplis(String id) {
185
		if (id.equals(ComposantId.MENU_CEL)) {
186
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getCelUrl(), "Carnet en ligne", "");
187
		} else if (id.equals(ComposantId.MENU_BEL)) {
134 jpm 188
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getCelUrl(), "Biblio en ligne", "");
61 jpm 189
		}
190
	}
191
 
156 jp_milcent 192
	//+----------------------------------------------------------------------------------------------------------------+
193
	//												GESTION de l'UTILISATEUR et de l'IDENTIFICATION
194
	//+----------------------------------------------------------------------------------------------------------------+
245 jp_milcent 195
	/**
196
	 * Retourne l'identifiant de l'utilisateur courrant de l'application.
197
	 */
156 jp_milcent 198
	public String getUtilisateurId() {
277 jp_milcent 199
		String id = null;
200
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
201
		if (!utilisateurCourant.getId().equals("")) {
202
			id = utilisateurCourant.getId();
203
		}
204
		return id;
156 jp_milcent 205
	}
206
 
207
	public void clicIdentification() {
208
		// Gestion du login
209
		IdentificationFenetre dialog = new IdentificationFenetre();
210
	    dialog.setClosable(false);
211
	    dialog.show();
212
	}
213
 
65 jpm 214
	public void connecterUtilisateur(String login, String mdp) {
277 jp_milcent 215
		modele.connecterUtilisateur(this, login, mdp);
64 jpm 216
	}
217
 
65 jpm 218
	public void deconnecterUtilisateur() {
277 jp_milcent 219
		modele.deconnecterUtilisateur(this);
64 jpm 220
	}
65 jpm 221
 
64 jpm 222
	public void mettreAJourEtatIdentification(Utilisateur utilisateur) {
156 jp_milcent 223
		// Mise à jour du registre
277 jp_milcent 224
		Registry.register(RegistreId.UTILISATEUR_COURANT, utilisateur);
156 jp_milcent 225
 
226
		// Création de l'information de mise à jour de l'utilisateur
227
		Information info = new Information("maj_utilisateur");
228
 
229
		// Rafraichissement du panneau Nord
230
		panneauNord.rafraichir(info);
231
 
232
		// Rafraichissement du panneau Centre
233
		if (contenuPanneauCentre != null) {
234
			contenuPanneauCentre.rafraichir(info);
235
		}
61 jpm 236
	}
66 jpm 237
 
156 jp_milcent 238
	//+----------------------------------------------------------------------------------------------------------------+
239
	//												GESTION DES PERSONNES
240
	//+----------------------------------------------------------------------------------------------------------------+
241
 
242
	public void clicListePersonne(Personne personne)	{
243
		((PersonneDetailPanneauVue) Registry.get(RegistreId.PANNEAU_PERSONNE_DETAIL)).rafraichir(personne);
244
 
69 jpm 245
	}
246
 
278 jp_milcent 247
	public void afficherListePersonnes(PersonneListe personnesACharger)	{
248
		if ( !(contenuPanneauCentre instanceof PersonneVue) ) {
249
			PersonneVue personneVue = new PersonneVue();
250
			contenuPanneauCentre = personneVue;
251
			panneauCentre.add(personneVue);
252
		}
253
		contenuPanneauCentre.rafraichir(personnesACharger);
254
		//contenuPanneauCentre.layout();
156 jp_milcent 255
	}
256
 
128 gduche 257
	public void clicAjouterPersonne()	{
332 gduche 258
 
259
		afficherPopinChargement();
260
 
277 jp_milcent 261
		panneauCentre.removeAll();
262
		FormPersonneVue formulairePersonneVue = new FormPersonneVue();
263
		contenuPanneauCentre = formulairePersonneVue;
264
		panneauCentre.add(formulairePersonneVue);
265
		panneauCentre.layout();
128 gduche 266
	}
267
 
285 gduche 268
	public void clicModifierPersonne(Personne personne)	{
269
		if (personne!=null)	{
270
			panneauCentre.removeAll();
271
			FormPersonneVue formulairePersonneVue = new FormPersonneVue();
272
			contenuPanneauCentre = formulairePersonneVue;
273
			panneauCentre.add(formulairePersonneVue);
274
			formulairePersonneVue.rafraichir(personne);
275
			panneauCentre.layout();
276
		}
277
	}
278
 
279
 
315 gduche 280
	public void clicSupprimerPersonne(final Rafraichissable vue,final List<Personne> personneSelection) {
245 jp_milcent 281
 
282
		String ids = "" ;
283
 
284
		if (personneSelection.size() == 0) {
285
			Info.display("Information", "Veuillez sélectionner une personne.");
286
		} else if(personneSelection.size() > 0) {
287
			String message = "Êtes vous sur de vouloir supprimer les personnes sélectionnées ?";
288
			if (personneSelection.size() == 1) {
289
				message = "Êtes vous sur de vouloir supprimer la personne sélectionnée ?";
290
			}
315 gduche 291
 
292
 
293
			final Listener listenerSuppression = new Listener<ComponentEvent>() {
294
 
327 jp_milcent 295
				public void handleEvent(ComponentEvent ce) {
296
					Dialog dialog = (Dialog) ce.component;
297
					Button btn = dialog.getButtonPressed();
298
 
299
					if (btn.getText().equals(dialog.yesText)) {
300
						String idStr = "" ;
347 gduche 301
						Iterator<Personne> itPersonne = personneSelection.iterator();
302
						while (itPersonne.hasNext()) {
303
							Personne personneCourante = itPersonne.next();
304
							idStr += personneCourante.getId();
305
 
306
							if (itPersonne.hasNext())	{
307
								idStr +=", ";
308
							}
327 jp_milcent 309
						}
329 jp_milcent 310
						modele.supprimerPersonne(vue, idStr);
327 jp_milcent 311
					}
312
				}
313
			};
315 gduche 314
 
315
			MessageBox.confirm("Supprimer une personne", message, listenerSuppression);
316
 
317
 
245 jp_milcent 318
		} else {
319
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerPersonne() du Médiateur.");
320
		}
321
	}
277 jp_milcent 322
 
323
	public void selectionnerPersonneParNomComplet(Rafraichissable vue, String projetId, String nomComplet) {
324
		modele.selectionnerPersonne(vue, null, projetId, nomComplet);
325
	}
245 jp_milcent 326
 
156 jp_milcent 327
	//+----------------------------------------------------------------------------------------------------------------+
328
	//												GESTION DES VALEURS ET LISTES
329
	//+----------------------------------------------------------------------------------------------------------------+
330
 
91 jpm 331
	public void afficherListeValeurs(ValeurListe nouvelleDonnees) {
156 jp_milcent 332
		if (panneauCentre.getId().equals(ComposantId.PANNEAU_STRUCTURE_FORM)) {
91 jpm 333
			((FormStructureVue) panneauCentre.getItem(0)).rafraichir(nouvelleDonnees);
334
		} else {
335
			GWT.log("Aucun panneau trouvé pour afficher la liste de valeur", null);
336
		}
337
	}
338
 
156 jp_milcent 339
	//+----------------------------------------------------------------------------------------------------------------+
340
	//												GESTION DES PUBLICATIONS
341
	//+----------------------------------------------------------------------------------------------------------------+
342
 
107 aurelien 343
	public void afficherListePublication(PublicationListe nouvelleDonnees) {
344
		PublicationVue publicationVue = new PublicationVue() ;
228 aurelien 345
		panneauCentre.removeAll();
107 aurelien 346
		panneauCentre.add(publicationVue);
186 gduche 347
		contenuPanneauCentre = publicationVue;
107 aurelien 348
		publicationVue.rafraichir(nouvelleDonnees);
349
 
350
	}
351
 
352
	public void clicListePublication(Publication publication) {
353
 
354
		((PublicationDetailPanneauVue) Registry.get(RegistreId.PANNEAU_PUBLICATION_DETAIL)).rafraichir(publication);
355
	}
356
 
357
	public void clicAjouterPublication() {
223 aurelien 358
		panneauCentre.removeAll();
359
		FormPublicationVue formPublicationVue = new FormPublicationVue();
360
		panneauCentre.add(formPublicationVue);
361
		panneauCentre.setId(ComposantId.PANNEAU_FORM_PUBLICATION);
362
		panneauCentre.layout();
107 aurelien 363
	}
156 jp_milcent 364
 
245 jp_milcent 365
	public void clicModifierPublication(List<Publication> publicationListe) {
366
		if(publicationListe.size() <= 0) {
315 gduche 367
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null);
245 jp_milcent 368
		}
369
		else {
370
			Publication pubAModifier = publicationListe.get(publicationListe.size() -1);
371
			panneauCentre.removeAll();
372
			FormPublicationVue formPublicationVue = new FormPublicationVue();
373
			panneauCentre.add(formPublicationVue);
374
			panneauCentre.setId(ComposantId.PANNEAU_FORM_PUBLICATION);
375
			panneauCentre.layout();
376
			formPublicationVue.rafraichir(pubAModifier);
377
		}
378
 
379
	}
380
 
381
 
315 gduche 382
	public void clicSupprimerPublication(final List<Publication> publicationListe) {
245 jp_milcent 383
		if(publicationListe.size() <= 0) {
315 gduche 384
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null);
245 jp_milcent 385
		}
386
		else {
387
			String message = "" ;
388
			if(publicationListe.size() == 1) {
389
				message = "Voulez-vous vraiment supprimer cette publication ?";
390
			}
391
			else {
392
				message = "Voulez-vous vraiment supprimer ces publication ?";
393
			}
315 gduche 394
 
395
 
396
			final Listener listenerSuppression = new Listener<ComponentEvent>() {
397
				public void handleEvent(ComponentEvent ce) {
398
 
399
					Dialog dialog = (Dialog) ce.component;
400
				    Button btn = dialog.getButtonPressed();
401
 
402
				    if (btn.getText().equals(dialog.yesText))	{
403
				    	modele.supprimerPublication(contenuPanneauCentre, getUtilisateurId(),publicationListe);
404
				    }
405
				}
406
			};
407
 
408
			MessageBox.confirm("Supprimer une publication", message, listenerSuppression);
245 jp_milcent 409
		}
410
 
411
	}
412
 
277 jp_milcent 413
	public void ajouterPublication(FormPublicationVue formPublicationVue, Publication publi) {
414
		modele.ajouterPublication(contenuPanneauCentre, getUtilisateurId(),publi);
245 jp_milcent 415
	}
416
 
417
	public void modifierPublication(FormPublicationVue formPublicationVue, Publication publi) {
277 jp_milcent 418
		modele.modifierPublication(contenuPanneauCentre, getUtilisateurId(),publi);
245 jp_milcent 419
	}
420
 
277 jp_milcent 421
	public void clicObtenirListeEditeurs(Rafraichissable vue) {
422
		modele.selectionnerStructure(vue, null, null);
245 jp_milcent 423
 
424
	}
425
 
277 jp_milcent 426
	public void clicObtenirListeAuteurs(Rafraichissable vue) {
427
		modele.selectionnerPersonne(vue, null, null, null);
245 jp_milcent 428
	}
429
 
156 jp_milcent 430
	//+----------------------------------------------------------------------------------------------------------------+
431
	//												GESTION DES STRUCTURES
432
	//+----------------------------------------------------------------------------------------------------------------+
433
 
434
	public void clicListeInstitution(Structure institution) {
435
		((StructureDetailPanneauVue) Registry.get(RegistreId.PANNEAU_INSTITUTION_DETAIL)).rafraichir(institution);
436
	}
437
 
278 jp_milcent 438
	public void afficherListeStructures(StructureListe structuresACharger) {
156 jp_milcent 439
		// TODO : créer dès l'initialisation de l'application InsitutionVue et la cacher
440
		StructureVue institutionVue = new StructureVue();
441
		panneauCentre.add(institutionVue);
442
		panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_LISTE);
443
		contenuPanneauCentre = institutionVue;
278 jp_milcent 444
		institutionVue.rafraichir(structuresACharger);
156 jp_milcent 445
	}
446
 
447
	public void clicAjouterStructure() {
448
		panneauCentre.removeAll();
306 jp_milcent 449
		FormStructureVue formStructureVue = new FormStructureVue(FormStructureVue.MODE_AJOUTER);
156 jp_milcent 450
		panneauCentre.add(formStructureVue);
451
		panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_FORM);
452
		panneauCentre.layout();
453
	}
454
 
265 jp_milcent 455
	public void clicModifierStructure(List<Structure> structureSelection) {
456
		if (structureSelection.size() == 0) {
457
			Info.display("Information", "Veuillez sélectionner une structure.");
458
		} else if(structureSelection.size() > 1) {
459
			Info.display("Information", "Veuillez sélectionner une seule structure à la fois.");
460
		} else if(structureSelection.size() == 1) {
461
			panneauCentre.removeAll();
306 jp_milcent 462
			FormStructureVue formStructureVue = new FormStructureVue(FormStructureVue.MODE_MODIFIER);
265 jp_milcent 463
			panneauCentre.add(formStructureVue);
464
			panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_FORM);
465
 
466
			selectionnerStructure(formStructureVue, structureSelection.get(0).getId());
467
			selectionnerStructureAPersonne(formStructureVue, structureSelection.get(0).getId(), StructureAPersonne.ROLE_EQUIPE);
468
 
469
			panneauCentre.layout();
470
		} else {
471
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierStructure() du Médiateur.");
472
		}
473
 
119 jpm 474
	}
265 jp_milcent 475
 
315 gduche 476
	public void clicSupprimerStructure(final Rafraichissable vue, final List<Structure> structureSelection) {
156 jp_milcent 477
		if (structureSelection.size() == 0) {
478
			Info.display("Information", "Veuillez sélectionner une structure.");
479
		} else if(structureSelection.size() > 0) {
480
			String message = "Êtes vous sur de vouloir supprimer les structures sélectionnées ?";
481
			if (structureSelection.size() == 1) {
482
				message = "Êtes vous sur de vouloir supprimer la structure sélectionnée ?";
483
			}
315 gduche 484
 
485
 
486
			final Listener listenerSuppression = new Listener<ComponentEvent>() {
487
 
488
			       public void handleEvent(ComponentEvent ce) {
489
 
490
			    	   Dialog dialog = (Dialog) ce.component;
491
			    	   Button btn = dialog.getButtonPressed();
492
 
493
			    	   if (btn.getText().equals(dialog.yesText))	{
494
			    		   	String idStr = "" ;
495
							for(int i = 0 ; i < structureSelection.size() ; i++) {
496
								idStr += structureSelection.get(i).getId()+"," ;
497
							}
498
							modele.supprimerStructure(vue, getUtilisateurId(), idStr);
499
					       }
500
				      }
501
				     };
502
 
503
			MessageBox.confirm("Supprimer une structure", message, listenerSuppression);
504
 
134 jpm 505
		} else {
156 jp_milcent 506
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerStructure() du Médiateur.");
134 jpm 507
		}
508
	}
142 gduche 509
 
265 jp_milcent 510
	public void selectionnerStructure(Rafraichissable vue, String structureId) {
511
		GWT.log("Structure : "+structureId, null);
277 jp_milcent 512
		modele.selectionnerStructure(vue, null, structureId);
156 jp_milcent 513
	}
514
 
265 jp_milcent 515
	/**
516
	 * TODO : afficher un message du type "Structure ajoutée".
517
	 * Lance la creation d'une structure
518
	 * @param les données de la structure saisie
519
	 */
277 jp_milcent 520
	public void ajouterStructure(Rafraichissable vue, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
521
		modele.ajouterStructure(vue, getUtilisateurId(), structure, conservation, valorisation);
265 jp_milcent 522
	}
523
 
306 jp_milcent 524
	public void modifierStructure(Rafraichissable vue, String structureId, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
525
		modele.modifierStructure(vue, getUtilisateurId(), structureId, structure, conservation, valorisation);
156 jp_milcent 526
	}
231 jp_milcent 527
 
265 jp_milcent 528
	//+----------------------------------------------------------------------------------------------------------------+
529
	// GESTION de la relation STRUCTURE A PERSONNE
231 jp_milcent 530
	public void selectionnerStructureAPersonne(Rafraichissable vue, String structureId, String roleId) {
265 jp_milcent 531
		GWT.log("Structure : "+structureId, null);
532
		modele.selectionnerStructureAPersonne(vue, getUtilisateurId(), null, structureId, roleId);
231 jp_milcent 533
	}
156 jp_milcent 534
 
231 jp_milcent 535
	public void modifierStructureAPersonne(Rafraichissable vue, StructureAPersonneListe personnelModifie) {
536
		if (personnelModifie != null && personnelModifie.size() > 0) {
537
			GWT.log("Mediateur :modif", null);
538
			for (Iterator<String> it = personnelModifie.keySet().iterator(); it.hasNext();) {
539
				modele.modifierStructureAPersonne(vue, getUtilisateurId(), (StructureAPersonne) personnelModifie.get(it.next()));
540
			}
541
		}
542
	}
543
 
544
	public void ajouterStructureAPersonne(Rafraichissable vue, String structureId, StructureAPersonneListe personnelAjoute) {
545
		if (personnelAjoute != null && personnelAjoute.size() > 0) {
546
			for (Iterator<String> it = personnelAjoute.keySet().iterator(); it.hasNext();) {
547
				modele.ajouterStructureAPersonne(vue, getUtilisateurId(), structureId, (StructureAPersonne) personnelAjoute.get(it.next()));
548
			}
549
		}
550
	}
551
 
552
	public void supprimerStructureAPersonne(Rafraichissable vue, StructureAPersonneListe personnelSupprime) {
553
		if (personnelSupprime != null && personnelSupprime.size() > 0) {
554
			String idStrAPer = "" ;
555
			for (Iterator<String> it = personnelSupprime.keySet().iterator(); it.hasNext();) {
556
					idStrAPer += personnelSupprime.get(it.next()).getId()+"," ;
557
			}
558
			modele.supprimerStructureAPersonne(vue, getUtilisateurId(), idStrAPer);
559
		}
560
	}
561
 
156 jp_milcent 562
	//+----------------------------------------------------------------------------------------------------------------+
563
	//												GESTION des PROJETS
564
	//+----------------------------------------------------------------------------------------------------------------+
565
 
245 jp_milcent 566
	/**
567
	 * Retourne l'identifiant du projet courrant de l'application.
568
	 */
569
	public String getProjetId() {
277 jp_milcent 570
		String id = null;
571
		Projet projetCourant = (Projet) Registry.get(RegistreId.PROJET_COURANT);
279 jp_milcent 572
		if (projetCourant != null && !projetCourant.getId().equals("")) {
277 jp_milcent 573
			id = projetCourant.getId();
574
		}
575
		return id;
245 jp_milcent 576
	}
577
 
142 gduche 578
	//Greg : ajout d'un écouteur pour le changement liste projet
277 jp_milcent 579
	public void selectionnerProjets(Rafraichissable vue)	{
580
		modele.selectionnerProjets(vue);
142 gduche 581
	}
582
 
268 jp_milcent 583
	public void afficherListeProjets(ProjetListe projets)	{
277 jp_milcent 584
		panneauOuest.rafraichir(projets);
142 gduche 585
	}
159 gduche 586
 
277 jp_milcent 587
	public void selectionnerProjetCourant(Projet projetSelectionne) {
588
		Registry.register(RegistreId.PROJET_COURANT, projetSelectionne);
186 gduche 589
		if (contenuPanneauCentre instanceof PersonneVue)	{
277 jp_milcent 590
			modele.selectionnerPersonne(contenuPanneauCentre, null, getProjetId(), null);
186 gduche 591
			//FIXME Le rafraichissement du panneau ne se fait pas!
277 jp_milcent 592
		} else if (contenuPanneauCentre instanceof StructureVue)	{
593
			modele.obtenirListeStructures(contenuPanneauCentre, getProjetId());
186 gduche 594
		}
159 gduche 595
	}
237 aurelien 596
 
277 jp_milcent 597
	//+----------------------------------------------------------------------------------------------------------------+
598
	//	RAFRAICHISSEMENT
599
	//+----------------------------------------------------------------------------------------------------------------+
600
 
601
	public void rafraichir(Object nouvelleDonnees) {
602
		if (nouvelleDonnees instanceof Utilisateur) {
603
			mettreAJourEtatIdentification((Utilisateur) nouvelleDonnees);
278 jp_milcent 604
		} else {
605
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
277 jp_milcent 606
		}
607
	}
281 gduche 608
 
609
	/**
610
	 * Récupère la liste et rafraichit la vue donnée
611
	 *
612
	 * @param la vue à rafraichir
613
	 * @param l'id de la liste à récupérer
614
	 * */
615
	public void obtenirListeValeurEtRafraichir(Rafraichissable vue, String strListeId)	{
616
 
617
		modele.obtenirListeValeurs(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId));
618
	}
288 gduche 619
 
301 gduche 620
	public void obtenirValeurEtRafraichir(Rafraichissable vue, String strListeId, String identifiantValeur)	{
621
 
622
		modele.obtenirValeur(vue, "abv", ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), identifiantValeur);
623
	}
624
 
288 gduche 625
	public void obtenirListeRegionsEtRafraichir(Rafraichissable vue, String strListeId, String strPays)	{
626
		modele.obtenirListeRegion(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), strPays+".__");
627
	}
332 gduche 628
 
629
	/**
630
	 * 	Affiche la popin de chargement
631
	 */
632
	public void afficherPopinChargement()	{
633
 
634
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).center();
635
 
636
	}
637
 
638
 
639
	public void masquerPopinChargement()	{
640
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).hide();
641
 
642
	}
277 jp_milcent 643
}