Subversion Repositories eFlore/Applications.coel

Rev

Rev 332 | Rev 347 | 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 = "" ;
301
						for(int i = 0 ; i < personneSelection.size() ; i++) {
302
							idStr += personneSelection.get(i).getId()+"," ;
303
						}
329 jp_milcent 304
						modele.supprimerPersonne(vue, idStr);
327 jp_milcent 305
					}
306
				}
307
			};
315 gduche 308
 
309
			MessageBox.confirm("Supprimer une personne", message, listenerSuppression);
310
 
311
 
245 jp_milcent 312
		} else {
313
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerPersonne() du Médiateur.");
314
		}
315
	}
277 jp_milcent 316
 
317
	public void selectionnerPersonneParNomComplet(Rafraichissable vue, String projetId, String nomComplet) {
318
		modele.selectionnerPersonne(vue, null, projetId, nomComplet);
319
	}
245 jp_milcent 320
 
156 jp_milcent 321
	//+----------------------------------------------------------------------------------------------------------------+
322
	//												GESTION DES VALEURS ET LISTES
323
	//+----------------------------------------------------------------------------------------------------------------+
324
 
91 jpm 325
	public void afficherListeValeurs(ValeurListe nouvelleDonnees) {
156 jp_milcent 326
		if (panneauCentre.getId().equals(ComposantId.PANNEAU_STRUCTURE_FORM)) {
91 jpm 327
			((FormStructureVue) panneauCentre.getItem(0)).rafraichir(nouvelleDonnees);
328
		} else {
329
			GWT.log("Aucun panneau trouvé pour afficher la liste de valeur", null);
330
		}
331
	}
332
 
156 jp_milcent 333
	//+----------------------------------------------------------------------------------------------------------------+
334
	//												GESTION DES PUBLICATIONS
335
	//+----------------------------------------------------------------------------------------------------------------+
336
 
107 aurelien 337
	public void afficherListePublication(PublicationListe nouvelleDonnees) {
338
		PublicationVue publicationVue = new PublicationVue() ;
228 aurelien 339
		panneauCentre.removeAll();
107 aurelien 340
		panneauCentre.add(publicationVue);
186 gduche 341
		contenuPanneauCentre = publicationVue;
107 aurelien 342
		publicationVue.rafraichir(nouvelleDonnees);
343
 
344
	}
345
 
346
	public void clicListePublication(Publication publication) {
347
 
348
		((PublicationDetailPanneauVue) Registry.get(RegistreId.PANNEAU_PUBLICATION_DETAIL)).rafraichir(publication);
349
	}
350
 
351
	public void clicAjouterPublication() {
223 aurelien 352
		panneauCentre.removeAll();
353
		FormPublicationVue formPublicationVue = new FormPublicationVue();
354
		panneauCentre.add(formPublicationVue);
355
		panneauCentre.setId(ComposantId.PANNEAU_FORM_PUBLICATION);
356
		panneauCentre.layout();
107 aurelien 357
	}
156 jp_milcent 358
 
245 jp_milcent 359
	public void clicModifierPublication(List<Publication> publicationListe) {
360
		if(publicationListe.size() <= 0) {
315 gduche 361
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null);
245 jp_milcent 362
		}
363
		else {
364
			Publication pubAModifier = publicationListe.get(publicationListe.size() -1);
365
			panneauCentre.removeAll();
366
			FormPublicationVue formPublicationVue = new FormPublicationVue();
367
			panneauCentre.add(formPublicationVue);
368
			panneauCentre.setId(ComposantId.PANNEAU_FORM_PUBLICATION);
369
			panneauCentre.layout();
370
			formPublicationVue.rafraichir(pubAModifier);
371
		}
372
 
373
	}
374
 
375
 
315 gduche 376
	public void clicSupprimerPublication(final List<Publication> publicationListe) {
245 jp_milcent 377
		if(publicationListe.size() <= 0) {
315 gduche 378
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null);
245 jp_milcent 379
		}
380
		else {
381
			String message = "" ;
382
			if(publicationListe.size() == 1) {
383
				message = "Voulez-vous vraiment supprimer cette publication ?";
384
			}
385
			else {
386
				message = "Voulez-vous vraiment supprimer ces publication ?";
387
			}
315 gduche 388
 
389
 
390
			final Listener listenerSuppression = new Listener<ComponentEvent>() {
391
				public void handleEvent(ComponentEvent ce) {
392
 
393
					Dialog dialog = (Dialog) ce.component;
394
				    Button btn = dialog.getButtonPressed();
395
 
396
				    if (btn.getText().equals(dialog.yesText))	{
397
				    	modele.supprimerPublication(contenuPanneauCentre, getUtilisateurId(),publicationListe);
398
				    }
399
				}
400
			};
401
 
402
			MessageBox.confirm("Supprimer une publication", message, listenerSuppression);
245 jp_milcent 403
		}
404
 
405
	}
406
 
277 jp_milcent 407
	public void ajouterPublication(FormPublicationVue formPublicationVue, Publication publi) {
408
		modele.ajouterPublication(contenuPanneauCentre, getUtilisateurId(),publi);
245 jp_milcent 409
	}
410
 
411
	public void modifierPublication(FormPublicationVue formPublicationVue, Publication publi) {
277 jp_milcent 412
		modele.modifierPublication(contenuPanneauCentre, getUtilisateurId(),publi);
245 jp_milcent 413
	}
414
 
277 jp_milcent 415
	public void clicObtenirListeEditeurs(Rafraichissable vue) {
416
		modele.selectionnerStructure(vue, null, null);
245 jp_milcent 417
 
418
	}
419
 
277 jp_milcent 420
	public void clicObtenirListeAuteurs(Rafraichissable vue) {
421
		modele.selectionnerPersonne(vue, null, null, null);
245 jp_milcent 422
	}
423
 
156 jp_milcent 424
	//+----------------------------------------------------------------------------------------------------------------+
425
	//												GESTION DES STRUCTURES
426
	//+----------------------------------------------------------------------------------------------------------------+
427
 
428
	public void clicListeInstitution(Structure institution) {
429
		((StructureDetailPanneauVue) Registry.get(RegistreId.PANNEAU_INSTITUTION_DETAIL)).rafraichir(institution);
430
	}
431
 
278 jp_milcent 432
	public void afficherListeStructures(StructureListe structuresACharger) {
156 jp_milcent 433
		// TODO : créer dès l'initialisation de l'application InsitutionVue et la cacher
434
		StructureVue institutionVue = new StructureVue();
435
		panneauCentre.add(institutionVue);
436
		panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_LISTE);
437
		contenuPanneauCentre = institutionVue;
278 jp_milcent 438
		institutionVue.rafraichir(structuresACharger);
156 jp_milcent 439
	}
440
 
441
	public void clicAjouterStructure() {
442
		panneauCentre.removeAll();
306 jp_milcent 443
		FormStructureVue formStructureVue = new FormStructureVue(FormStructureVue.MODE_AJOUTER);
156 jp_milcent 444
		panneauCentre.add(formStructureVue);
445
		panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_FORM);
446
		panneauCentre.layout();
447
	}
448
 
265 jp_milcent 449
	public void clicModifierStructure(List<Structure> structureSelection) {
450
		if (structureSelection.size() == 0) {
451
			Info.display("Information", "Veuillez sélectionner une structure.");
452
		} else if(structureSelection.size() > 1) {
453
			Info.display("Information", "Veuillez sélectionner une seule structure à la fois.");
454
		} else if(structureSelection.size() == 1) {
455
			panneauCentre.removeAll();
306 jp_milcent 456
			FormStructureVue formStructureVue = new FormStructureVue(FormStructureVue.MODE_MODIFIER);
265 jp_milcent 457
			panneauCentre.add(formStructureVue);
458
			panneauCentre.setId(ComposantId.PANNEAU_STRUCTURE_FORM);
459
 
460
			selectionnerStructure(formStructureVue, structureSelection.get(0).getId());
461
			selectionnerStructureAPersonne(formStructureVue, structureSelection.get(0).getId(), StructureAPersonne.ROLE_EQUIPE);
462
 
463
			panneauCentre.layout();
464
		} else {
465
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierStructure() du Médiateur.");
466
		}
467
 
119 jpm 468
	}
265 jp_milcent 469
 
315 gduche 470
	public void clicSupprimerStructure(final Rafraichissable vue, final List<Structure> structureSelection) {
156 jp_milcent 471
		if (structureSelection.size() == 0) {
472
			Info.display("Information", "Veuillez sélectionner une structure.");
473
		} else if(structureSelection.size() > 0) {
474
			String message = "Êtes vous sur de vouloir supprimer les structures sélectionnées ?";
475
			if (structureSelection.size() == 1) {
476
				message = "Êtes vous sur de vouloir supprimer la structure sélectionnée ?";
477
			}
315 gduche 478
 
479
 
480
			final Listener listenerSuppression = new Listener<ComponentEvent>() {
481
 
482
			       public void handleEvent(ComponentEvent ce) {
483
 
484
			    	   Dialog dialog = (Dialog) ce.component;
485
			    	   Button btn = dialog.getButtonPressed();
486
 
487
			    	   if (btn.getText().equals(dialog.yesText))	{
488
			    		   	String idStr = "" ;
489
							for(int i = 0 ; i < structureSelection.size() ; i++) {
490
								idStr += structureSelection.get(i).getId()+"," ;
491
							}
492
							modele.supprimerStructure(vue, getUtilisateurId(), idStr);
493
					       }
494
				      }
495
				     };
496
 
497
			MessageBox.confirm("Supprimer une structure", message, listenerSuppression);
498
 
134 jpm 499
		} else {
156 jp_milcent 500
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerStructure() du Médiateur.");
134 jpm 501
		}
502
	}
142 gduche 503
 
265 jp_milcent 504
	public void selectionnerStructure(Rafraichissable vue, String structureId) {
505
		GWT.log("Structure : "+structureId, null);
277 jp_milcent 506
		modele.selectionnerStructure(vue, null, structureId);
156 jp_milcent 507
	}
508
 
265 jp_milcent 509
	/**
510
	 * TODO : afficher un message du type "Structure ajoutée".
511
	 * Lance la creation d'une structure
512
	 * @param les données de la structure saisie
513
	 */
277 jp_milcent 514
	public void ajouterStructure(Rafraichissable vue, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
515
		modele.ajouterStructure(vue, getUtilisateurId(), structure, conservation, valorisation);
265 jp_milcent 516
	}
517
 
306 jp_milcent 518
	public void modifierStructure(Rafraichissable vue, String structureId, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
519
		modele.modifierStructure(vue, getUtilisateurId(), structureId, structure, conservation, valorisation);
156 jp_milcent 520
	}
231 jp_milcent 521
 
265 jp_milcent 522
	//+----------------------------------------------------------------------------------------------------------------+
523
	// GESTION de la relation STRUCTURE A PERSONNE
231 jp_milcent 524
	public void selectionnerStructureAPersonne(Rafraichissable vue, String structureId, String roleId) {
265 jp_milcent 525
		GWT.log("Structure : "+structureId, null);
526
		modele.selectionnerStructureAPersonne(vue, getUtilisateurId(), null, structureId, roleId);
231 jp_milcent 527
	}
156 jp_milcent 528
 
231 jp_milcent 529
	public void modifierStructureAPersonne(Rafraichissable vue, StructureAPersonneListe personnelModifie) {
530
		if (personnelModifie != null && personnelModifie.size() > 0) {
531
			GWT.log("Mediateur :modif", null);
532
			for (Iterator<String> it = personnelModifie.keySet().iterator(); it.hasNext();) {
533
				modele.modifierStructureAPersonne(vue, getUtilisateurId(), (StructureAPersonne) personnelModifie.get(it.next()));
534
			}
535
		}
536
	}
537
 
538
	public void ajouterStructureAPersonne(Rafraichissable vue, String structureId, StructureAPersonneListe personnelAjoute) {
539
		if (personnelAjoute != null && personnelAjoute.size() > 0) {
540
			for (Iterator<String> it = personnelAjoute.keySet().iterator(); it.hasNext();) {
541
				modele.ajouterStructureAPersonne(vue, getUtilisateurId(), structureId, (StructureAPersonne) personnelAjoute.get(it.next()));
542
			}
543
		}
544
	}
545
 
546
	public void supprimerStructureAPersonne(Rafraichissable vue, StructureAPersonneListe personnelSupprime) {
547
		if (personnelSupprime != null && personnelSupprime.size() > 0) {
548
			String idStrAPer = "" ;
549
			for (Iterator<String> it = personnelSupprime.keySet().iterator(); it.hasNext();) {
550
					idStrAPer += personnelSupprime.get(it.next()).getId()+"," ;
551
			}
552
			modele.supprimerStructureAPersonne(vue, getUtilisateurId(), idStrAPer);
553
		}
554
	}
555
 
156 jp_milcent 556
	//+----------------------------------------------------------------------------------------------------------------+
557
	//												GESTION des PROJETS
558
	//+----------------------------------------------------------------------------------------------------------------+
559
 
245 jp_milcent 560
	/**
561
	 * Retourne l'identifiant du projet courrant de l'application.
562
	 */
563
	public String getProjetId() {
277 jp_milcent 564
		String id = null;
565
		Projet projetCourant = (Projet) Registry.get(RegistreId.PROJET_COURANT);
279 jp_milcent 566
		if (projetCourant != null && !projetCourant.getId().equals("")) {
277 jp_milcent 567
			id = projetCourant.getId();
568
		}
569
		return id;
245 jp_milcent 570
	}
571
 
142 gduche 572
	//Greg : ajout d'un écouteur pour le changement liste projet
277 jp_milcent 573
	public void selectionnerProjets(Rafraichissable vue)	{
574
		modele.selectionnerProjets(vue);
142 gduche 575
	}
576
 
268 jp_milcent 577
	public void afficherListeProjets(ProjetListe projets)	{
277 jp_milcent 578
		panneauOuest.rafraichir(projets);
142 gduche 579
	}
159 gduche 580
 
277 jp_milcent 581
	public void selectionnerProjetCourant(Projet projetSelectionne) {
582
		Registry.register(RegistreId.PROJET_COURANT, projetSelectionne);
186 gduche 583
		if (contenuPanneauCentre instanceof PersonneVue)	{
277 jp_milcent 584
			modele.selectionnerPersonne(contenuPanneauCentre, null, getProjetId(), null);
186 gduche 585
			//FIXME Le rafraichissement du panneau ne se fait pas!
277 jp_milcent 586
		} else if (contenuPanneauCentre instanceof StructureVue)	{
587
			modele.obtenirListeStructures(contenuPanneauCentre, getProjetId());
186 gduche 588
		}
159 gduche 589
	}
237 aurelien 590
 
277 jp_milcent 591
	//+----------------------------------------------------------------------------------------------------------------+
592
	//	RAFRAICHISSEMENT
593
	//+----------------------------------------------------------------------------------------------------------------+
594
 
595
	public void rafraichir(Object nouvelleDonnees) {
596
		if (nouvelleDonnees instanceof Utilisateur) {
597
			mettreAJourEtatIdentification((Utilisateur) nouvelleDonnees);
278 jp_milcent 598
		} else {
599
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
277 jp_milcent 600
		}
601
	}
281 gduche 602
 
603
	/**
604
	 * Récupère la liste et rafraichit la vue donnée
605
	 *
606
	 * @param la vue à rafraichir
607
	 * @param l'id de la liste à récupérer
608
	 * */
609
	public void obtenirListeValeurEtRafraichir(Rafraichissable vue, String strListeId)	{
610
 
611
		modele.obtenirListeValeurs(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId));
612
	}
288 gduche 613
 
301 gduche 614
	public void obtenirValeurEtRafraichir(Rafraichissable vue, String strListeId, String identifiantValeur)	{
615
 
616
		modele.obtenirValeur(vue, "abv", ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), identifiantValeur);
617
	}
618
 
288 gduche 619
	public void obtenirListeRegionsEtRafraichir(Rafraichissable vue, String strListeId, String strPays)	{
620
		modele.obtenirListeRegion(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), strPays+".__");
621
	}
332 gduche 622
 
623
	/**
624
	 * 	Affiche la popin de chargement
625
	 */
626
	public void afficherPopinChargement()	{
627
 
628
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).center();
629
 
630
	}
631
 
632
 
633
	public void masquerPopinChargement()	{
634
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).hide();
635
 
636
	}
277 jp_milcent 637
}