Subversion Repositories eFlore/Applications.coel

Rev

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

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