Subversion Repositories eFlore/Applications.coel

Rev

Rev 997 | Rev 1017 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 997 Rev 1014
1
package org.tela_botanica.client;
1
package org.tela_botanica.client;
2
 
2
 
3
import java.util.Iterator;
3
import java.util.Iterator;
4
import java.util.List;
4
import java.util.List;
5
 
5
 
6
import org.tela_botanica.client.composants.AideFenetre;
6
import org.tela_botanica.client.composants.AideFenetre;
7
import org.tela_botanica.client.composants.IdentificationFenetre;
7
import org.tela_botanica.client.composants.IdentificationFenetre;
8
import org.tela_botanica.client.composants.LicenceFenetre;
8
import org.tela_botanica.client.composants.LicenceFenetre;
9
import org.tela_botanica.client.composants.ParametreFenetre;
9
import org.tela_botanica.client.composants.ParametreFenetre;
10
import org.tela_botanica.client.configuration.APropos;
10
import org.tela_botanica.client.configuration.APropos;
11
import org.tela_botanica.client.configuration.Configuration;
11
import org.tela_botanica.client.configuration.Configuration;
12
import org.tela_botanica.client.i18n.Constantes;
12
import org.tela_botanica.client.i18n.Constantes;
13
import org.tela_botanica.client.i18n.ErrorMessages;
13
import org.tela_botanica.client.i18n.ErrorMessages;
14
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.interfaces.Rafraichissable;
15
import org.tela_botanica.client.modeles.Information;
15
import org.tela_botanica.client.modeles.Information;
16
import org.tela_botanica.client.modeles.MenuApplicationId;
16
import org.tela_botanica.client.modeles.MenuApplicationId;
17
import org.tela_botanica.client.modeles.Utilisateur;
17
import org.tela_botanica.client.modeles.Utilisateur;
-
 
18
import org.tela_botanica.client.modeles.Valeur;
18
import org.tela_botanica.client.modeles.ValeurListe;
19
import org.tela_botanica.client.modeles.ValeurListe;
19
import org.tela_botanica.client.modeles.collection.Collection;
20
import org.tela_botanica.client.modeles.collection.Collection;
20
import org.tela_botanica.client.modeles.collection.CollectionACommentaire;
21
import org.tela_botanica.client.modeles.collection.CollectionACommentaire;
21
import org.tela_botanica.client.modeles.collection.CollectionACommentaireAsyncDao;
22
import org.tela_botanica.client.modeles.collection.CollectionACommentaireAsyncDao;
22
import org.tela_botanica.client.modeles.collection.CollectionACommentaireListe;
23
import org.tela_botanica.client.modeles.collection.CollectionACommentaireListe;
23
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
24
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
24
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
25
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
25
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
26
import org.tela_botanica.client.modeles.collection.CollectionAPublication;
26
import org.tela_botanica.client.modeles.collection.CollectionAPublicationListe;
27
import org.tela_botanica.client.modeles.collection.CollectionAPublicationListe;
27
import org.tela_botanica.client.modeles.collection.CollectionListe;
28
import org.tela_botanica.client.modeles.collection.CollectionListe;
28
import org.tela_botanica.client.modeles.commentaire.Commentaire;
29
import org.tela_botanica.client.modeles.commentaire.Commentaire;
29
import org.tela_botanica.client.modeles.commentaire.CommentaireListe;
30
import org.tela_botanica.client.modeles.commentaire.CommentaireListe;
30
import org.tela_botanica.client.modeles.personne.Personne;
31
import org.tela_botanica.client.modeles.personne.Personne;
31
import org.tela_botanica.client.modeles.personne.PersonneListe;
32
import org.tela_botanica.client.modeles.personne.PersonneListe;
32
import org.tela_botanica.client.modeles.projet.Projet;
33
import org.tela_botanica.client.modeles.projet.Projet;
33
import org.tela_botanica.client.modeles.projet.ProjetListe;
34
import org.tela_botanica.client.modeles.projet.ProjetListe;
34
import org.tela_botanica.client.modeles.publication.Publication;
35
import org.tela_botanica.client.modeles.publication.Publication;
35
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
36
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
36
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
37
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
37
import org.tela_botanica.client.modeles.publication.PublicationListe;
38
import org.tela_botanica.client.modeles.publication.PublicationListe;
38
import org.tela_botanica.client.modeles.structure.Structure;
39
import org.tela_botanica.client.modeles.structure.Structure;
39
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
40
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
40
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
41
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
41
import org.tela_botanica.client.modeles.structure.StructureConservation;
42
import org.tela_botanica.client.modeles.structure.StructureConservation;
42
import org.tela_botanica.client.modeles.structure.StructureListe;
43
import org.tela_botanica.client.modeles.structure.StructureListe;
43
import org.tela_botanica.client.modeles.structure.StructureValorisation;
44
import org.tela_botanica.client.modeles.structure.StructureValorisation;
44
import org.tela_botanica.client.util.Debug;
45
import org.tela_botanica.client.util.Debug;
45
import org.tela_botanica.client.vues.ContenuVue;
46
import org.tela_botanica.client.vues.ContenuVue;
46
import org.tela_botanica.client.vues.EnteteVue;
47
import org.tela_botanica.client.vues.EnteteVue;
47
import org.tela_botanica.client.vues.Formulaire;
48
import org.tela_botanica.client.vues.Formulaire;
48
import org.tela_botanica.client.vues.NavigationVue;
49
import org.tela_botanica.client.vues.NavigationVue;
49
import org.tela_botanica.client.vues.PopupChargement;
50
import org.tela_botanica.client.vues.PopupChargement;
50
import org.tela_botanica.client.vues.StatutVue;
51
import org.tela_botanica.client.vues.StatutVue;
51
import org.tela_botanica.client.vues.MenuVue;
52
import org.tela_botanica.client.vues.MenuVue;
52
import org.tela_botanica.client.vues.accueil.AccueilVue;
53
import org.tela_botanica.client.vues.accueil.AccueilVue;
53
import org.tela_botanica.client.vues.collection.CollectionForm;
54
import org.tela_botanica.client.vues.collection.CollectionForm;
54
import org.tela_botanica.client.vues.collection.CollectionListeVue;
55
import org.tela_botanica.client.vues.collection.CollectionListeVue;
55
import org.tela_botanica.client.vues.collection.CollectionVue;
56
import org.tela_botanica.client.vues.collection.CollectionVue;
56
import org.tela_botanica.client.vues.commentaire.CommentaireForm;
57
import org.tela_botanica.client.vues.commentaire.CommentaireForm;
57
import org.tela_botanica.client.vues.commentaire.CommentaireVue;
58
import org.tela_botanica.client.vues.commentaire.CommentaireVue;
58
import org.tela_botanica.client.vues.personne.PersonneForm;
59
import org.tela_botanica.client.vues.personne.PersonneForm;
59
import org.tela_botanica.client.vues.personne.PersonneVue;
60
import org.tela_botanica.client.vues.personne.PersonneVue;
60
import org.tela_botanica.client.vues.projet.ProjetForm;
61
import org.tela_botanica.client.vues.projet.ProjetForm;
61
import org.tela_botanica.client.vues.projet.ProjetVue;
62
import org.tela_botanica.client.vues.projet.ProjetVue;
62
import org.tela_botanica.client.vues.publication.PublicationForm;
63
import org.tela_botanica.client.vues.publication.PublicationForm;
63
import org.tela_botanica.client.vues.publication.PublicationVue;
64
import org.tela_botanica.client.vues.publication.PublicationVue;
64
import org.tela_botanica.client.vues.structure.StructureForm;
65
import org.tela_botanica.client.vues.structure.StructureForm;
65
import org.tela_botanica.client.vues.structure.StructureVue;
66
import org.tela_botanica.client.vues.structure.StructureVue;
66
 
67
 
67
import com.extjs.gxt.ui.client.Registry;
68
import com.extjs.gxt.ui.client.Registry;
68
import com.extjs.gxt.ui.client.Style.LayoutRegion;
69
import com.extjs.gxt.ui.client.Style.LayoutRegion;
69
import com.extjs.gxt.ui.client.event.Listener;
70
import com.extjs.gxt.ui.client.event.Listener;
70
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
71
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
71
import com.extjs.gxt.ui.client.util.Margins;
72
import com.extjs.gxt.ui.client.util.Margins;
72
import com.extjs.gxt.ui.client.widget.Component;
73
import com.extjs.gxt.ui.client.widget.Component;
73
import com.extjs.gxt.ui.client.widget.Dialog;
74
import com.extjs.gxt.ui.client.widget.Dialog;
74
import com.extjs.gxt.ui.client.widget.Info;
75
import com.extjs.gxt.ui.client.widget.Info;
75
import com.extjs.gxt.ui.client.widget.MessageBox;
76
import com.extjs.gxt.ui.client.widget.MessageBox;
76
import com.extjs.gxt.ui.client.widget.Viewport;
77
import com.extjs.gxt.ui.client.widget.Viewport;
77
import com.extjs.gxt.ui.client.widget.button.Button;
78
import com.extjs.gxt.ui.client.widget.button.Button;
78
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
79
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
79
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
80
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
80
import com.google.gwt.core.client.GWT;
81
import com.google.gwt.core.client.GWT;
81
import com.google.gwt.i18n.client.Dictionary;
82
import com.google.gwt.i18n.client.Dictionary;
82
import com.google.gwt.user.client.Window;
83
import com.google.gwt.user.client.Window;
83
import com.google.gwt.user.client.ui.RootPanel;
84
import com.google.gwt.user.client.ui.RootPanel;
84
 
85
 
85
public class Mediateur implements Rafraichissable {
86
public class Mediateur implements Rafraichissable {
86
	
87
	
87
	private Viewport viewport;
88
	private Viewport viewport;
88
	private Modele modele = null;
89
	private Modele modele = null;
89
	public static final Constantes i18nC = getI18nConstante();
90
	public static final Constantes i18nC = getI18nConstante();
90
	public static final ErrorMessages i18nM = getI18nMessage();
91
	public static final ErrorMessages i18nM = getI18nMessage();
91
	
92
	
92
	private EnteteVue panneauNord = null;
93
	private EnteteVue panneauNord = null;
93
	private NavigationVue panneauOuest = null;
94
	private NavigationVue panneauOuest = null;
94
	private ContenuVue panneauCentre = null;
95
	private ContenuVue panneauCentre = null;
95
	private StatutVue panneauSud = null;
96
	private StatutVue panneauSud = null;
96
	
97
	
97
	private IdentificationFenetre fenetreIdentification = null;
98
	private IdentificationFenetre fenetreIdentification = null;
98
	
99
	
99
	public Mediateur() {
100
	public Mediateur() {
100
		// Enregistrement du Médiateur dans le Registre
101
		// Enregistrement du Médiateur dans le Registre
101
		Registry.register(RegistreId.MEDIATEUR, this);
102
		Registry.register(RegistreId.MEDIATEUR, this);
102
 
103
 
103
		//Initialisation du Registre
104
		//Initialisation du Registre
104
		initialiserRegistre();
105
		initialiserRegistre();
105
		
106
		
106
		// Création du Modèle qui s'enregistre lui même dans le Registre
107
		// Création du Modèle qui s'enregistre lui même dans le Registre
107
		modele = new Modele();
108
		modele = new Modele();
108
 
109
 
109
		// Création du Viewport qui contient la disposition globale de l'application
110
		// Création du Viewport qui contient la disposition globale de l'application
110
		viewport = new Viewport();
111
		viewport = new Viewport();
111
		viewport.setLayout(new BorderLayout());
112
		viewport.setLayout(new BorderLayout());
112
 
113
 
113
		// Création des différents panneaux
114
		// Création des différents panneaux
114
	    creerPanneauNord();
115
	    creerPanneauNord();
115
	    creerPanneauOuest();
116
	    creerPanneauOuest();
116
	    creerPanneauCentral();
117
	    creerPanneauCentral();
117
	    creerPanneauSud();
118
	    creerPanneauSud();
118
		
119
		
119
		// Connection de l'utilisateur
120
		// Connection de l'utilisateur
120
		connecterUtilisateur(null, null);
121
		connecterUtilisateur(null, null);
121
		
122
		
122
		// Retour à GWT du Viewport une fois constuit
123
		// Retour à GWT du Viewport une fois constuit
123
		RootPanel.get().add(viewport);
124
		RootPanel.get().add(viewport);
124
	}
125
	}
125
	
126
	
126
	//+----------------------------------------------------------------------------------------------------------------+
127
	//+----------------------------------------------------------------------------------------------------------------+
127
	//												GESTION de l'I18N et du REGISTRE
128
	//												GESTION de l'I18N et du REGISTRE
128
	//+----------------------------------------------------------------------------------------------------------------+
129
	//+----------------------------------------------------------------------------------------------------------------+
129
	protected static Constantes getI18nConstante() {
130
	protected static Constantes getI18nConstante() {
130
		return GWT.create(Constantes.class);
131
		return GWT.create(Constantes.class);
131
	}
132
	}
132
	
133
	
133
	protected static ErrorMessages getI18nMessage() {
134
	protected static ErrorMessages getI18nMessage() {
134
		return GWT.create(ErrorMessages.class);
135
		return GWT.create(ErrorMessages.class);
135
	}
136
	}
136
	
137
	
137
	protected void initialiserRegistre() {
138
	protected void initialiserRegistre() {
138
		Registry.register(RegistreId.APPLI_NOM, i18nC.appliNom());
139
		Registry.register(RegistreId.APPLI_NOM, i18nC.appliNom());
139
		Registry.register(RegistreId.APPLI_CODE, i18nC.appliCode());
140
		Registry.register(RegistreId.APPLI_CODE, i18nC.appliCode());
140
		Registry.register(RegistreId.APPLI_VERSION, i18nC.appliVersionNumero());
141
		Registry.register(RegistreId.APPLI_VERSION, i18nC.appliVersionNumero());
141
		
142
		
142
		APropos apropos = new APropos();
143
		APropos apropos = new APropos();
143
		Registry.register(RegistreId.APPLI_REVISION, apropos.getRevisionGlobale());
144
		Registry.register(RegistreId.APPLI_REVISION, apropos.getRevisionGlobale());
144
		Registry.register(RegistreId.APPLI_COMPILATION_JAVA_VERSION, apropos.getVersionJavaCompilation());
145
		Registry.register(RegistreId.APPLI_COMPILATION_JAVA_VERSION, apropos.getVersionJavaCompilation());
145
		Registry.register(RegistreId.APPLI_COMPILATION_DATE_HEURE, apropos.getDateHeureCompilation());
146
		Registry.register(RegistreId.APPLI_COMPILATION_DATE_HEURE, apropos.getDateHeureCompilation());
146
 
147
 
147
		Registry.register(RegistreId.CONFIG, new Configuration());
148
		Registry.register(RegistreId.CONFIG, new Configuration());
148
		Registry.register(RegistreId.POPUP_CHARGEMENT, new PopupChargement(this));
149
		Registry.register(RegistreId.POPUP_CHARGEMENT, new PopupChargement(this));
149
		Registry.register(RegistreId.UTILISATEUR_COURANT, new Utilisateur());
150
		Registry.register(RegistreId.UTILISATEUR_COURANT, new Utilisateur());
150
		Registry.register(RegistreId.PROJET_COURANT, new Projet());
151
		Registry.register(RegistreId.PROJET_COURANT, new Projet());
151
	}
152
	}
152
	
153
	
153
	//+----------------------------------------------------------------------------------------------------------------+
154
	//+----------------------------------------------------------------------------------------------------------------+
154
	//												GESTION des PANNEAUX PRINCIPAUX
155
	//												GESTION des PANNEAUX PRINCIPAUX
155
	//+----------------------------------------------------------------------------------------------------------------+
156
	//+----------------------------------------------------------------------------------------------------------------+
156
	
157
	
157
	private void creerPanneauNord() {
158
	private void creerPanneauNord() {
158
		panneauNord = new EnteteVue(this);
159
		panneauNord = new EnteteVue(this);
159
		
160
		
160
		BorderLayoutData regionNord = new BorderLayoutData(LayoutRegion.NORTH, 100);  
161
		BorderLayoutData regionNord = new BorderLayoutData(LayoutRegion.NORTH, 100);  
161
		regionNord.setCollapsible(true);
162
		regionNord.setCollapsible(true);
162
		regionNord.setFloatable(true);
163
		regionNord.setFloatable(true);
163
		regionNord.setSplit(false);
164
		regionNord.setSplit(false);
164
		regionNord.setMargins(new Margins(5, 5, 0, 5));
165
		regionNord.setMargins(new Margins(5, 5, 0, 5));
165
		
166
		
166
		viewport.add(panneauNord, regionNord);
167
		viewport.add(panneauNord, regionNord);
167
	}
168
	}
168
	
169
	
169
	private void creerPanneauOuest() {
170
	private void creerPanneauOuest() {
170
		panneauOuest = new NavigationVue(this); 
171
		panneauOuest = new NavigationVue(this); 
171
		
172
		
172
		BorderLayoutData regionOuest = new BorderLayoutData(LayoutRegion.WEST, 200);  
173
		BorderLayoutData regionOuest = new BorderLayoutData(LayoutRegion.WEST, 200);  
173
		regionOuest.setSplit(true);
174
		regionOuest.setSplit(true);
174
		regionOuest.setCollapsible(true);  
175
		regionOuest.setCollapsible(true);  
175
		regionOuest.setMargins(new Margins(5));
176
		regionOuest.setMargins(new Margins(5));
176
 
177
 
177
		viewport.add(panneauOuest, regionOuest);
178
		viewport.add(panneauOuest, regionOuest);
178
	}
179
	}
179
 
180
 
180
	private void creerPanneauCentral() {
181
	private void creerPanneauCentral() {
181
		panneauCentre = new ContenuVue(this);
182
		panneauCentre = new ContenuVue(this);
182
 
183
 
183
		BorderLayoutData regionCentre = new BorderLayoutData(LayoutRegion.CENTER);  
184
		BorderLayoutData regionCentre = new BorderLayoutData(LayoutRegion.CENTER);  
184
		regionCentre.setMargins(new Margins(5, 5, 5, 0));
185
		regionCentre.setMargins(new Margins(5, 5, 5, 0));
185
 
186
 
186
		viewport.add(panneauCentre, regionCentre);
187
		viewport.add(panneauCentre, regionCentre);
187
	}
188
	}
188
	
189
	
189
	private void creerPanneauSud() {
190
	private void creerPanneauSud() {
190
		panneauSud = new StatutVue();
191
		panneauSud = new StatutVue();
191
		
192
		
192
		BorderLayoutData regionSud = new BorderLayoutData(LayoutRegion.SOUTH, 20); 
193
		BorderLayoutData regionSud = new BorderLayoutData(LayoutRegion.SOUTH, 20); 
193
		regionSud.setCollapsible(true);
194
		regionSud.setCollapsible(true);
194
		regionSud.setFloatable(true);
195
		regionSud.setFloatable(true);
195
		regionSud.setSplit(false);
196
		regionSud.setSplit(false);
196
		regionSud.setMargins(new Margins(0));
197
		regionSud.setMargins(new Margins(0));
197
		
198
		
198
		viewport.add(panneauSud, regionSud);
199
		viewport.add(panneauSud, regionSud);
199
	}
200
	}
200
 
201
 
201
	public void actualiserPanneauCentral() {
202
	public void actualiserPanneauCentral() {
202
		panneauCentre.layout();
203
		panneauCentre.layout();
203
	}
204
	}
204
	
205
	
205
	//+----------------------------------------------------------------------------------------------------------------+
206
	//+----------------------------------------------------------------------------------------------------------------+
206
	//												GESTION du MENU
207
	//												GESTION du MENU
207
	//+----------------------------------------------------------------------------------------------------------------+
208
	//+----------------------------------------------------------------------------------------------------------------+
208
	
209
	
209
	public void clicMenu(String codeMenuClique) {
210
	public void clicMenu(String codeMenuClique) {
210
		activerChargement(codeMenuClique);
211
		activerChargement(codeMenuClique);
211
		panneauOuest.getMenu().selectionMenu(codeMenuClique);
212
		panneauOuest.getMenu().selectionMenu(codeMenuClique);
212
		if (codeMenuClique.equals(MenuApplicationId.ACCUEIL)) {
213
		if (codeMenuClique.equals(MenuApplicationId.ACCUEIL)) {
213
			afficherAccueil();
214
			afficherAccueil();
214
		} else if (codeMenuClique.equals(MenuApplicationId.PROJET)) {
215
		} else if (codeMenuClique.equals(MenuApplicationId.PROJET)) {
215
			selectionnerProjet(panneauCentre, null); 
216
			selectionnerProjet(panneauCentre, null); 
216
		} else if (codeMenuClique.equals(MenuApplicationId.STRUCTURE)) {
217
		} else if (codeMenuClique.equals(MenuApplicationId.STRUCTURE)) {
217
			selectionnerStructure(panneauCentre, null);
218
			selectionnerStructure(panneauCentre, null);
218
		} else if (codeMenuClique.equals(MenuApplicationId.COLLECTION)) { 
219
		} else if (codeMenuClique.equals(MenuApplicationId.COLLECTION)) { 
219
			selectionnerCollection(panneauCentre, null);
220
			selectionnerCollection(panneauCentre, null);
220
		} else if (codeMenuClique.equals(MenuApplicationId.PERSONNE)) { 
221
		} else if (codeMenuClique.equals(MenuApplicationId.PERSONNE)) { 
221
			selectionnerPersonne(panneauCentre, null, null);
222
			selectionnerPersonne(panneauCentre, null, null);
222
		} else if (codeMenuClique.equals(MenuApplicationId.PUBLICATION)) {
223
		} else if (codeMenuClique.equals(MenuApplicationId.PUBLICATION)) {
223
			selectionnerPublication(panneauCentre, null);
224
			selectionnerPublication(panneauCentre, null);
224
		} else if (codeMenuClique.equals(MenuApplicationId.COMMENTAIRE)) {
225
		} else if (codeMenuClique.equals(MenuApplicationId.COMMENTAIRE)) {
225
			selectionnerCommentaire(panneauCentre, null);
226
			selectionnerCommentaire(panneauCentre, null);
226
		} else {
227
		} else {
227
			GWT.log(i18nM.nonImplemente(codeMenuClique), null);
228
			GWT.log(i18nM.nonImplemente(codeMenuClique), null);
228
		}
229
		}
229
		panneauCentre.layout();
230
		panneauCentre.layout();
230
	}
231
	}
231
 
232
 
232
	public void activerChargement(String message) {
233
	public void activerChargement(String message) {
233
		Debug.log(message);
234
		Debug.log(message);
234
		afficherPopinChargement(); 
235
		afficherPopinChargement(); 
235
		panneauSud.showBusy(i18nC.chargement()+" "+message);
236
		panneauSud.showBusy(i18nC.chargement()+" "+message);
236
	}
237
	}
237
	
238
	
238
	public void desactiverChargement() {
239
	public void desactiverChargement() {
239
		masquerPopinChargement();
240
		masquerPopinChargement();
240
		panneauSud.clear();
241
		panneauSud.clear();
241
	}
242
	}
242
		
243
		
243
	//+----------------------------------------------------------------------------------------------------------------+
244
	//+----------------------------------------------------------------------------------------------------------------+
244
	//												GESTION DES FENÊTRES
245
	//												GESTION DES FENÊTRES
245
	//+----------------------------------------------------------------------------------------------------------------+
246
	//+----------------------------------------------------------------------------------------------------------------+
246
 
247
 
247
	public void ouvrirAide() {
248
	public void ouvrirAide() {
248
		AideFenetre aideFenetre = new AideFenetre();
249
		AideFenetre aideFenetre = new AideFenetre();
249
		aideFenetre.show();
250
		aideFenetre.show();
250
		// FIXME : apparament le fade In/Fade Out pose problème sur les navigateurs...
251
		// FIXME : apparament le fade In/Fade Out pose problème sur les navigateurs...
251
		//aideFenetre.el().fadeIn(FxConfig.NONE);
252
		//aideFenetre.el().fadeIn(FxConfig.NONE);
252
	}
253
	}
253
 
254
 
254
	public void ouvrirParametres() {
255
	public void ouvrirParametres() {
255
		ParametreFenetre parametresFenetre = new ParametreFenetre();
256
		ParametreFenetre parametresFenetre = new ParametreFenetre();
256
		parametresFenetre.show();
257
		parametresFenetre.show();
257
	}
258
	}
258
 
259
 
259
	public void ouvrirIdentification() {
260
	public void ouvrirIdentification() {
260
		fenetreIdentification = new IdentificationFenetre();
261
		fenetreIdentification = new IdentificationFenetre();
261
		fenetreIdentification.show();
262
		fenetreIdentification.show();
262
	}
263
	}
263
 
264
 
264
	public void ouvrirUrlExterne(String id) {
265
	public void ouvrirUrlExterne(String id) {
265
		if (id.equals(ComposantId.MENU_CEL)) {
266
		if (id.equals(ComposantId.MENU_CEL)) {
266
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("cel"), "Carnet en ligne", "");
267
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("cel"), "Carnet en ligne", "");
267
		} else if (id.equals(ComposantId.MENU_BEL)) {
268
		} else if (id.equals(ComposantId.MENU_BEL)) {
268
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("cel"), "Biblio en ligne", "");
269
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("cel"), "Biblio en ligne", "");
269
		} else if (id.equals(ComposantId.MENU_BOGUE)) {
270
		} else if (id.equals(ComposantId.MENU_BOGUE)) {
270
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("bogue"), "Bogue", "");
271
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("bogue"), "Bogue", "");
271
		} else if (id.equals(ComposantId.MENU_COMMENTAIRE)) {
272
		} else if (id.equals(ComposantId.MENU_COMMENTAIRE)) {
272
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("commentaire"), "Commentaire", "");
273
			Window.open(((Configuration) Registry.get(RegistreId.CONFIG)).getUrl("commentaire"), "Commentaire", "");
273
		}
274
		}
274
	}
275
	}
275
 
276
 
276
	public void afficherFenetreLicence(IdentificationFenetre vue)	{
277
	public void afficherFenetreLicence(IdentificationFenetre vue)	{
277
		LicenceFenetre lf = new LicenceFenetre(vue);
278
		LicenceFenetre lf = new LicenceFenetre(vue);
278
	}
279
	}
279
	
280
	
280
	public void accepterLicence(Rafraichissable vue)	{
281
	public void accepterLicence(Rafraichissable vue)	{
281
		modele.accepterLicence(vue);		
282
		modele.accepterLicence(vue);		
282
	}
283
	}
283
	//+----------------------------------------------------------------------------------------------------------------+
284
	//+----------------------------------------------------------------------------------------------------------------+
284
	//												GESTION de l'UTILISATEUR et de l'IDENTIFICATION
285
	//												GESTION de l'UTILISATEUR et de l'IDENTIFICATION
285
	//+----------------------------------------------------------------------------------------------------------------+
286
	//+----------------------------------------------------------------------------------------------------------------+
286
	/**
287
	/**
287
	 * Retourne l'identifiant de l'utilisateur courrant de l'application.
288
	 * Retourne l'identifiant de l'utilisateur courrant de l'application.
288
	 */
289
	 */
289
	public String getUtilisateurId() {
290
	public String getUtilisateurId() {
290
		String id = null;
291
		String id = null;
291
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
292
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
292
		if (!utilisateurCourant.getId().equals("")) {
293
		if (!utilisateurCourant.getId().equals("")) {
293
			id = utilisateurCourant.getId();
294
			id = utilisateurCourant.getId();
294
		}
295
		}
295
		return id;
296
		return id;
296
	}
297
	}
297
	
298
	
298
	public Utilisateur getUtilisateur() {
299
	public Utilisateur getUtilisateur() {
299
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
300
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
300
		return utilisateurCourant;
301
		return utilisateurCourant;
301
	}
302
	}
302
	
303
	
303
	public void connecterUtilisateur(String login, String mdp) {
304
	public void connecterUtilisateur(String login, String mdp) {
304
		modele.connecterUtilisateur(this, login, mdp);
305
		modele.connecterUtilisateur(this, login, mdp);
305
	}
306
	}
306
	
307
	
307
	public void deconnecterUtilisateur() {
308
	public void deconnecterUtilisateur() {
308
		modele.deconnecterUtilisateur(this);
309
		modele.deconnecterUtilisateur(this);
309
	}
310
	}
310
	
311
	
311
	public void repandreEtatIdentification(Utilisateur utilisateur) {
312
	public void repandreEtatIdentification(Utilisateur utilisateur) {
312
		// Mise à jour du registre
313
		// Mise à jour du registre
313
		Registry.register(RegistreId.UTILISATEUR_COURANT, utilisateur);
314
		Registry.register(RegistreId.UTILISATEUR_COURANT, utilisateur);
314
		// Propagation de l'information de mise à jour de l'utilisateur
315
		// Propagation de l'information de mise à jour de l'utilisateur
315
		repandreInfoMiseAJourUtilisateur();
316
		repandreInfoMiseAJourUtilisateur();
316
	}
317
	}
317
	
318
	
318
	public void repandreInfoMiseAJourUtilisateur() {
319
	public void repandreInfoMiseAJourUtilisateur() {
319
		// Création de l'information de mise à jour de l'utilisateur
320
		// Création de l'information de mise à jour de l'utilisateur
320
		Information info = new Information("maj_utilisateur");
321
		Information info = new Information("maj_utilisateur");
321
 
322
 
322
		// Rafraichissement de la fenêtre d'Identification
323
		// Rafraichissement de la fenêtre d'Identification
323
		if (fenetreIdentification != null && fenetreIdentification.isVisible()) {
324
		if (fenetreIdentification != null && fenetreIdentification.isVisible()) {
324
			fenetreIdentification.rafraichir(info);
325
			fenetreIdentification.rafraichir(info);
325
		}
326
		}
326
		
327
		
327
		// Rafraichissement du panneau Nord
328
		// Rafraichissement du panneau Nord
328
		panneauNord.rafraichir(info);
329
		panneauNord.rafraichir(info);
329
 
330
 
330
		// Rafraichissement du panneau Centre
331
		// Rafraichissement du panneau Centre
331
		if (panneauCentre != null) {
332
		if (panneauCentre != null) {
332
			panneauCentre.rafraichir(info);
333
			panneauCentre.rafraichir(info);
333
		}
334
		}
334
	}
335
	}
335
	
336
	
336
	public void modifierUtilisateur()	{
337
	public void modifierUtilisateur()	{
337
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
338
		Utilisateur utilisateurCourant = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
338
		panneauNord.rafraichir(utilisateurCourant);
339
		panneauNord.rafraichir(utilisateurCourant);
339
		modele.modifierUtilisateur(this, utilisateurCourant);
340
		modele.modifierUtilisateur(this, utilisateurCourant);
340
	}
341
	}
341
	
342
	
342
	public void mettreAJourPersonneAnnuaire(Utilisateur utilisateur)	{
343
	public void mettreAJourPersonneAnnuaire(Utilisateur utilisateur)	{
343
		panneauNord.rafraichir(utilisateur);
344
		panneauNord.rafraichir(utilisateur);
344
		modele.mettreAJourPersonneAnnuaire(this, utilisateur);
345
		modele.mettreAJourPersonneAnnuaire(this, utilisateur);
345
	}
346
	}
346
 
347
 
347
	//+----------------------------------------------------------------------------------------------------------------+
348
	//+----------------------------------------------------------------------------------------------------------------+
348
	//												GESTION DES VALEURS ET LISTES
349
	//												GESTION DES VALEURS ET LISTES
349
	//+----------------------------------------------------------------------------------------------------------------+
350
	//+----------------------------------------------------------------------------------------------------------------+
350
 
351
 
351
	public void obtenirListeValeurEtRafraichir(Rafraichissable vueARafraichir, String listeId)	{
352
	public void obtenirListeValeurEtRafraichir(Rafraichissable vueARafraichir, String listeId)	{
352
		modele.obtenirListeValeurs(vueARafraichir, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(listeId));
353
		modele.obtenirListeValeurs(vueARafraichir, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(listeId));
353
	}
354
	}
354
	
355
	
355
	public void obtenirValeurEtRafraichir(Rafraichissable vue, String listeId, String identifiantValeur)	{
356
	public void obtenirValeurEtRafraichir(Rafraichissable vue, String listeId, String identifiantValeur)	{
356
		modele.obtenirValeur(vue, "abv", ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(listeId), identifiantValeur);
357
		modele.obtenirValeur(vue, "abv", ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(listeId), identifiantValeur);
357
	}
358
	}
358
	
359
	
359
	public void obtenirListeRegionsEtRafraichir(Rafraichissable vue, String strListeId, String strPays)	{
360
	public void obtenirListeRegionsEtRafraichir(Rafraichissable vue, String strListeId, String strPays)	{
360
		modele.obtenirListeRegion(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), strPays+".__");
361
		modele.obtenirListeRegion(vue, ((Configuration) Registry.get(RegistreId.CONFIG)).getListeId(strListeId), strPays+".__");
361
	}
362
	}
362
	
363
	
363
	//+----------------------------------------------------------------------------------------------------------------+
364
	//+----------------------------------------------------------------------------------------------------------------+
364
	//												GESTION des APPLETS de l'ACCUEIL
365
	//												GESTION des APPLETS de l'ACCUEIL
365
	//+----------------------------------------------------------------------------------------------------------------+
366
	//+----------------------------------------------------------------------------------------------------------------+
366
	
367
	
367
	public void afficherAccueil() {
368
	public void afficherAccueil() {
368
		if (!(panneauCentre.getContenu() instanceof AccueilVue)) {
369
		if (!(panneauCentre.getContenu() instanceof AccueilVue)) {
369
			panneauCentre.removeAll();
370
			panneauCentre.removeAll();
370
			panneauCentre.add(new AccueilVue(this));
371
			panneauCentre.add(new AccueilVue(this));
371
		}
372
		}
372
	}
373
	}
373
	
374
	
374
	//+----------------------------------------------------------------------------------------------------------------+
375
	//+----------------------------------------------------------------------------------------------------------------+
375
	//												GESTION des PROJETS
376
	//												GESTION des PROJETS
376
	//+----------------------------------------------------------------------------------------------------------------+
377
	//+----------------------------------------------------------------------------------------------------------------+
377
	
378
	
378
	public void afficherFormProjet(String projetId) {
379
	public void afficherFormProjet(String projetId) {
379
		panneauCentre.removeAll();
380
		panneauCentre.removeAll();
380
		ProjetForm projetForm = new ProjetForm(this, projetId);
381
		ProjetForm projetForm = new ProjetForm(this, projetId);
381
		panneauCentre.add(projetForm);
382
		panneauCentre.add(projetForm);
382
		
383
		
383
		panneauCentre.layout();
384
		panneauCentre.layout();
384
	}
385
	}
385
	
386
	
386
	public void afficherListeProjets(ProjetListe projetsACharger)	{
387
	public void afficherListeProjets(ProjetListe projetsACharger)	{
387
		if (!(panneauCentre.getContenu() instanceof ProjetVue))	{
388
		if (!(panneauCentre.getContenu() instanceof ProjetVue))	{
388
			panneauCentre.removeAll();
389
			panneauCentre.removeAll();
389
			panneauCentre.add(new ProjetVue(this));
390
			panneauCentre.add(new ProjetVue(this));
390
			panneauCentre.setId(ComposantId.PANNEAU_PROJET_LISTE);
391
			panneauCentre.setId(ComposantId.PANNEAU_PROJET_LISTE);
391
			panneauCentre.layout();
392
			panneauCentre.layout();
392
		}	
393
		}	
393
		
394
		
394
		panneauCentre.getContenu().rafraichir(projetsACharger);
395
		panneauCentre.getContenu().rafraichir(projetsACharger);
395
	}
396
	}
396
	
397
	
397
	public void clicListeProjet(Projet projet) {
398
	public void clicListeProjet(Projet projet) {
398
		panneauCentre.getContenu().rafraichir(projet);
399
		panneauCentre.getContenu().rafraichir(projet);
399
	}
400
	}
400
 
401
 
401
	public void clicSupprimerProjet(final List<Projet> projetListe) {
402
	public void clicSupprimerProjet(final List<Projet> projetListe) {
402
		if (projetListe.size() <= 0) {
403
		if (projetListe.size() <= 0) {
403
			MessageBox.alert("Attention", "Vous devez sélectionner un projet", null); 
404
			MessageBox.alert("Attention", "Vous devez sélectionner un projet", null); 
404
		} else {
405
		} else {
405
			String message = "Voulez-vous vraiment supprimer ces projets ?";
406
			String message = "Voulez-vous vraiment supprimer ces projets ?";
406
			if (projetListe.size() == 1) {
407
			if (projetListe.size() == 1) {
407
				message = "Voulez-vous vraiment supprimer ce projet ?";
408
				message = "Voulez-vous vraiment supprimer ce projet ?";
408
			}
409
			}
409
			
410
			
410
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
411
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
411
				public void handleEvent(MessageBoxEvent ce) {  
412
				public void handleEvent(MessageBoxEvent ce) {  
412
					Dialog dialog = (Dialog) ce.getComponent();
413
					Dialog dialog = (Dialog) ce.getComponent();
413
				    Button btn = ce.getButtonClicked();  
414
				    Button btn = ce.getButtonClicked();  
414
				    	   
415
				    	   
415
				    if (btn.getText().equals(dialog.yesText)) {
416
				    if (btn.getText().equals(dialog.yesText)) {
416
				    	modele.supprimerProjet(panneauCentre.getContenu(), projetListe);  
417
				    	modele.supprimerProjet(panneauCentre.getContenu(), projetListe);  
417
				    }
418
				    }
418
				}
419
				}
419
			};
420
			};
420
				     
421
				     
421
			MessageBox.confirm("Supprimer un projet", message, listenerSuppression);
422
			MessageBox.confirm("Supprimer un projet", message, listenerSuppression);
422
		}
423
		}
423
		
424
		
424
	}
425
	}
425
 
426
 
426
	public void clicModifierProjet(List<Projet> projetsSelectionnes) {
427
	public void clicModifierProjet(List<Projet> projetsSelectionnes) {
427
		if (projetsSelectionnes.size() == 0) {
428
		if (projetsSelectionnes.size() == 0) {
428
			Info.display("Information", "Veuillez sélectionner un projet.");
429
			Info.display("Information", "Veuillez sélectionner un projet.");
429
		} else if (projetsSelectionnes.size() > 1) {
430
		} else if (projetsSelectionnes.size() > 1) {
430
			Info.display("Information", "Veuillez sélectionner un seul projet à la fois.");
431
			Info.display("Information", "Veuillez sélectionner un seul projet à la fois.");
431
		} else if (projetsSelectionnes.size() == 1) {
432
		} else if (projetsSelectionnes.size() == 1) {
432
			afficherFormProjet(projetsSelectionnes.get(0).getId());
433
			afficherFormProjet(projetsSelectionnes.get(0).getId());
433
		} else {
434
		} else {
434
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierProjet() du Médiateur.");
435
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierProjet() du Médiateur.");
435
		}
436
		}
436
	}
437
	}
437
 
438
 
438
	public void clicAjouterProjet() {
439
	public void clicAjouterProjet() {
439
		afficherFormProjet(null);
440
		afficherFormProjet(null);
440
	}
441
	}
441
 
442
 
442
	public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId) {
443
	public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId) {
443
		modele.selectionnerProjet(vueARafraichir, projetId);
444
		modele.selectionnerProjet(vueARafraichir, projetId);
444
	}
445
	}
445
 
446
 
446
	public void ajouterProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
447
	public void ajouterProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
447
		modele.ajouterProjet(vueARafraichir, projetCollecte);
448
		modele.ajouterProjet(vueARafraichir, projetCollecte);
448
	}
449
	}
449
 
450
 
450
	public void modifierProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
451
	public void modifierProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
451
		modele.modifierProjet(vueARafraichir, projetCollecte);	
452
		modele.modifierProjet(vueARafraichir, projetCollecte);	
452
	}
453
	}
453
	
454
	
454
	//+----------------------------------------------------------------------------------------------------------------+
455
	//+----------------------------------------------------------------------------------------------------------------+
455
	// SELECTION : projet
456
	// SELECTION : projet
456
	/**
457
	/**
457
	 * Retourne l'identifiant du projet courrant de l'application.
458
	 * Retourne l'identifiant du projet courrant de l'application.
458
	 */
459
	 */
459
	public String getProjetId() {
460
	public String getProjetId() {
460
		String id = null;
461
		String id = null;
461
		Projet projetCourant = (Projet) Registry.get(RegistreId.PROJET_COURANT);
462
		Projet projetCourant = (Projet) Registry.get(RegistreId.PROJET_COURANT);
462
		if (projetCourant != null && !projetCourant.getId().equals("")) {
463
		if (projetCourant != null && !projetCourant.getId().equals("")) {
463
			id = projetCourant.getId();
464
			id = projetCourant.getId();
464
		}
465
		}
465
		return id;
466
		return id;
466
	}
467
	}
467
		
468
		
468
	public void selectionnerProjetCourant(Projet projetSelectionne) {
469
	public void selectionnerProjetCourant(Projet projetSelectionne) {
469
		Registry.register(RegistreId.PROJET_COURANT, projetSelectionne);
470
		Registry.register(RegistreId.PROJET_COURANT, projetSelectionne);
470
		if (panneauCentre.getContenu() instanceof ProjetVue)	{
471
		if (panneauCentre.getContenu() instanceof ProjetVue)	{
471
			selectionnerProjet(panneauCentre.getContenu(), null);
472
			selectionnerProjet(panneauCentre.getContenu(), null);
472
		} else if (panneauCentre.getContenu() instanceof StructureVue)	{
473
		} else if (panneauCentre.getContenu() instanceof StructureVue)	{
473
			selectionnerStructure(panneauCentre.getContenu(), null);
474
			selectionnerStructure(panneauCentre.getContenu(), null);
474
		} else if (panneauCentre.getContenu() instanceof CollectionVue)	{
475
		} else if (panneauCentre.getContenu() instanceof CollectionVue)	{
475
			selectionnerCollection(panneauCentre.getContenu(), null);
476
			selectionnerCollection(panneauCentre.getContenu(), null);
476
		} else if (panneauCentre.getContenu() instanceof PersonneVue) {
477
		} else if (panneauCentre.getContenu() instanceof PersonneVue) {
477
			selectionnerPersonne(panneauCentre.getContenu(), null, getProjetId());
478
			selectionnerPersonne(panneauCentre.getContenu(), null, getProjetId());
478
		} else if (panneauCentre.getContenu() instanceof PublicationVue) {
479
		} else if (panneauCentre.getContenu() instanceof PublicationVue) {
479
			selectionnerPublication(panneauCentre.getContenu(), null);
480
			selectionnerPublication(panneauCentre.getContenu(), null);
480
		} else if (panneauCentre.getContenu() instanceof CommentaireVue) {
481
		} else if (panneauCentre.getContenu() instanceof CommentaireVue) {
481
			selectionnerCommentaire(panneauCentre.getContenu(), null);
482
			selectionnerCommentaire(panneauCentre.getContenu(), null);
482
		}
483
		}
483
	}
484
	}
484
	
485
	
485
	
486
	
486
	//+----------------------------------------------------------------------------------------------------------------+
487
	//+----------------------------------------------------------------------------------------------------------------+
487
	//												GESTION DES STRUCTURES
488
	//												GESTION DES STRUCTURES
488
	//+----------------------------------------------------------------------------------------------------------------+
489
	//+----------------------------------------------------------------------------------------------------------------+
489
 
490
 
490
	public void afficherListeStructures(StructureListe structuresACharger) {
491
	public void afficherListeStructures(StructureListe structuresACharger) {
491
		if (!(panneauCentre.getContenu() instanceof StructureVue))	{	
492
		if (!(panneauCentre.getContenu() instanceof StructureVue))	{	
492
			panneauCentre.removeAll();
493
			panneauCentre.removeAll();
493
			panneauCentre.add(new StructureVue(this));
494
			panneauCentre.add(new StructureVue(this));
494
		}
495
		}
495
		panneauCentre.getContenu().rafraichir(structuresACharger);
496
		panneauCentre.getContenu().rafraichir(structuresACharger);
496
	}
497
	}
497
	
498
	
498
	public void afficherFormStructure(String structureId) {
499
	public void afficherFormStructure(String structureId) {
499
		String mode = Formulaire.MODE_AJOUTER;
500
		String mode = Formulaire.MODE_AJOUTER;
500
		if (structureId != null) {
501
		if (structureId != null) {
501
			mode = Formulaire.MODE_MODIFIER;
502
			mode = Formulaire.MODE_MODIFIER;
502
		}
503
		}
503
		
504
		
504
		panneauCentre.removeAll();
505
		panneauCentre.removeAll();
505
		StructureForm structureForm = new StructureForm(this, mode);
506
		StructureForm structureForm = new StructureForm(this, mode);
506
		panneauCentre.add(structureForm);
507
		panneauCentre.add(structureForm);
507
		
508
		
508
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
509
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
509
			selectionnerStructure(structureForm, structureId);
510
			selectionnerStructure(structureForm, structureId);
510
			selectionnerStructureAPersonne(structureForm, structureId, StructureAPersonne.ROLE_EQUIPE);
511
			selectionnerStructureAPersonne(structureForm, structureId, StructureAPersonne.ROLE_EQUIPE);
511
		}
512
		}
512
		
513
		
513
		panneauCentre.layout();
514
		panneauCentre.layout();
514
	}
515
	}
515
	
516
	
516
	public void clicListeStructure(Structure structure) {
517
	public void clicListeStructure(Structure structure) {
517
		panneauCentre.getContenu().rafraichir(structure);
518
		panneauCentre.getContenu().rafraichir(structure);
518
		if (structure != null && structure.getPersonnel() == null) {
519
		if (structure != null && structure.getPersonnel() == null) {
519
			selectionnerStructureAPersonne(panneauCentre.getContenu(), structure.getId(), StructureAPersonne.ROLE_EQUIPE);
520
			selectionnerStructureAPersonne(panneauCentre.getContenu(), structure.getId(), StructureAPersonne.ROLE_EQUIPE);
520
		}
521
		}
521
	}
522
	}
522
 
523
 
523
	public void clicAjouterStructure() {
524
	public void clicAjouterStructure() {
524
		afficherFormStructure(null);
525
		afficherFormStructure(null);
525
	}
526
	}
526
	
527
	
527
	public void clicModifierStructure(List<Structure> structureSelection) {
528
	public void clicModifierStructure(List<Structure> structureSelection) {
528
		if (structureSelection.size() == 0) {
529
		if (structureSelection.size() == 0) {
529
			Info.display("Information", "Veuillez sélectionner une structure.");
530
			Info.display("Information", "Veuillez sélectionner une structure.");
530
		} else if (structureSelection.size() > 1) {
531
		} else if (structureSelection.size() > 1) {
531
			Info.display("Information", "Veuillez sélectionner une seule structure à la fois.");
532
			Info.display("Information", "Veuillez sélectionner une seule structure à la fois.");
532
		} else if (structureSelection.size() == 1) {
533
		} else if (structureSelection.size() == 1) {
533
			afficherFormStructure(structureSelection.get(0).getId());
534
			afficherFormStructure(structureSelection.get(0).getId());
534
		} else {
535
		} else {
535
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierStructure() du Médiateur.");
536
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierStructure() du Médiateur.");
536
		}
537
		}
537
	}
538
	}
538
	
539
	
539
	public void clicSupprimerStructure(final Rafraichissable vue, final List<Structure> structureSelection) {
540
	public void clicSupprimerStructure(final Rafraichissable vue, final List<Structure> structureSelection) {
540
		if (structureSelection.size() == 0) {
541
		if (structureSelection.size() == 0) {
541
			Info.display("Information", "Veuillez sélectionner une structure.");
542
			Info.display("Information", "Veuillez sélectionner une structure.");
542
		} else if(structureSelection.size() > 0) {
543
		} else if(structureSelection.size() > 0) {
543
			String titre = "Supprimer des structures";
544
			String titre = "Supprimer des structures";
544
			String message = "Êtes vous sur de vouloir supprimer les structures sélectionnées ?";
545
			String message = "Êtes vous sur de vouloir supprimer les structures sélectionnées ?";
545
			if (structureSelection.size() == 1) {
546
			if (structureSelection.size() == 1) {
546
				titre = "Supprimer une structure";
547
				titre = "Supprimer une structure";
547
				message = "Êtes vous sur de vouloir supprimer la structure sélectionnée ?";
548
				message = "Êtes vous sur de vouloir supprimer la structure sélectionnée ?";
548
			}
549
			}
549
			
550
			
550
			final Listener<MessageBoxEvent> suppressionEcouteur = new Listener<MessageBoxEvent>() { 
551
			final Listener<MessageBoxEvent> suppressionEcouteur = new Listener<MessageBoxEvent>() { 
551
				public void handleEvent(MessageBoxEvent ce) {  
552
				public void handleEvent(MessageBoxEvent ce) {  
552
					Dialog dialog = (Dialog) ce.getComponent();
553
					Dialog dialog = (Dialog) ce.getComponent();
553
					Button btn = ce.getButtonClicked();  
554
					Button btn = ce.getButtonClicked();  
554
 
555
 
555
					if (btn.getText().equals(dialog.yesText))	{
556
					if (btn.getText().equals(dialog.yesText))	{
556
						String idStr = "" ;
557
						String idStr = "" ;
557
						for(int i = 0 ; i < structureSelection.size() ; i++) {
558
						for(int i = 0 ; i < structureSelection.size() ; i++) {
558
							idStr += structureSelection.get(i).getId()+","; 
559
							idStr += structureSelection.get(i).getId()+","; 
559
						}
560
						}
560
						supprimerStructure(vue, idStr);
561
						supprimerStructure(vue, idStr);
561
					}
562
					}
562
				}
563
				}
563
			};
564
			};
564
			
565
			
565
			MessageBox.confirm(titre, message, suppressionEcouteur);
566
			MessageBox.confirm(titre, message, suppressionEcouteur);
566
		} else {
567
		} else {
567
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerStructure() du Médiateur.");
568
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerStructure() du Médiateur.");
568
		}
569
		}
569
	}
570
	}
570
	
571
	
571
	public void selectionnerStructure(Rafraichissable vueARafraichir, String structureId) {
572
	public void selectionnerStructure(Rafraichissable vueARafraichir, String structureId) {
572
		modele.selectionnerStructure(vueARafraichir, getProjetId(), structureId);
573
		modele.selectionnerStructure(vueARafraichir, getProjetId(), structureId);
573
	}
574
	}
574
	
575
	
575
	public void selectionnerStructureParProjet(Rafraichissable vueARafraichir, String projetId) {
576
	public void selectionnerStructureParProjet(Rafraichissable vueARafraichir, String projetId) {
576
		modele.selectionnerStructure(vueARafraichir, projetId, null);
577
		modele.selectionnerStructure(vueARafraichir, projetId, null);
577
	}
578
	}
578
	
579
	
579
	public void ajouterStructure(Rafraichissable vueARafraichir, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
580
	public void ajouterStructure(Rafraichissable vueARafraichir, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
580
		modele.ajouterStructure(vueARafraichir, structure, conservation, valorisation);
581
		modele.ajouterStructure(vueARafraichir, structure, conservation, valorisation);
581
	}
582
	}
582
	
583
	
583
	public void modifierStructure(Rafraichissable vueARafraichir, String structureId, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
584
	public void modifierStructure(Rafraichissable vueARafraichir, String structureId, Structure structure, StructureConservation conservation, StructureValorisation valorisation) {
584
		modele.modifierStructure(vueARafraichir, structureId, structure, conservation, valorisation);
585
		modele.modifierStructure(vueARafraichir, structureId, structure, conservation, valorisation);
585
	}
586
	}
586
	
587
	
587
	public void supprimerStructure(Rafraichissable vueARafraichir, String IdentifiantsStructureSepareParVirgule) {
588
	public void supprimerStructure(Rafraichissable vueARafraichir, String IdentifiantsStructureSepareParVirgule) {
588
		modele.supprimerStructure(vueARafraichir, IdentifiantsStructureSepareParVirgule);
589
		modele.supprimerStructure(vueARafraichir, IdentifiantsStructureSepareParVirgule);
589
	}
590
	}
590
	
591
	
591
	//+----------------------------------------------------------------------------------------------------------------+
592
	//+----------------------------------------------------------------------------------------------------------------+
592
	// GESTION de la relation STRUCTURE A PERSONNE
593
	// GESTION de la relation STRUCTURE A PERSONNE
593
	public void selectionnerStructureAPersonne(Rafraichissable vueARafraichir, String structureId, String roleId) {
594
	public void selectionnerStructureAPersonne(Rafraichissable vueARafraichir, String structureId, String roleId) {
594
		modele.selectionnerStructureAPersonne(vueARafraichir, structureId, roleId);
595
		modele.selectionnerStructureAPersonne(vueARafraichir, structureId, roleId);
595
	}
596
	}
596
	
597
	
597
	public void ajouterStructureAPersonne(Rafraichissable vueARafraichir, String structureId, StructureAPersonneListe personnelAjoute) {
598
	public void ajouterStructureAPersonne(Rafraichissable vueARafraichir, String structureId, StructureAPersonneListe personnelAjoute) {
598
		if (personnelAjoute != null && personnelAjoute.size() > 0) {
599
		if (personnelAjoute != null && personnelAjoute.size() > 0) {
599
			for (Iterator<String> it = personnelAjoute.keySet().iterator(); it.hasNext();) {
600
			for (Iterator<String> it = personnelAjoute.keySet().iterator(); it.hasNext();) {
600
				modele.ajouterStructureAPersonne(vueARafraichir, structureId, (StructureAPersonne) personnelAjoute.get(it.next()));
601
				modele.ajouterStructureAPersonne(vueARafraichir, structureId, (StructureAPersonne) personnelAjoute.get(it.next()));
601
			}
602
			}
602
		}
603
		}
603
	}
604
	}
604
	
605
	
605
	public void modifierStructureAPersonne(Rafraichissable vueARafraichir, StructureAPersonneListe personnelModifie) {
606
	public void modifierStructureAPersonne(Rafraichissable vueARafraichir, StructureAPersonneListe personnelModifie) {
606
		if (personnelModifie != null && personnelModifie.size() > 0) {
607
		if (personnelModifie != null && personnelModifie.size() > 0) {
607
			for (Iterator<String> it = personnelModifie.keySet().iterator(); it.hasNext();) {
608
			for (Iterator<String> it = personnelModifie.keySet().iterator(); it.hasNext();) {
608
				modele.modifierStructureAPersonne(vueARafraichir, (StructureAPersonne) personnelModifie.get(it.next()));
609
				modele.modifierStructureAPersonne(vueARafraichir, (StructureAPersonne) personnelModifie.get(it.next()));
609
			}
610
			}
610
		}
611
		}
611
	}
612
	}
612
	
613
	
613
	public void supprimerStructureAPersonne(Rafraichissable vueARafraichir, StructureAPersonneListe personnelSupprime) {
614
	public void supprimerStructureAPersonne(Rafraichissable vueARafraichir, StructureAPersonneListe personnelSupprime) {
614
		if (personnelSupprime != null && personnelSupprime.size() > 0) {
615
		if (personnelSupprime != null && personnelSupprime.size() > 0) {
615
			String idStructureAPersonneSepareParVirgule = "" ;
616
			String idStructureAPersonneSepareParVirgule = "" ;
616
			Iterator<String> it = personnelSupprime.keySet().iterator();
617
			Iterator<String> it = personnelSupprime.keySet().iterator();
617
			while (it.hasNext()) {
618
			while (it.hasNext()) {
618
				idStructureAPersonneSepareParVirgule += personnelSupprime.get(it.next()).getId();
619
				idStructureAPersonneSepareParVirgule += personnelSupprime.get(it.next()).getId();
619
				idStructureAPersonneSepareParVirgule += (it.hasNext()) ? "," : "";
620
				idStructureAPersonneSepareParVirgule += (it.hasNext()) ? "," : "";
620
			}
621
			}
621
			supprimerStructureAPersonne(vueARafraichir, idStructureAPersonneSepareParVirgule);
622
			supprimerStructureAPersonne(vueARafraichir, idStructureAPersonneSepareParVirgule);
622
		}
623
		}
623
	}
624
	}
624
	
625
	
625
	public void supprimerStructureAPersonne(Rafraichissable vueARafraichir, String idStructureAPersonneSeparesParVirgule) {
626
	public void supprimerStructureAPersonne(Rafraichissable vueARafraichir, String idStructureAPersonneSeparesParVirgule) {
626
		modele.supprimerStructureAPersonne(vueARafraichir, idStructureAPersonneSeparesParVirgule);
627
		modele.supprimerStructureAPersonne(vueARafraichir, idStructureAPersonneSeparesParVirgule);
627
	}
628
	}
628
	
629
	
629
	public void supprimerStructureAPersonne(final Rafraichissable vueARafraichir, final List<Structure> structuresListe) {
630
	public void supprimerStructureAPersonne(final Rafraichissable vueARafraichir, final List<Structure> structuresListe) {
630
		if (structuresListe.size() != 0) {
631
		if (structuresListe.size() != 0) {
631
			String idStructureSepareParVirgule = "" ;
632
			String idStructureSepareParVirgule = "" ;
632
			Iterator<Structure> it = structuresListe.iterator();
633
			Iterator<Structure> it = structuresListe.iterator();
633
			while (it.hasNext()) {
634
			while (it.hasNext()) {
634
				Structure structure = it.next();
635
				Structure structure = it.next();
635
				idStructureSepareParVirgule += structure.getId();
636
				idStructureSepareParVirgule += structure.getId();
636
				idStructureSepareParVirgule += it.hasNext() ? "," : "";
637
				idStructureSepareParVirgule += it.hasNext() ? "," : "";
637
			}
638
			}
638
			supprimerStructureAPersonne(vueARafraichir, idStructureSepareParVirgule);
639
			supprimerStructureAPersonne(vueARafraichir, idStructureSepareParVirgule);
639
		}
640
		}
640
	}
641
	}
641
	
642
	
642
	//+----------------------------------------------------------------------------------------------------------------+
643
	//+----------------------------------------------------------------------------------------------------------------+
643
	//												GESTION des COLLECTIONS
644
	//												GESTION des COLLECTIONS
644
	//+----------------------------------------------------------------------------------------------------------------+
645
	//+----------------------------------------------------------------------------------------------------------------+
645
	
646
	
646
	public void afficherListeCollections(CollectionListe collectionsACharger) {
647
	public void afficherListeCollections(CollectionListe collectionsACharger) {
647
		if (!(panneauCentre.getContenu() instanceof CollectionVue)) {
648
		if (!(panneauCentre.getContenu() instanceof CollectionVue)) {
648
			panneauCentre.removeAll();
649
			panneauCentre.removeAll();
649
			panneauCentre.add(new CollectionVue(this));
650
			panneauCentre.add(new CollectionVue(this));
650
		}
651
		}
651
		
652
		
652
		panneauCentre.getContenu().rafraichir(collectionsACharger);
653
		panneauCentre.getContenu().rafraichir(collectionsACharger);
653
	}
654
	}
654
	
655
	
655
	public void afficherFormCollection(String collectionId) {
656
	public void afficherFormCollection(String collectionId) {
656
		panneauCentre.removeAll();
657
		panneauCentre.removeAll();
657
		CollectionForm collectionForm = new CollectionForm(this, collectionId);
658
		CollectionForm collectionForm = new CollectionForm(this, collectionId);
658
		panneauCentre.add(collectionForm);
659
		panneauCentre.add(collectionForm);
659
		
660
		
660
		panneauCentre.layout();
661
		panneauCentre.layout();
661
	}
662
	}
662
	
663
	
663
	public void clicListeCollection(Collection collectionCliquee) {
664
	public void clicListeCollection(Collection collectionCliquee) {
664
		panneauCentre.getContenu().rafraichir(collectionCliquee);
665
		panneauCentre.getContenu().rafraichir(collectionCliquee);
665
		if (collectionCliquee != null) {
666
		if (collectionCliquee != null) {
666
			selectionnerCollectionAPersonne(panneauCentre.getContenu(), collectionCliquee.getId(), null);
667
			selectionnerCollectionAPersonne(panneauCentre.getContenu(), collectionCliquee.getId(), null);
667
			selectionnerCollectionAPublication(panneauCentre.getContenu(), collectionCliquee.getId());
668
			selectionnerCollectionAPublication(panneauCentre.getContenu(), collectionCliquee.getId());
668
			selectionnerCollectionACommentaire(panneauCentre.getContenu(), collectionCliquee.getId());
669
			selectionnerCollectionACommentaire(panneauCentre.getContenu(), collectionCliquee.getId());
669
		} 
670
		} 
670
	}
671
	}
671
	
672
	
672
	public void clicAjouterCollection() {
673
	public void clicAjouterCollection() {
673
		afficherFormCollection(null);
674
		afficherFormCollection(null);
674
	}
675
	}
675
 
676
 
676
	public void clicModifierCollection(List<Collection> selection) {
677
	public void clicModifierCollection(List<Collection> selection) {
677
		if (selection.size() == 0) {
678
		if (selection.size() == 0) {
678
			Info.display("Information", "Veuillez sélectionner une collection.");
679
			Info.display("Information", "Veuillez sélectionner une collection.");
679
		} else if (selection.size() > 1) {
680
		} else if (selection.size() > 1) {
680
			Info.display("Information", "Veuillez sélectionner une seule collection à la fois.");
681
			Info.display("Information", "Veuillez sélectionner une seule collection à la fois.");
681
		} else if (selection.size() == 1) {
682
		} else if (selection.size() == 1) {
682
			afficherFormCollection(selection.get(0).getId());
683
			afficherFormCollection(selection.get(0).getId());
683
		} else {
684
		} else {
684
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierCollection() du Médiateur.");
685
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierCollection() du Médiateur.");
685
		}
686
		}
686
	}
687
	}
687
 
688
 
688
	public void clicSupprimerCollection(CollectionListeVue collectionListeVue, final List<Collection> collectionsASupprimer) {
689
	public void clicSupprimerCollection(CollectionListeVue collectionListeVue, final List<Collection> collectionsASupprimer) {
689
		if (collectionsASupprimer.size() <= 0) {
690
		if (collectionsASupprimer.size() <= 0) {
690
			MessageBox.alert("Attention", "Vous devez sélectionner au moins une collection", null); 
691
			MessageBox.alert("Attention", "Vous devez sélectionner au moins une collection", null); 
691
		} else {
692
		} else {
692
			String message = "Voulez-vous vraiment supprimer ces collections ?";
693
			String message = "Voulez-vous vraiment supprimer ces collections ?";
693
			if (collectionsASupprimer.size() == 1) {
694
			if (collectionsASupprimer.size() == 1) {
694
				message = "Voulez-vous vraiment supprimer cette collection ?";
695
				message = "Voulez-vous vraiment supprimer cette collection ?";
695
			}
696
			}
696
			
697
			
697
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
698
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
698
				public void handleEvent(MessageBoxEvent ce) {  
699
				public void handleEvent(MessageBoxEvent ce) {  
699
					Dialog dialog = (Dialog) ce.getComponent();
700
					Dialog dialog = (Dialog) ce.getComponent();
700
				    Button btn = ce.getButtonClicked();  
701
				    Button btn = ce.getButtonClicked();  
701
				    	   
702
				    	   
702
				    if (btn.getText().equals(dialog.yesText)) {
703
				    if (btn.getText().equals(dialog.yesText)) {
703
				    	supprimerCollection(panneauCentre.getContenu(), collectionsASupprimer);
704
				    	supprimerCollection(panneauCentre.getContenu(), collectionsASupprimer);
704
				    }
705
				    }
705
				}
706
				}
706
			};
707
			};
707
				     
708
				     
708
			MessageBox.confirm("Supprimer une collection", message, listenerSuppression);
709
			MessageBox.confirm("Supprimer une collection", message, listenerSuppression);
709
		}	
710
		}	
710
	}
711
	}
711
 
712
 
712
	public void selectionnerCollection(Rafraichissable vueARafraichir, String collectionId) {
713
	public void selectionnerCollection(Rafraichissable vueARafraichir, String collectionId) {
713
		modele.selectionnerCollection(vueARafraichir, getProjetId(), collectionId);
714
		modele.selectionnerCollection(vueARafraichir, getProjetId(), collectionId);
714
	}
715
	}
715
	
716
	
716
	public void selectionnerCollectionParProjet(Rafraichissable vueARafraichir, String projetId) {
717
	public void selectionnerCollectionParProjet(Rafraichissable vueARafraichir, String projetId) {
717
		modele.selectionnerCollection(vueARafraichir, projetId, null);
718
		modele.selectionnerCollection(vueARafraichir, projetId, null);
718
	}
719
	}
719
	
720
	
720
	public void ajouterCollection(Rafraichissable vueARafraichir, Collection collection) {
721
	public void ajouterCollection(Rafraichissable vueARafraichir, Collection collection) {
721
		modele.ajouterCollection(vueARafraichir, collection);
722
		modele.ajouterCollection(vueARafraichir, collection);
722
	}
723
	}
723
	
724
	
724
	public void modifierCollection(Rafraichissable vueARafraichir, Collection collection) {
725
	public void modifierCollection(Rafraichissable vueARafraichir, Collection collection) {
725
		modele.modifierCollection(vueARafraichir, collection);
726
		modele.modifierCollection(vueARafraichir, collection);
726
	}
727
	}
727
	
728
	
728
	public void supprimerCollection(Rafraichissable vueARafraichir, List<Collection> collectionsListe) {
729
	public void supprimerCollection(Rafraichissable vueARafraichir, List<Collection> collectionsListe) {
729
		if (collectionsListe != null && collectionsListe.size() > 0) {
730
		if (collectionsListe != null && collectionsListe.size() > 0) {
730
			String idCollectionSeparesParVirgule = "" ;
731
			String idCollectionSeparesParVirgule = "" ;
731
			Iterator<Collection> it = collectionsListe.iterator();
732
			Iterator<Collection> it = collectionsListe.iterator();
732
			while (it.hasNext()) {
733
			while (it.hasNext()) {
733
				idCollectionSeparesParVirgule += it.next().getId();
734
				idCollectionSeparesParVirgule += it.next().getId();
734
				if (it.hasNext()) {
735
				if (it.hasNext()) {
735
					idCollectionSeparesParVirgule += ",";
736
					idCollectionSeparesParVirgule += ",";
736
				}
737
				}
737
			}
738
			}
738
			modele.supprimerCollection(vueARafraichir, idCollectionSeparesParVirgule);
739
			modele.supprimerCollection(vueARafraichir, idCollectionSeparesParVirgule);
739
			modele.supprimerCollectionAPersonne(vueARafraichir, idCollectionSeparesParVirgule);
740
			modele.supprimerCollectionAPersonne(vueARafraichir, idCollectionSeparesParVirgule);
740
			modele.supprimerCollectionAPublication(vueARafraichir, idCollectionSeparesParVirgule);
741
			modele.supprimerCollectionAPublication(vueARafraichir, idCollectionSeparesParVirgule);
741
			//modele.supprimerCollectionACommentaire(vueARafraichir, idCollectionSeparesParVirgule);
742
			//modele.supprimerCollectionACommentaire(vueARafraichir, idCollectionSeparesParVirgule);
742
		}
743
		}
743
		
744
		
744
	}
745
	}
745
	
746
	
746
	//+----------------------------------------------------------------------------------------------------------------+
747
	//+----------------------------------------------------------------------------------------------------------------+
747
	// GESTION de la relation COLLECTION A PERSONNE
748
	// GESTION de la relation COLLECTION A PERSONNE
748
	
749
	
749
	public void selectionnerCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, String roleId) {
750
	public void selectionnerCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, String roleId) {
750
		modele.selectionnerCollectionAPersonne(vueARafraichir, collectionId, roleId);
751
		modele.selectionnerCollectionAPersonne(vueARafraichir, collectionId, roleId);
751
	}
752
	}
752
	
753
	
753
	public void ajouterCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, CollectionAPersonneListe personnesAjoutees) {
754
	public void ajouterCollectionAPersonne(Rafraichissable vueARafraichir, String collectionId, CollectionAPersonneListe personnesAjoutees) {
754
		if (personnesAjoutees != null && personnesAjoutees.size() > 0) {
755
		if (personnesAjoutees != null && personnesAjoutees.size() > 0) {
755
			for (Iterator<String> it = personnesAjoutees.keySet().iterator(); it.hasNext();) {
756
			for (Iterator<String> it = personnesAjoutees.keySet().iterator(); it.hasNext();) {
756
				modele.ajouterCollectionAPersonne(vueARafraichir, collectionId, (CollectionAPersonne) personnesAjoutees.get(it.next()));
757
				modele.ajouterCollectionAPersonne(vueARafraichir, collectionId, (CollectionAPersonne) personnesAjoutees.get(it.next()));
757
			}
758
			}
758
		}
759
		}
759
	}
760
	}
760
	
761
	
761
	public void modifierCollectionAPersonne(Rafraichissable vueARafraichir, CollectionAPersonneListe personnesModifiees) {
762
	public void modifierCollectionAPersonne(Rafraichissable vueARafraichir, CollectionAPersonneListe personnesModifiees) {
762
		if (personnesModifiees != null && personnesModifiees.size() > 0) {
763
		if (personnesModifiees != null && personnesModifiees.size() > 0) {
763
			for (Iterator<String> it = personnesModifiees.keySet().iterator(); it.hasNext();) {
764
			for (Iterator<String> it = personnesModifiees.keySet().iterator(); it.hasNext();) {
764
				modele.modifierCollectionAPersonne(vueARafraichir, (CollectionAPersonne) personnesModifiees.get(it.next()));
765
				modele.modifierCollectionAPersonne(vueARafraichir, (CollectionAPersonne) personnesModifiees.get(it.next()));
765
			}
766
			}
766
		}
767
		}
767
	}
768
	}
768
	
769
	
769
	public void supprimerCollectionAPersonne(Rafraichissable vueARafraichir, CollectionAPersonneListe personnesSupprimees) {
770
	public void supprimerCollectionAPersonne(Rafraichissable vueARafraichir, CollectionAPersonneListe personnesSupprimees) {
770
		if (personnesSupprimees != null && personnesSupprimees.size() > 0) {
771
		if (personnesSupprimees != null && personnesSupprimees.size() > 0) {
771
			String idCollectionAPersonneSeparesParVirgule = "" ;
772
			String idCollectionAPersonneSeparesParVirgule = "" ;
772
			for (Iterator<String> it = personnesSupprimees.keySet().iterator(); it.hasNext();) {
773
			for (Iterator<String> it = personnesSupprimees.keySet().iterator(); it.hasNext();) {
773
				idCollectionAPersonneSeparesParVirgule += personnesSupprimees.get(it.next()).getId();
774
				idCollectionAPersonneSeparesParVirgule += personnesSupprimees.get(it.next()).getId();
774
				if (it.hasNext()) {
775
				if (it.hasNext()) {
775
					idCollectionAPersonneSeparesParVirgule += ",";
776
					idCollectionAPersonneSeparesParVirgule += ",";
776
				}
777
				}
777
			}
778
			}
778
			modele.supprimerCollectionAPersonne(vueARafraichir, idCollectionAPersonneSeparesParVirgule);
779
			modele.supprimerCollectionAPersonne(vueARafraichir, idCollectionAPersonneSeparesParVirgule);
779
		}
780
		}
780
	}
781
	}
781
	
782
	
782
	//+----------------------------------------------------------------------------------------------------------------+
783
	//+----------------------------------------------------------------------------------------------------------------+
783
	// GESTION de la relation COLLECTION A PUBLICATION
784
	// GESTION de la relation COLLECTION A PUBLICATION
784
	
785
	
785
	public void selectionnerCollectionAPublication(Rafraichissable vueARafraichir, String collectionId) {
786
	public void selectionnerCollectionAPublication(Rafraichissable vueARafraichir, String collectionId) {
786
		modele.selectionnerCollectionAPublication(vueARafraichir, collectionId);
787
		modele.selectionnerCollectionAPublication(vueARafraichir, collectionId);
787
	}
788
	}
788
	
789
	
789
	public void ajouterCollectionAPublication(Rafraichissable vueARafraichir, String collectionId, CollectionAPublicationListe publicationsAjoutees) {
790
	public void ajouterCollectionAPublication(Rafraichissable vueARafraichir, String collectionId, CollectionAPublicationListe publicationsAjoutees) {
790
		if (publicationsAjoutees != null && publicationsAjoutees.size() > 0) {
791
		if (publicationsAjoutees != null && publicationsAjoutees.size() > 0) {
791
			for (Iterator<String> it = publicationsAjoutees.keySet().iterator(); it.hasNext();) {
792
			for (Iterator<String> it = publicationsAjoutees.keySet().iterator(); it.hasNext();) {
792
				modele.ajouterCollectionAPublication(vueARafraichir, collectionId, (CollectionAPublication) publicationsAjoutees.get(it.next()));
793
				modele.ajouterCollectionAPublication(vueARafraichir, collectionId, (CollectionAPublication) publicationsAjoutees.get(it.next()));
793
			}
794
			}
794
		}
795
		}
795
	}
796
	}
796
	
797
	
797
	public void modifierCollectionAPublication(Rafraichissable vueARafraichir, CollectionAPublicationListe publicationsModifiees) {
798
	public void modifierCollectionAPublication(Rafraichissable vueARafraichir, CollectionAPublicationListe publicationsModifiees) {
798
		if (publicationsModifiees != null && publicationsModifiees.size() > 0) {
799
		if (publicationsModifiees != null && publicationsModifiees.size() > 0) {
799
			for (Iterator<String> it = publicationsModifiees.keySet().iterator(); it.hasNext();) {
800
			for (Iterator<String> it = publicationsModifiees.keySet().iterator(); it.hasNext();) {
800
				modele.modifierCollectionAPublication(vueARafraichir, (CollectionAPublication) publicationsModifiees.get(it.next()));
801
				modele.modifierCollectionAPublication(vueARafraichir, (CollectionAPublication) publicationsModifiees.get(it.next()));
801
			}
802
			}
802
		}
803
		}
803
	}
804
	}
804
	
805
	
805
	public void supprimerCollectionAPublication(Rafraichissable vueARafraichir, CollectionAPublicationListe publicationsSupprimees) {
806
	public void supprimerCollectionAPublication(Rafraichissable vueARafraichir, CollectionAPublicationListe publicationsSupprimees) {
806
		if (publicationsSupprimees != null && publicationsSupprimees.size() > 0) {
807
		if (publicationsSupprimees != null && publicationsSupprimees.size() > 0) {
807
			String idCollectionAPublicationSeparesParVirgule = "" ;
808
			String idCollectionAPublicationSeparesParVirgule = "" ;
808
			for (Iterator<String> it = publicationsSupprimees.keySet().iterator(); it.hasNext();) {
809
			for (Iterator<String> it = publicationsSupprimees.keySet().iterator(); it.hasNext();) {
809
				idCollectionAPublicationSeparesParVirgule += publicationsSupprimees.get(it.next()).getId();
810
				idCollectionAPublicationSeparesParVirgule += publicationsSupprimees.get(it.next()).getId();
810
				if (it.hasNext()) {
811
				if (it.hasNext()) {
811
					idCollectionAPublicationSeparesParVirgule += ",";
812
					idCollectionAPublicationSeparesParVirgule += ",";
812
				}
813
				}
813
			}
814
			}
814
			modele.supprimerCollectionAPublication(vueARafraichir, idCollectionAPublicationSeparesParVirgule);
815
			modele.supprimerCollectionAPublication(vueARafraichir, idCollectionAPublicationSeparesParVirgule);
815
		}
816
		}
816
	}
817
	}
817
 
818
 
818
	//+----------------------------------------------------------------------------------------------------------------+
819
	//+----------------------------------------------------------------------------------------------------------------+
819
	// GESTION de la relation COLLECTION A COMMENTAIRE
820
	// GESTION de la relation COLLECTION A COMMENTAIRE
820
	
821
	
821
	public void selectionnerCollectionACommentaire(Rafraichissable vueARafraichir, String collectionId) {
822
	public void selectionnerCollectionACommentaire(Rafraichissable vueARafraichir, String collectionId) {
822
		modele.selectionnerCollectionACommentaire(vueARafraichir, collectionId);
823
		modele.selectionnerCollectionACommentaire(vueARafraichir, collectionId);
823
	}
824
	}
824
	
825
	
825
	public void ajouterCollectionACommentaire(Rafraichissable vueARafraichir, String collectionId, CollectionACommentaireListe commentairesAjoutees) {
826
	public void ajouterCollectionACommentaire(Rafraichissable vueARafraichir, String collectionId, CollectionACommentaireListe commentairesAjoutees) {
826
		if (commentairesAjoutees != null && commentairesAjoutees.size() > 0) {
827
		if (commentairesAjoutees != null && commentairesAjoutees.size() > 0) {
827
			for (Iterator<String> it = commentairesAjoutees.keySet().iterator(); it.hasNext();) {
828
			for (Iterator<String> it = commentairesAjoutees.keySet().iterator(); it.hasNext();) {
828
				modele.ajouterCollectionACommentaire(vueARafraichir, collectionId, (CollectionACommentaire) commentairesAjoutees.get(it.next()));
829
				modele.ajouterCollectionACommentaire(vueARafraichir, collectionId, (CollectionACommentaire) commentairesAjoutees.get(it.next()));
829
			}
830
			}
830
		}
831
		}
831
	}
832
	}
832
	
833
	
833
	public void modifierCollectionACommentaire(Rafraichissable vueARafraichir, CollectionACommentaireListe commentairesModifiees) {
834
	public void modifierCollectionACommentaire(Rafraichissable vueARafraichir, CollectionACommentaireListe commentairesModifiees) {
834
		if (commentairesModifiees != null && commentairesModifiees.size() > 0) {
835
		if (commentairesModifiees != null && commentairesModifiees.size() > 0) {
835
			for (Iterator<String> it = commentairesModifiees.keySet().iterator(); it.hasNext();) {
836
			for (Iterator<String> it = commentairesModifiees.keySet().iterator(); it.hasNext();) {
836
				modele.modifierCollectionACommentaire(vueARafraichir, (CollectionACommentaire) commentairesModifiees.get(it.next()));
837
				modele.modifierCollectionACommentaire(vueARafraichir, (CollectionACommentaire) commentairesModifiees.get(it.next()));
837
			}
838
			}
838
		}
839
		}
839
	}
840
	}
840
	
841
	
841
	public void supprimerCollectionACommentaire(Rafraichissable vueARafraichir, CollectionACommentaireListe commentairesSupprimees) {
842
	public void supprimerCollectionACommentaire(Rafraichissable vueARafraichir, CollectionACommentaireListe commentairesSupprimees) {
842
		if (commentairesSupprimees != null && commentairesSupprimees.size() > 0) {
843
		if (commentairesSupprimees != null && commentairesSupprimees.size() > 0) {
843
			String idCollectionACommentaireSeparesParVirgule = "" ;
844
			String idCollectionACommentaireSeparesParVirgule = "" ;
844
			for (Iterator<String> it = commentairesSupprimees.keySet().iterator(); it.hasNext();) {
845
			for (Iterator<String> it = commentairesSupprimees.keySet().iterator(); it.hasNext();) {
845
				idCollectionACommentaireSeparesParVirgule += commentairesSupprimees.get(it.next()).getId();
846
				idCollectionACommentaireSeparesParVirgule += commentairesSupprimees.get(it.next()).getId();
846
				if (it.hasNext()) {
847
				if (it.hasNext()) {
847
					idCollectionACommentaireSeparesParVirgule += ",";
848
					idCollectionACommentaireSeparesParVirgule += ",";
848
				}
849
				}
849
			}
850
			}
850
			modele.supprimerCollectionACommentaire(vueARafraichir, idCollectionACommentaireSeparesParVirgule, CollectionACommentaireAsyncDao.SUPPRESSION_PAR_COLLECTION);
851
			modele.supprimerCollectionACommentaire(vueARafraichir, idCollectionACommentaireSeparesParVirgule, CollectionACommentaireAsyncDao.SUPPRESSION_PAR_COLLECTION);
851
		}
852
		}
852
	}
853
	}
853
	//+----------------------------------------------------------------------------------------------------------------+
854
	//+----------------------------------------------------------------------------------------------------------------+
854
	//												GESTION DES PERSONNES
855
	//												GESTION DES PERSONNES
855
	//+----------------------------------------------------------------------------------------------------------------+
856
	//+----------------------------------------------------------------------------------------------------------------+
856
 
857
 
857
	public void afficherListePersonnes(PersonneListe personnesACharger)	{
858
	public void afficherListePersonnes(PersonneListe personnesACharger)	{
858
		if (!(panneauCentre.getContenu() instanceof PersonneVue))	{
859
		if (!(panneauCentre.getContenu() instanceof PersonneVue))	{
859
			panneauCentre.removeAll();
860
			panneauCentre.removeAll();
860
			panneauCentre.add(new PersonneVue(this));
861
			panneauCentre.add(new PersonneVue(this));
861
			panneauCentre.setId(ComposantId.PANNEAU_PERSONNE_LISTES);
862
			panneauCentre.setId(ComposantId.PANNEAU_PERSONNE_LISTES);
862
		}	
863
		}	
863
		
864
		
864
		panneauCentre.getContenu().rafraichir(personnesACharger);
865
		panneauCentre.getContenu().rafraichir(personnesACharger);
865
	}
866
	}
866
	
867
	
867
	public void afficherFormPersonne(String personneId)	{
868
	public void afficherFormPersonne(String personneId)	{
868
		panneauCentre.removeAll();
869
		panneauCentre.removeAll();
869
		PersonneForm personneForm = new PersonneForm(this, personneId);
870
		PersonneForm personneForm = new PersonneForm(this, personneId);
870
		panneauCentre.add(personneForm);
871
		panneauCentre.add(personneForm);
871
		
872
		
872
		panneauCentre.layout();
873
		panneauCentre.layout();
873
	}
874
	}
874
 
875
 
875
	public void clicListePersonne(Personne personne)	{
876
	public void clicListePersonne(Personne personne)	{
876
		panneauCentre.getContenu().rafraichir(personne);
877
		panneauCentre.getContenu().rafraichir(personne);
877
	}
878
	}
878
 
879
 
879
	public void clicAjouterPersonne()	{
880
	public void clicAjouterPersonne()	{
880
		afficherFormPersonne(null);
881
		afficherFormPersonne(null);
881
	}
882
	}
882
	
883
	
883
	public void clicModifierPersonne(List<Personne> selection)	{
884
	public void clicModifierPersonne(List<Personne> selection)	{
884
		if (selection.size() == 0) {
885
		if (selection.size() == 0) {
885
			Info.display("Information", "Veuillez sélectionner une personne.");
886
			Info.display("Information", "Veuillez sélectionner une personne.");
886
		} else if (selection.size() > 1) {
887
		} else if (selection.size() > 1) {
887
			Info.display("Information", "Veuillez sélectionner une seule personne à la fois.");
888
			Info.display("Information", "Veuillez sélectionner une seule personne à la fois.");
888
		} else if (selection.size() == 1) {
889
		} else if (selection.size() == 1) {
889
			afficherFormPersonne(selection.get(0).getId());
890
			afficherFormPersonne(selection.get(0).getId());
890
		} else {
891
		} else {
891
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierPersonne() du Médiateur.");
892
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierPersonne() du Médiateur.");
892
		}			
893
		}			
893
	}
894
	}
894
	
895
	
895
	
896
	
896
	public void clicSupprimerPersonne(final Rafraichissable vue, final List<Personne> personneSelection) {
897
	public void clicSupprimerPersonne(final Rafraichissable vue, final List<Personne> personneSelection) {
897
		//Empecher suppression utilisateur
898
		//Empecher suppression utilisateur
898
		for (int i=0; i < personneSelection.size(); i++)	{
899
		for (int i=0; i < personneSelection.size(); i++)	{
899
			Personne courante = personneSelection.get(i);
900
			Personne courante = personneSelection.get(i);
900
			if (courante.getId().equals(getUtilisateurId()))	{
901
			if (courante.getId().equals(getUtilisateurId()))	{
901
				Info.display("Information", "Vous ne pouvez pas supprimer votre compte");
902
				Info.display("Information", "Vous ne pouvez pas supprimer votre compte");
902
				personneSelection.remove(courante);
903
				personneSelection.remove(courante);
903
			}
904
			}
904
		}
905
		}
905
		
906
		
906
		if (personneSelection.size() == 0) {
907
		if (personneSelection.size() == 0) {
907
			Info.display("Information", "Veuillez sélectionner une personne.");
908
			Info.display("Information", "Veuillez sélectionner une personne.");
908
		} else if(personneSelection.size() > 0) {
909
		} else if(personneSelection.size() > 0) {
909
			String message = "Êtes vous sur de vouloir supprimer les personnes sélectionnées ?";
910
			String message = "Êtes vous sur de vouloir supprimer les personnes sélectionnées ?";
910
			if (personneSelection.size() == 1) {
911
			if (personneSelection.size() == 1) {
911
				message = "Êtes vous sur de vouloir supprimer la personne sélectionnée ?";
912
				message = "Êtes vous sur de vouloir supprimer la personne sélectionnée ?";
912
			}
913
			}
913
			
914
			
914
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
915
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
915
				public void handleEvent(MessageBoxEvent ce) {
916
				public void handleEvent(MessageBoxEvent ce) {
916
					Dialog dialog = (Dialog) ce.getComponent();
917
					Dialog dialog = (Dialog) ce.getComponent();
917
					Button btn = ce.getButtonClicked();
918
					Button btn = ce.getButtonClicked();
918
 
919
 
919
					if (btn.getText().equals(dialog.yesText)) {
920
					if (btn.getText().equals(dialog.yesText)) {
920
						String idPersonneSepareParVirgule = "" ;
921
						String idPersonneSepareParVirgule = "" ;
921
						Iterator<Personne> itPersonne = personneSelection.iterator();
922
						Iterator<Personne> itPersonne = personneSelection.iterator();
922
						while (itPersonne.hasNext()) {
923
						while (itPersonne.hasNext()) {
923
							Personne personneCourante = itPersonne.next();
924
							Personne personneCourante = itPersonne.next();
924
							idPersonneSepareParVirgule += personneCourante.getId();
925
							idPersonneSepareParVirgule += personneCourante.getId();
925
							idPersonneSepareParVirgule +=",";
926
							idPersonneSepareParVirgule +=",";
926
						}
927
						}
927
						modele.supprimerPersonne(vue, idPersonneSepareParVirgule);  
928
						modele.supprimerPersonne(vue, idPersonneSepareParVirgule);  
928
					}
929
					}
929
				}
930
				}
930
			};
931
			};
931
			
932
			
932
			MessageBox.confirm("Supprimer une personne", message, listenerSuppression);
933
			MessageBox.confirm("Supprimer une personne", message, listenerSuppression);
933
		} else {
934
		} else {
934
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerPersonne() du Médiateur.");
935
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerPersonne() du Médiateur.");
935
		}
936
		}
936
	}
937
	}
937
 
938
 
938
	public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId)	{
939
	public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId)	{
939
		int nbElements = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage")); 
940
		int nbElements = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage")); 
940
		selectionnerPersonne(vueARafraichir, personne, projetId, 0, nbElements);
941
		selectionnerPersonne(vueARafraichir, personne, projetId, 0, nbElements);
941
	}
942
	}
942
	
943
	
943
	public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId, int start, int nbElements)	{
944
	public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId, int start, int nbElements)	{
944
		String personneId = null;
945
		String personneId = null;
945
		if (personne != null)	{
946
		if (personne != null)	{
946
			personneId = personne.getId();
947
			personneId = personne.getId();
947
		}
948
		}
948
		modele.selectionnerPersonne(vueARafraichir, personneId, projetId, null, start, nbElements);
949
		modele.selectionnerPersonne(vueARafraichir, personneId, projetId, null, start, nbElements);
949
	}
950
	}
950
	
951
	
951
	public void selectionnerPersonneParNomComplet(Rafraichissable vueARafraichir, String projetId, String nomComplet) {
952
	public void selectionnerPersonneParNomComplet(Rafraichissable vueARafraichir, String projetId, String nomComplet) {
952
		modele.selectionnerPersonne(vueARafraichir, null, projetId, nomComplet, 0, -1);		
953
		modele.selectionnerPersonne(vueARafraichir, null, projetId, nomComplet, 0, -1);		
953
	}
954
	}
954
	
955
	
955
	public void selectionnerPersonneParProjet(Rafraichissable vueARafraichir, String projetId) {
956
	public void selectionnerPersonneParProjet(Rafraichissable vueARafraichir, String projetId) {
956
		modele.selectionnerPersonne(vueARafraichir, null, projetId, null, 0, -1);		
957
		modele.selectionnerPersonne(vueARafraichir, null, projetId, null, 0, -1);		
957
	}
958
	}
958
	
959
	
959
	public void enregistrerPersonne(Rafraichissable vue, Personne personne){
960
	public void enregistrerPersonne(Rafraichissable vue, Personne personne){
960
		if (personne.getId() != null && !personne.getId().trim().equals("")) {	
961
		if (personne.getId() != null && !personne.getId().trim().equals("")) {	
961
			modele.modifierPersonne(vue, personne);
962
			modele.modifierPersonne(vue, personne);
962
		}	else {
963
		}	else {
963
			modele.ajouterPersonne(vue, personne);
964
			modele.ajouterPersonne(vue, personne);
964
		}
965
		}
965
	}
966
	}
966
	
967
	
967
	//+----------------------------------------------------------------------------------------------------------------+
968
	//+----------------------------------------------------------------------------------------------------------------+
968
	//												GESTION DES PUBLICATIONS
969
	//												GESTION DES PUBLICATIONS
969
	//+----------------------------------------------------------------------------------------------------------------+
970
	//+----------------------------------------------------------------------------------------------------------------+
970
 
971
 
971
	public void afficherListePublication(PublicationListe nouvelleDonnees) {
972
	public void afficherListePublication(PublicationListe nouvelleDonnees) {
972
		if (!(panneauCentre.getContenu() instanceof PublicationVue))	{
973
		if (!(panneauCentre.getContenu() instanceof PublicationVue))	{
973
			panneauCentre.removeAll();
974
			panneauCentre.removeAll();
974
			panneauCentre.add(new PublicationVue(this));
975
			panneauCentre.add(new PublicationVue(this));
975
		}	
976
		}	
976
		
977
		
977
		panneauCentre.getContenu().rafraichir(nouvelleDonnees);	
978
		panneauCentre.getContenu().rafraichir(nouvelleDonnees);	
978
	}
979
	}
979
	
980
	
980
	public void afficherFormPublication(String publicationId) {
981
	public void afficherFormPublication(String publicationId) {
981
		panneauCentre.removeAll();
982
		panneauCentre.removeAll();
982
		PublicationForm publicationForm = new PublicationForm(this, publicationId);
983
		PublicationForm publicationForm = new PublicationForm(this, publicationId);
983
		panneauCentre.add(publicationForm);
984
		panneauCentre.add(publicationForm);
984
		
985
		
985
		panneauCentre.layout();
986
		panneauCentre.layout();
986
	}
987
	}
987
	
988
	
988
	public void clicListePublication(Publication publication) {
989
	public void clicListePublication(Publication publication) {
989
		if (publication != null) {
990
		if (publication != null) {
990
			panneauCentre.getContenu().rafraichir(publication);	
991
			panneauCentre.getContenu().rafraichir(publication);	
991
		}
992
		}
992
	}
993
	}
993
 
994
 
994
	public void clicAjouterPublication() {
995
	public void clicAjouterPublication() {
995
		afficherFormPublication(null);
996
		afficherFormPublication(null);
996
	}
997
	}
997
	
998
	
998
	public void clicModifierPublication(List<Publication> selection) {
999
	public void clicModifierPublication(List<Publication> selection) {
999
		if (selection.size() == 0) {
1000
		if (selection.size() == 0) {
1000
			Info.display("Information", "Veuillez sélectionner une publication.");
1001
			Info.display("Information", "Veuillez sélectionner une publication.");
1001
		} else if (selection.size() > 1) {
1002
		} else if (selection.size() > 1) {
1002
			Info.display("Information", "Veuillez sélectionner une seule publication à la fois.");
1003
			Info.display("Information", "Veuillez sélectionner une seule publication à la fois.");
1003
		} else if (selection.size() == 1) {
1004
		} else if (selection.size() == 1) {
1004
			afficherFormPublication(selection.get(0).getId());
1005
			afficherFormPublication(selection.get(0).getId());
1005
		} else {
1006
		} else {
1006
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierPublication() du Médiateur.");
1007
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierPublication() du Médiateur.");
1007
		}
1008
		}
1008
	}
1009
	}
1009
	
1010
	
1010
	public void clicSupprimerPublication(final List<Publication> publicationListe) {
1011
	public void clicSupprimerPublication(final List<Publication> publicationListe) {
1011
		if (publicationListe.size() <= 0) {
1012
		if (publicationListe.size() <= 0) {
1012
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null); 
1013
			MessageBox.alert("Attention", "Vous devez sélectionner une publication", null); 
1013
		} else {
1014
		} else {
1014
			String message = "Voulez-vous vraiment supprimer ces publications ?";
1015
			String message = "Voulez-vous vraiment supprimer ces publications ?";
1015
			if (publicationListe.size() == 1) {
1016
			if (publicationListe.size() == 1) {
1016
				message = "Voulez-vous vraiment supprimer cette publication ?";
1017
				message = "Voulez-vous vraiment supprimer cette publication ?";
1017
			}
1018
			}
1018
			
1019
			
1019
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
1020
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
1020
				public void handleEvent(MessageBoxEvent ce) {  
1021
				public void handleEvent(MessageBoxEvent ce) {  
1021
					Dialog dialog = (Dialog) ce.getComponent();
1022
					Dialog dialog = (Dialog) ce.getComponent();
1022
				    Button btn = ce.getButtonClicked();  
1023
				    Button btn = ce.getButtonClicked();  
1023
				    	   
1024
				    	   
1024
				    if (btn.getText().equals(dialog.yesText)) {
1025
				    if (btn.getText().equals(dialog.yesText)) {
1025
				    	supprimerPublication(panneauCentre.getContenu(), publicationListe);
1026
				    	supprimerPublication(panneauCentre.getContenu(), publicationListe);
1026
				    }
1027
				    }
1027
				}
1028
				}
1028
			};
1029
			};
1029
				     
1030
				     
1030
			MessageBox.confirm("Supprimer une publication", message, listenerSuppression);
1031
			MessageBox.confirm("Supprimer une publication", message, listenerSuppression);
1031
		}
1032
		}
1032
	}
1033
	}
1033
	
1034
	
1034
	public void selectionnerPublication(Rafraichissable vueARafraichir, String publicationId) {
1035
	public void selectionnerPublication(Rafraichissable vueARafraichir, String publicationId) {
1035
		modele.selectionnerPublication(vueARafraichir, publicationId, getProjetId(), null);
1036
		modele.selectionnerPublication(vueARafraichir, publicationId, getProjetId(), null);
1036
	}
1037
	}
1037
	
1038
	
1038
	public void selectionnerPublicationParNomComplet(Rafraichissable vueARafraichir, String projetId, String nomComplet) {
1039
	public void selectionnerPublicationParNomComplet(Rafraichissable vueARafraichir, String projetId, String nomComplet) {
1039
		modele.selectionnerPublication(vueARafraichir, null, projetId, nomComplet);		
1040
		modele.selectionnerPublication(vueARafraichir, null, projetId, nomComplet);		
1040
	}
1041
	}
1041
	
1042
	
1042
	public void ajouterPublication(Rafraichissable vueARafraichir, Publication publication) {
1043
	public void ajouterPublication(Rafraichissable vueARafraichir, Publication publication) {
1043
		modele.ajouterPublication(vueARafraichir, publication);
1044
		modele.ajouterPublication(vueARafraichir, publication);
1044
	}
1045
	}
1045
	
1046
	
1046
	public void modifierPublication(Rafraichissable vueARafraichir, Publication publication) {
1047
	public void modifierPublication(Rafraichissable vueARafraichir, Publication publication) {
1047
		modele.modifierPublication(vueARafraichir, publication);
1048
		modele.modifierPublication(vueARafraichir, publication);
1048
	}
1049
	}
1049
	
1050
	
1050
	public void supprimerPublication(Rafraichissable vueARafraichir, List<Publication> publicationsListe) {
1051
	public void supprimerPublication(Rafraichissable vueARafraichir, List<Publication> publicationsListe) {
1051
		if (publicationsListe != null && publicationsListe.size() > 0) {
1052
		if (publicationsListe != null && publicationsListe.size() > 0) {
1052
			String idPublicationSeparesParVirgule = "" ;
1053
			String idPublicationSeparesParVirgule = "" ;
1053
			Iterator<Publication> it = publicationsListe.iterator();
1054
			Iterator<Publication> it = publicationsListe.iterator();
1054
			while (it.hasNext()) {
1055
			while (it.hasNext()) {
1055
				idPublicationSeparesParVirgule += it.next().getId();
1056
				idPublicationSeparesParVirgule += it.next().getId();
1056
				if (it.hasNext()) {
1057
				if (it.hasNext()) {
1057
					idPublicationSeparesParVirgule += ",";
1058
					idPublicationSeparesParVirgule += ",";
1058
				}
1059
				}
1059
			}
1060
			}
1060
			modele.supprimerPublication(vueARafraichir, idPublicationSeparesParVirgule);
1061
			modele.supprimerPublication(vueARafraichir, idPublicationSeparesParVirgule);
1061
			modele.supprimerPublicationAPersonne(vueARafraichir, idPublicationSeparesParVirgule);
1062
			modele.supprimerPublicationAPersonne(vueARafraichir, idPublicationSeparesParVirgule);
1062
		}
1063
		}
1063
	}
1064
	}
1064
 
1065
 
1065
	public void clicObtenirListeEditeurs(Rafraichissable vueARafraichir) {
1066
	public void clicObtenirListeEditeurs(Rafraichissable vueARafraichir) {
1066
		selectionnerStructureParProjet(vueARafraichir, null);
1067
		selectionnerStructureParProjet(vueARafraichir, null);
1067
	}
1068
	}
1068
 
1069
 
1069
	public void clicObtenirListeAuteurs(Rafraichissable vueARafraichir) {
1070
	public void clicObtenirListeAuteurs(Rafraichissable vueARafraichir) {
1070
		selectionnerPersonneParProjet(vueARafraichir, null);
1071
		selectionnerPersonneParProjet(vueARafraichir, null);
1071
	}
1072
	}
1072
	
1073
	
1073
	//+----------------------------------------------------------------------------------------------------------------+
1074
	//+----------------------------------------------------------------------------------------------------------------+
1074
	// GESTION de la relation PUBLICATION A PERSONNE
1075
	// GESTION de la relation PUBLICATION A PERSONNE
1075
 
1076
 
1076
	public void selectionnerPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, String personnesId, String roleId) {
1077
	public void selectionnerPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, String personnesId, String roleId) {
1077
		modele.selectionPublicationAPersonne(vueARafraichir, publicationId, personnesId, roleId);
1078
		modele.selectionPublicationAPersonne(vueARafraichir, publicationId, personnesId, roleId);
1078
	}
1079
	}
-
 
1080
	
-
 
1081
	public void selectionnerPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, String personnesId, List roleId) {
-
 
1082
		String roleIds = "";
-
 
1083
		Iterator<Valeur> itRole = roleId.iterator();
-
 
1084
		while (itRole.hasNext())	{
-
 
1085
			roleIds+= itRole.next().getId();
-
 
1086
			if (itRole.hasNext())	{
-
 
1087
				roleIds+=",";
-
 
1088
			}
-
 
1089
		}
-
 
1090
		modele.selectionPublicationAPersonne(vueARafraichir, publicationId, personnesId, roleIds);
-
 
1091
	}
1079
	
1092
	
1080
	public void ajouterPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, PublicationAPersonneListe personnesAjoutees, String roleId) {
1093
	public void ajouterPublicationAPersonne(Rafraichissable vueARafraichir, String publicationId, PublicationAPersonneListe personnesAjoutees, String roleId) {
1081
		if (personnesAjoutees != null && personnesAjoutees.size() > 0) {
1094
		if (personnesAjoutees != null && personnesAjoutees.size() > 0) {
1082
			String idPublicationAPersonneSepareParVirgule = "" ;
1095
			String idPublicationAPersonneSepareParVirgule = "" ;
1083
			for (Iterator<String> it = personnesAjoutees.keySet().iterator(); it.hasNext();) {
1096
			for (Iterator<String> it = personnesAjoutees.keySet().iterator(); it.hasNext();) {
1084
				idPublicationAPersonneSepareParVirgule += personnesAjoutees.get(it.next()).getIdPersonne();
1097
				idPublicationAPersonneSepareParVirgule += personnesAjoutees.get(it.next()).getIdPersonne();
1085
				if (it.hasNext()) {
1098
				if (it.hasNext()) {
1086
					idPublicationAPersonneSepareParVirgule += ",";
1099
					idPublicationAPersonneSepareParVirgule += ",";
1087
				}
1100
				}
1088
			}
1101
			}
1089
			modele.ajouterPublicationAPersonne(vueARafraichir, publicationId, idPublicationAPersonneSepareParVirgule, roleId);
1102
			modele.ajouterPublicationAPersonne(vueARafraichir, publicationId, idPublicationAPersonneSepareParVirgule, roleId);
1090
		}
1103
		}
1091
	}
1104
	}
1092
	
1105
	
1093
	public void supprimerPublicationAPersonne(Rafraichissable vueARafraichir, PublicationAPersonneListe personnesSupprimees) {
1106
	public void supprimerPublicationAPersonne(Rafraichissable vueARafraichir, PublicationAPersonneListe personnesSupprimees) {
1094
		if (personnesSupprimees != null && personnesSupprimees.size() > 0) {
1107
		if (personnesSupprimees != null && personnesSupprimees.size() > 0) {
1095
			String idPublicationAPersonneSepareParVirgule = "" ;
1108
			String idPublicationAPersonneSepareParVirgule = "" ;
1096
			for (Iterator<String> it = personnesSupprimees.keySet().iterator(); it.hasNext();) {
1109
			for (Iterator<String> it = personnesSupprimees.keySet().iterator(); it.hasNext();) {
1097
				idPublicationAPersonneSepareParVirgule += personnesSupprimees.get(it.next()).getId();
1110
				idPublicationAPersonneSepareParVirgule += personnesSupprimees.get(it.next()).getId();
1098
				if (it.hasNext()) {
1111
				if (it.hasNext()) {
1099
					idPublicationAPersonneSepareParVirgule += ",";
1112
					idPublicationAPersonneSepareParVirgule += ",";
1100
				}
1113
				}
1101
			}
1114
			}
1102
			modele.supprimerPublicationAPersonne(vueARafraichir, idPublicationAPersonneSepareParVirgule);
1115
			modele.supprimerPublicationAPersonne(vueARafraichir, idPublicationAPersonneSepareParVirgule);
1103
		}
1116
		}
1104
	}
1117
	}
1105
	
1118
	
1106
	//Lier plusieurs publication à une personne
1119
	//Lier plusieurs publication à une personne
1107
	public void ajouterPublicationAPersonne(Rafraichissable vueARafraichir, PublicationAPersonneListe listePublications, String personneId, String roleId) {
1120
	public void ajouterPublicationAPersonne(Rafraichissable vueARafraichir, PublicationAPersonneListe listePublications, String personneId, String roleId) {
1108
		if (listePublications!=null && listePublications.size()>0)	{
1121
		if (listePublications!=null && listePublications.size()>0)	{
1109
			String idsPubli = "";
1122
			String idsPubli = "";
-
 
1123
			String rolesIds = "";
1110
			for (Iterator<String> it = listePublications.keySet().iterator(); it.hasNext();) {
1124
			for (Iterator<String> it = listePublications.keySet().iterator(); it.hasNext();) {
1111
				idsPubli += listePublications.get(it.next()).getId();
1125
				PublicationAPersonne publi = listePublications.get(it.next());
-
 
1126
				idsPubli += publi.getId();
-
 
1127
				rolesIds += publi.getRole();
1112
				if (it.hasNext()) {
1128
				if (it.hasNext()) {
1113
					idsPubli += ",";
1129
					idsPubli += ",";
-
 
1130
					rolesIds += ",";
1114
				}
1131
				}
1115
			}			
1132
			}			
1116
			modele.ajouterPublicationAPersonne(vueARafraichir, idsPubli, personneId, roleId);
1133
			modele.ajouterPublicationAPersonne(vueARafraichir, idsPubli, personneId, rolesIds);
1117
		}
1134
		}
1118
	}
1135
	}
1119
	
1136
	
1120
	//+----------------------------------------------------------------------------------------------------------------+
1137
	//+----------------------------------------------------------------------------------------------------------------+
1121
	//												GESTION DES COMMENTAIRES
1138
	//												GESTION DES COMMENTAIRES
1122
	//+----------------------------------------------------------------------------------------------------------------+
1139
	//+----------------------------------------------------------------------------------------------------------------+
1123
 
1140
 
1124
	public void afficherListeCommentaire(CommentaireListe nouvelleDonnees) {
1141
	public void afficherListeCommentaire(CommentaireListe nouvelleDonnees) {
1125
		if (!(panneauCentre.getContenu() instanceof CommentaireVue)) {
1142
		if (!(panneauCentre.getContenu() instanceof CommentaireVue)) {
1126
			panneauCentre.removeAll();
1143
			panneauCentre.removeAll();
1127
			panneauCentre.add(new CommentaireVue(this));
1144
			panneauCentre.add(new CommentaireVue(this));
1128
		}	
1145
		}	
1129
		
1146
		
1130
		panneauCentre.getContenu().rafraichir(nouvelleDonnees);	
1147
		panneauCentre.getContenu().rafraichir(nouvelleDonnees);	
1131
	}
1148
	}
1132
	
1149
	
1133
	public void afficherFormCommentaire(String commentaireId) {
1150
	public void afficherFormCommentaire(String commentaireId) {
1134
		panneauCentre.removeAll();
1151
		panneauCentre.removeAll();
1135
		CommentaireForm commentaireForm = new CommentaireForm(this, commentaireId);
1152
		CommentaireForm commentaireForm = new CommentaireForm(this, commentaireId);
1136
		panneauCentre.add(commentaireForm);
1153
		panneauCentre.add(commentaireForm);
1137
		
1154
		
1138
		panneauCentre.layout();
1155
		panneauCentre.layout();
1139
	}
1156
	}
1140
	
1157
	
1141
	public void clicListeCommentaire(Commentaire commentaire) {
1158
	public void clicListeCommentaire(Commentaire commentaire) {
1142
		if (commentaire != null) {
1159
		if (commentaire != null) {
1143
			panneauCentre.getContenu().rafraichir(commentaire);	
1160
			panneauCentre.getContenu().rafraichir(commentaire);	
1144
		}
1161
		}
1145
	}
1162
	}
1146
 
1163
 
1147
	public void clicAjouterCommentaire() {
1164
	public void clicAjouterCommentaire() {
1148
		afficherFormCommentaire(null);
1165
		afficherFormCommentaire(null);
1149
	}
1166
	}
1150
	
1167
	
1151
	public void clicModifierCommentaire(List<Commentaire> selection) {
1168
	public void clicModifierCommentaire(List<Commentaire> selection) {
1152
		if (selection.size() == 0) {
1169
		if (selection.size() == 0) {
1153
			Info.display("Information", "Veuillez sélectionner un commentaire.");
1170
			Info.display("Information", "Veuillez sélectionner un commentaire.");
1154
		} else if (selection.size() > 1) {
1171
		} else if (selection.size() > 1) {
1155
			Info.display("Information", "Veuillez sélectionner un seul commentaire à la fois.");
1172
			Info.display("Information", "Veuillez sélectionner un seul commentaire à la fois.");
1156
		} else if (selection.size() == 1) {
1173
		} else if (selection.size() == 1) {
1157
			afficherFormCommentaire(selection.get(0).getId());
1174
			afficherFormCommentaire(selection.get(0).getId());
1158
		} else {
1175
		} else {
1159
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierCommentaire() du Médiateur.");
1176
			Info.display("Erreur", "Une erreur est survenue dans la méthode clicModifierCommentaire() du Médiateur.");
1160
		}
1177
		}
1161
	}
1178
	}
1162
	
1179
	
1163
	public void clicSupprimerCommentaire(final List<Commentaire> commentaireListe) {
1180
	public void clicSupprimerCommentaire(final List<Commentaire> commentaireListe) {
1164
		if (commentaireListe.size() <= 0) {
1181
		if (commentaireListe.size() <= 0) {
1165
			MessageBox.alert("Attention", "Vous devez sélectionner un commentaire", null); 
1182
			MessageBox.alert("Attention", "Vous devez sélectionner un commentaire", null); 
1166
		} else {
1183
		} else {
1167
			String message = "Voulez-vous vraiment supprimer ces commentaires ?";
1184
			String message = "Voulez-vous vraiment supprimer ces commentaires ?";
1168
			if (commentaireListe.size() == 1) {
1185
			if (commentaireListe.size() == 1) {
1169
				message = "Voulez-vous vraiment supprimer ce commentaire ?";
1186
				message = "Voulez-vous vraiment supprimer ce commentaire ?";
1170
			}
1187
			}
1171
			
1188
			
1172
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
1189
			final Listener<MessageBoxEvent> listenerSuppression = new Listener<MessageBoxEvent>() { 
1173
				public void handleEvent(MessageBoxEvent ce) {  
1190
				public void handleEvent(MessageBoxEvent ce) {  
1174
					Dialog dialog = (Dialog) ce.getComponent();
1191
					Dialog dialog = (Dialog) ce.getComponent();
1175
				    Button btn = ce.getButtonClicked();  
1192
				    Button btn = ce.getButtonClicked();  
1176
				    	   
1193
				    	   
1177
				    if (btn.getText().equals(dialog.yesText)) {
1194
				    if (btn.getText().equals(dialog.yesText)) {
1178
				    	supprimerCommentaire(panneauCentre.getContenu(), commentaireListe);
1195
				    	supprimerCommentaire(panneauCentre.getContenu(), commentaireListe);
1179
				    }
1196
				    }
1180
				}
1197
				}
1181
			};
1198
			};
1182
				     
1199
				     
1183
			MessageBox.confirm("Supprimer un commentaire", message, listenerSuppression);
1200
			MessageBox.confirm("Supprimer un commentaire", message, listenerSuppression);
1184
		}
1201
		}
1185
	}
1202
	}
1186
	
1203
	
1187
	public void selectionnerCommentaire(Rafraichissable vueARafraichir, String commentaireId) {
1204
	public void selectionnerCommentaire(Rafraichissable vueARafraichir, String commentaireId) {
1188
		modele.selectionnerCommentaire(vueARafraichir, commentaireId, getProjetId(), null);
1205
		modele.selectionnerCommentaire(vueARafraichir, commentaireId, getProjetId(), null);
1189
	}
1206
	}
1190
	
1207
	
1191
	public void selectionnerCommentaireParTitre(Rafraichissable vueARafraichir, String titre) {
1208
	public void selectionnerCommentaireParTitre(Rafraichissable vueARafraichir, String titre) {
1192
		modele.selectionnerCommentaire(vueARafraichir, null, getProjetId(), titre);
1209
		modele.selectionnerCommentaire(vueARafraichir, null, getProjetId(), titre);
1193
	}
1210
	}
1194
	
1211
	
1195
	public void ajouterCommentaire(Rafraichissable vueARafraichir, Commentaire commentaire) {
1212
	public void ajouterCommentaire(Rafraichissable vueARafraichir, Commentaire commentaire) {
1196
		modele.ajouterCommentaire(vueARafraichir, commentaire);
1213
		modele.ajouterCommentaire(vueARafraichir, commentaire);
1197
	}
1214
	}
1198
	
1215
	
1199
	public void modifierCommentaire(Rafraichissable vueARafraichir, Commentaire commentaire) {
1216
	public void modifierCommentaire(Rafraichissable vueARafraichir, Commentaire commentaire) {
1200
		modele.modifierCommentaire(vueARafraichir, commentaire);
1217
		modele.modifierCommentaire(vueARafraichir, commentaire);
1201
	}
1218
	}
1202
	
1219
	
1203
	public void supprimerCommentaire(Rafraichissable vueARafraichir, List<Commentaire> commentairesListe) {
1220
	public void supprimerCommentaire(Rafraichissable vueARafraichir, List<Commentaire> commentairesListe) {
1204
		if (commentairesListe != null && commentairesListe.size() > 0) {
1221
		if (commentairesListe != null && commentairesListe.size() > 0) {
1205
			String idCommentaireSeparesParVirgule = "" ;
1222
			String idCommentaireSeparesParVirgule = "" ;
1206
			Iterator<Commentaire> it = commentairesListe.iterator();
1223
			Iterator<Commentaire> it = commentairesListe.iterator();
1207
			while (it.hasNext()) {
1224
			while (it.hasNext()) {
1208
				idCommentaireSeparesParVirgule += it.next().getId();
1225
				idCommentaireSeparesParVirgule += it.next().getId();
1209
				if (it.hasNext()) {
1226
				if (it.hasNext()) {
1210
					idCommentaireSeparesParVirgule += ",";
1227
					idCommentaireSeparesParVirgule += ",";
1211
				}
1228
				}
1212
			}
1229
			}
1213
			modele.supprimerCommentaire(vueARafraichir, idCommentaireSeparesParVirgule);
1230
			modele.supprimerCommentaire(vueARafraichir, idCommentaireSeparesParVirgule);
1214
			modele.supprimerCollectionACommentaire(vueARafraichir, idCommentaireSeparesParVirgule, CollectionACommentaireAsyncDao.SUPPRESSION_PAR_COMMENTAIRE);
1231
			modele.supprimerCollectionACommentaire(vueARafraichir, idCommentaireSeparesParVirgule, CollectionACommentaireAsyncDao.SUPPRESSION_PAR_COMMENTAIRE);
1215
		}
1232
		}
1216
	}
1233
	}
1217
	
1234
	
1218
	//+----------------------------------------------------------------------------------------------------------------+
1235
	//+----------------------------------------------------------------------------------------------------------------+
1219
	//												RAFRAICHISSEMENT
1236
	//												RAFRAICHISSEMENT
1220
	//+----------------------------------------------------------------------------------------------------------------+
1237
	//+----------------------------------------------------------------------------------------------------------------+
1221
	
1238
	
1222
	public void rafraichir(Object nouvellesDonnees) {
1239
	public void rafraichir(Object nouvellesDonnees) {
1223
		if (nouvellesDonnees instanceof Utilisateur) {
1240
		if (nouvellesDonnees instanceof Utilisateur) {
1224
			repandreEtatIdentification((Utilisateur) nouvellesDonnees);
1241
			repandreEtatIdentification((Utilisateur) nouvellesDonnees);
1225
		} else if (nouvellesDonnees instanceof Information) {
1242
		} else if (nouvellesDonnees instanceof Information) {
1226
			Information info = (Information) nouvellesDonnees;
1243
			Information info = (Information) nouvellesDonnees;
1227
			if (info.getType().equals("modification_personne")) {
1244
			if (info.getType().equals("modification_personne")) {
1228
				repandreInfoMiseAJourUtilisateur();
1245
				repandreInfoMiseAJourUtilisateur();
1229
			}
1246
			}
1230
		} else {
1247
		} else {
1231
			GWT.log(i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
1248
			GWT.log(i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
1232
		}
1249
		}
1233
	}
1250
	}
1234
	
1251
	
1235
	//+----------------------------------------------------------------------------------------------------------------+
1252
	//+----------------------------------------------------------------------------------------------------------------+
1236
	//												GESTION du STATUT
1253
	//												GESTION du STATUT
1237
	//+----------------------------------------------------------------------------------------------------------------+
1254
	//+----------------------------------------------------------------------------------------------------------------+
1238
	
1255
	
1239
	public void afficherPopinChargement()	{
1256
	public void afficherPopinChargement()	{
1240
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).center();
1257
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).center();
1241
	}
1258
	}
1242
		
1259
		
1243
	public void masquerPopinChargement()	{		
1260
	public void masquerPopinChargement()	{		
1244
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).hide();
1261
		((PopupChargement) Registry.get(RegistreId.POPUP_CHARGEMENT)).hide();
1245
	}
1262
	}
1246
 
1263
 
1247
}
1264
}