Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 687 Rev 703
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.List;
6
import java.util.List;
7
 
7
 
8
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.Mediateur;
9
import org.tela_botanica.client.RegistreId;
9
import org.tela_botanica.client.RegistreId;
10
import org.tela_botanica.client.composants.ChampMultiValeurs;
10
import org.tela_botanica.client.composants.ChampMultiValeurs;
11
import org.tela_botanica.client.images.Images;
11
import org.tela_botanica.client.images.Images;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.modeles.Collection;
13
import org.tela_botanica.client.modeles.Collection;
14
import org.tela_botanica.client.modeles.CollectionListe;
14
import org.tela_botanica.client.modeles.CollectionListe;
15
import org.tela_botanica.client.modeles.Configuration;
15
import org.tela_botanica.client.modeles.Configuration;
16
import org.tela_botanica.client.modeles.Information;
16
import org.tela_botanica.client.modeles.Information;
17
import org.tela_botanica.client.modeles.MenuApplicationId;
17
import org.tela_botanica.client.modeles.MenuApplicationId;
18
import org.tela_botanica.client.modeles.Projet;
18
import org.tela_botanica.client.modeles.Projet;
19
import org.tela_botanica.client.modeles.ProjetListe;
19
import org.tela_botanica.client.modeles.ProjetListe;
20
import org.tela_botanica.client.modeles.Structure;
20
import org.tela_botanica.client.modeles.Structure;
21
import org.tela_botanica.client.modeles.StructureListe;
21
import org.tela_botanica.client.modeles.StructureListe;
22
import org.tela_botanica.client.modeles.Valeur;
22
import org.tela_botanica.client.modeles.Valeur;
23
import org.tela_botanica.client.modeles.ValeurListe;
23
import org.tela_botanica.client.modeles.ValeurListe;
24
 
24
 
25
import com.extjs.gxt.ui.client.Registry;
25
import com.extjs.gxt.ui.client.Registry;
26
import com.extjs.gxt.ui.client.Style.SortDir;
26
import com.extjs.gxt.ui.client.Style.SortDir;
27
import com.extjs.gxt.ui.client.event.BaseEvent;
27
import com.extjs.gxt.ui.client.event.BaseEvent;
28
import com.extjs.gxt.ui.client.event.ButtonEvent;
28
import com.extjs.gxt.ui.client.event.ButtonEvent;
29
import com.extjs.gxt.ui.client.event.ComponentEvent;
29
import com.extjs.gxt.ui.client.event.ComponentEvent;
30
import com.extjs.gxt.ui.client.event.EventType;
30
import com.extjs.gxt.ui.client.event.EventType;
31
import com.extjs.gxt.ui.client.event.Events;
31
import com.extjs.gxt.ui.client.event.Events;
32
import com.extjs.gxt.ui.client.event.Listener;
32
import com.extjs.gxt.ui.client.event.Listener;
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
34
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
34
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
35
import com.extjs.gxt.ui.client.event.SelectionListener;
35
import com.extjs.gxt.ui.client.event.SelectionListener;
36
import com.extjs.gxt.ui.client.event.WidgetListener;
36
import com.extjs.gxt.ui.client.event.WidgetListener;
37
import com.extjs.gxt.ui.client.store.ListStore;
37
import com.extjs.gxt.ui.client.store.ListStore;
38
import com.extjs.gxt.ui.client.store.Store;
38
import com.extjs.gxt.ui.client.store.Store;
39
import com.extjs.gxt.ui.client.store.StoreEvent;
39
import com.extjs.gxt.ui.client.store.StoreEvent;
40
import com.extjs.gxt.ui.client.store.StoreListener;
40
import com.extjs.gxt.ui.client.store.StoreListener;
41
import com.extjs.gxt.ui.client.widget.Component;
41
import com.extjs.gxt.ui.client.widget.Component;
42
import com.extjs.gxt.ui.client.widget.Info;
42
import com.extjs.gxt.ui.client.widget.Info;
43
import com.extjs.gxt.ui.client.widget.LayoutContainer;
43
import com.extjs.gxt.ui.client.widget.LayoutContainer;
44
import com.extjs.gxt.ui.client.widget.MessageBox;
44
import com.extjs.gxt.ui.client.widget.MessageBox;
45
import com.extjs.gxt.ui.client.widget.TabItem;
45
import com.extjs.gxt.ui.client.widget.TabItem;
46
import com.extjs.gxt.ui.client.widget.TabPanel;
46
import com.extjs.gxt.ui.client.widget.TabPanel;
47
import com.extjs.gxt.ui.client.widget.Text;
47
import com.extjs.gxt.ui.client.widget.Text;
48
import com.extjs.gxt.ui.client.widget.button.Button;
48
import com.extjs.gxt.ui.client.widget.button.Button;
49
import com.extjs.gxt.ui.client.widget.form.ComboBox;
49
import com.extjs.gxt.ui.client.widget.form.ComboBox;
50
import com.extjs.gxt.ui.client.widget.form.Field;
50
import com.extjs.gxt.ui.client.widget.form.Field;
51
import com.extjs.gxt.ui.client.widget.form.FieldSet;
51
import com.extjs.gxt.ui.client.widget.form.FieldSet;
52
import com.extjs.gxt.ui.client.widget.form.HiddenField;
52
import com.extjs.gxt.ui.client.widget.form.HiddenField;
53
import com.extjs.gxt.ui.client.widget.form.LabelField;
53
import com.extjs.gxt.ui.client.widget.form.LabelField;
54
import com.extjs.gxt.ui.client.widget.form.NumberField;
54
import com.extjs.gxt.ui.client.widget.form.NumberField;
55
import com.extjs.gxt.ui.client.widget.form.Radio;
55
import com.extjs.gxt.ui.client.widget.form.Radio;
56
import com.extjs.gxt.ui.client.widget.form.TextArea;
56
import com.extjs.gxt.ui.client.widget.form.TextArea;
57
import com.extjs.gxt.ui.client.widget.form.TextField;
57
import com.extjs.gxt.ui.client.widget.form.TextField;
58
import com.extjs.gxt.ui.client.widget.form.Validator;
58
import com.extjs.gxt.ui.client.widget.form.Validator;
59
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
59
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
60
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
60
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
61
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
61
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
62
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
62
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
63
import com.extjs.gxt.ui.client.widget.layout.FormData;
63
import com.extjs.gxt.ui.client.widget.layout.FormData;
64
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
64
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
65
import com.google.gwt.core.client.GWT;
65
import com.google.gwt.core.client.GWT;
66
import com.google.gwt.i18n.client.NumberFormat;
66
import com.google.gwt.i18n.client.NumberFormat;
67
import com.google.gwt.user.client.ui.Widget;
67
import com.google.gwt.user.client.ui.Widget;
68
 
68
 
69
public class CollectionForm extends Formulaire implements Rafraichissable {
69
public class CollectionForm extends Formulaire implements Rafraichissable {
70
 
70
 
71
	private Collection collection = null;
71
	private Collection collection = null;
72
	private Collection collectionCollectee = null;
72
	private Collection collectionCollectee = null;
73
 
-
 
74
	private HashMap<String,FieldSet> champsFs = new HashMap<String,FieldSet>();
-
 
75
	private HashMap<String,LayoutContainer> champsLc = new HashMap<String,LayoutContainer>();
-
 
76
	private HashMap<String,HiddenField<String>> champsHfs = new HashMap<String,HiddenField<String>>();
-
 
77
	private HashMap<String,TextField<String>> champsTfs = new HashMap<String,TextField<String>>();
-
 
78
	private HashMap<String,TextArea> champsTa = new HashMap<String,TextArea>();
-
 
79
	private HashMap<String,ChampMultiValeurs> champsCmv = new HashMap<String,ChampMultiValeurs>();
-
 
80
	private HashMap<String,Text> champsT = new HashMap<String,Text>();
73
 
81
	private HashMap<String,ComboBox<Valeur>> champsCbv = new HashMap<String,ComboBox<Valeur>>();
74
	private HashMap<String,ComboBox<Valeur>> champsCbv = new HashMap<String,ComboBox<Valeur>>();
82
	private HashMap<String,ListStore<Valeur>> champsLsv = new HashMap<String,ListStore<Valeur>>();
75
	private HashMap<String,ListStore<Valeur>> champsLsv = new HashMap<String,ListStore<Valeur>>();
83
	
76
	
84
	private TabItem generalOnglet = null;
77
	private TabItem generalOnglet = null;
85
	private TabItem auteurOnglet = null;
78
	private TabItem auteurOnglet = null;
86
	private TabItem publicationOnglet = null;
79
	private TabItem publicationOnglet = null;
87
	private TabItem descriptionOnglet = null;
80
	private TabItem descriptionOnglet = null;
88
	private TabItem contenuOnglet = null;
81
	private TabItem contenuOnglet = null;
89
	private TabItem documentOnglet = null;
82
	private TabItem documentOnglet = null;
90
	private TabItem inventaireOnglet = null;
83
	private TabItem inventaireOnglet = null;
91
	
-
 
92
	private ListStore<Projet> projetsStore;
-
 
93
	private ComboBox<Projet> projetsCombo;
-
 
94
	private ListStore<Structure> structuresStore;
-
 
95
	private ComboBox<Structure> structuresCombo;
-
 
96
	private ListStore<Collection> collectionsStore;
-
 
97
	private ComboBox<Collection> collectionsCombo;
-
 
98
 
-
 
99
 
84
	
100
	public CollectionForm(Mediateur mediateurCourrant, String modeDeCreation) {
85
	public CollectionForm(Mediateur mediateurCourrant, String modeDeCreation) {
101
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COLLECTION);
86
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COLLECTION);
102
	}
87
	}
103
	
88
	
104
	protected void creerOnglets() {
89
	protected void creerOnglets() {
105
		onglets = new TabPanel();
90
		onglets = new TabPanel();
106
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
91
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
107
		onglets.setHeight("100%");
92
		onglets.setHeight("100%");
108
		
93
		
109
		// Onlget formulaire GENERAL
94
		// Onlget formulaire GENERAL
110
		onglets.add(creerOngletGeneral());
95
		onglets.add(creerOngletGeneral());
111
		
96
		
112
		// Onlget formulaire AUTEUR
97
		// Onlget formulaire AUTEUR
113
		onglets.add(creerOngletAuteur());
98
		onglets.add(creerOngletAuteur());
114
		
99
		
115
		// Onlget formulaire PUBLICATION
100
		// Onlget formulaire PUBLICATION
116
		onglets.add(creerOngletPublication());
101
		onglets.add(creerOngletPublication());
117
		
102
		
118
		// Onlget formulaire DESCRIPTION
103
		// Onlget formulaire DESCRIPTION
119
		onglets.add(creerOngletDescription());
104
		onglets.add(creerOngletDescription());
120
		
105
		
121
		// Onlget formulaire CONTENU
106
		// Onlget formulaire CONTENU
122
		onglets.add(creerOngletContenu());
107
		onglets.add(creerOngletContenu());
123
		
108
		
124
		// Onlget formulaire DOCUMENT
109
		// Onlget formulaire DOCUMENT
125
		onglets.add(creerOngletDocument());
110
		onglets.add(creerOngletDocument());
126
		
111
		
127
		// Onlget formulaire INVENTAIRE
112
		// Onlget formulaire INVENTAIRE
128
		onglets.add(creerOngletInventaire());
113
		onglets.add(creerOngletInventaire());
129
		
114
		
130
		// Sélection de l'onglet par défaut
115
		// Sélection de l'onglet par défaut
131
		//onglets.setSelection(personnelOnglet);
116
		onglets.setSelection(auteurOnglet);
132
		
117
		
133
		// Ajout des onglets au formulaire général
118
		// Ajout des onglets au formulaire général
134
		panneauFormulaire.add(onglets);
119
		panneauFormulaire.add(onglets);
135
	}
120
	}
136
	
121
	
137
	private TabItem creerOngletGeneral() {
122
	private TabItem creerOngletGeneral() {
138
		generalOnglet = new CollectionFormGeneral(this);
123
		generalOnglet = new CollectionFormGeneral(this);
139
		return generalOnglet;
124
		return generalOnglet;
140
	}
125
	}
141
	
126
	
142
	private TabItem creerOngletAuteur() {
127
	private TabItem creerOngletAuteur() {
143
		auteurOnglet = creerOnglet(i18nC.collectionAuteur(), "auteur");
128
		auteurOnglet = new CollectionFormAuteur(this);
144
		auteurOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
-
 
145
			public void handleEvent(ComponentEvent be) {  
-
 
146
				//peuplerOngletAuteur();
-
 
147
				auteurOnglet.layout();
-
 
148
			}  
-
 
149
		});
-
 
150
		
-
 
151
		return auteurOnglet;
129
		return auteurOnglet;
152
	}
130
	}
153
	
131
	
154
	private TabItem creerOngletPublication() {
132
	private TabItem creerOngletPublication() {
155
		publicationOnglet = creerOnglet(i18nC.collectionPublication(), "publication");
133
		publicationOnglet = creerOnglet(i18nC.collectionPublication(), "publication");
156
		publicationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
134
		publicationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
157
			public void handleEvent(ComponentEvent be) {  
135
			public void handleEvent(ComponentEvent be) {  
158
				//peuplerOngletAuteur();
136
				//peuplerOngletAuteur();
159
				publicationOnglet.layout();
137
				publicationOnglet.layout();
160
			}  
138
			}  
161
		});
139
		});
162
		
140
		
163
		return publicationOnglet;
141
		return publicationOnglet;
164
	}
142
	}
165
	
143
	
166
	private TabItem creerOngletDescription() {
144
	private TabItem creerOngletDescription() {
167
		descriptionOnglet = creerOnglet(i18nC.collectionDescription(), "description");
145
		descriptionOnglet = creerOnglet(i18nC.collectionDescription(), "description");
168
		descriptionOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
146
		descriptionOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
169
			public void handleEvent(ComponentEvent be) {  
147
			public void handleEvent(ComponentEvent be) {  
170
				//peuplerOngletDescription();
148
				//peuplerOngletDescription();
171
				descriptionOnglet.layout();
149
				descriptionOnglet.layout();
172
			}  
150
			}  
173
		});
151
		});
174
		
152
		
175
		return descriptionOnglet;
153
		return descriptionOnglet;
176
	}
154
	}
177
	
155
	
178
	private TabItem creerOngletContenu() {
156
	private TabItem creerOngletContenu() {
179
		contenuOnglet = creerOnglet(i18nC.collectionContenu(), "contenu");
157
		contenuOnglet = creerOnglet(i18nC.collectionContenu(), "contenu");
180
		contenuOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
158
		contenuOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
181
			public void handleEvent(ComponentEvent be) {  
159
			public void handleEvent(ComponentEvent be) {  
182
				//peuplerOngletContenu();
160
				//peuplerOngletContenu();
183
				contenuOnglet.layout();
161
				contenuOnglet.layout();
184
			}  
162
			}  
185
		});
163
		});
186
		
164
		
187
		return contenuOnglet;
165
		return contenuOnglet;
188
	}
166
	}
189
	
167
	
190
	private TabItem creerOngletDocument() {
168
	private TabItem creerOngletDocument() {
191
		documentOnglet = creerOnglet(i18nC.collectionDocument(), "document");
169
		documentOnglet = creerOnglet(i18nC.collectionDocument(), "document");
192
		documentOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
170
		documentOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
193
			public void handleEvent(ComponentEvent be) {  
171
			public void handleEvent(ComponentEvent be) {  
194
				//peuplerOngletDocument();
172
				//peuplerOngletDocument();
195
				documentOnglet.layout();
173
				documentOnglet.layout();
196
			}  
174
			}  
197
		});
175
		});
198
		
176
		
199
		return documentOnglet;
177
		return documentOnglet;
200
	}
178
	}
201
	
179
	
202
	private TabItem creerOngletInventaire() {
180
	private TabItem creerOngletInventaire() {
203
		inventaireOnglet = creerOnglet(i18nC.collectionInventaire(), "inventaire");
181
		inventaireOnglet = creerOnglet(i18nC.collectionInventaire(), "inventaire");
204
		inventaireOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
182
		inventaireOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
205
			public void handleEvent(ComponentEvent be) {  
183
			public void handleEvent(ComponentEvent be) {  
206
				//peuplerOngletInventaire();
184
				//peuplerOngletInventaire();
207
				inventaireOnglet.layout();
185
				inventaireOnglet.layout();
208
			}  
186
			}  
209
		});
187
		});
210
		
188
		
211
		return inventaireOnglet;
189
		return inventaireOnglet;
212
	}
190
	}
213
	
191
	
214
	public void rafraichir(Object nouvellesDonnees) {
192
	public void rafraichir(Object nouvellesDonnees) {
215
		try {
193
		try {
216
			if (nouvellesDonnees instanceof Information) {
194
			if (nouvellesDonnees instanceof Information) {
217
				Information info = (Information) nouvellesDonnees;
195
				Information info = (Information) nouvellesDonnees;
218
				rafraichirInformation(info);
196
				rafraichirInformation(info);
219
			} else if (nouvellesDonnees instanceof ValeurListe) {
-
 
220
				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
-
 
221
				rafraichirValeurListe(listeValeurs);
-
 
222
			} else {
197
			} else {
223
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
198
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
224
			}
199
			}
225
		} catch (Exception e) {
200
		} catch (Exception e) {
226
			GWT.log("rafraichir()", e);
201
			GWT.log("rafraichir()", e);
227
		}
202
		}
228
		verifierApresRafraichissement();
203
		verifierApresRafraichissement();
229
	}
204
	}
230
 
205
 
231
	private void rafraichirInformation(Information info) {
206
	private void rafraichirInformation(Information info) {
232
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
207
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
233
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
208
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
234
		}
209
		}
235
		
210
		
236
		if (info.getType().equals("modif_structure")) {
211
		if (info.getType().equals("modif_structure")) {
237
			Info.display("Modification d'une collection", info.toString());
212
			Info.display("Modification d'une collection", info.toString());
238
		} else if (info.getType().equals("selection_collection")) {
213
		} else if (info.getType().equals("selection_collection")) {
239
			Info.display("Modification d'une collection", info.toString());
214
			Info.display("Modification d'une collection", info.toString());
240
			if (info.getDonnee(0) != null) {
215
			if (info.getDonnee(0) != null) {
241
				collection = (Collection) info.getDonnee(0);
216
				collection = (Collection) info.getDonnee(0);
242
			}
217
			}
243
			actualiserPeuplementOnglet();
218
			actualiserPeuplementOnglet();
244
			actualiserTitrePanneau();
219
			actualiserTitrePanneau();
245
		}
220
		}
246
	}
-
 
247
	
-
 
248
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
-
 
249
		List<Valeur> liste = listeValeurs.toList();
-
 
250
 
-
 
251
		// Test pour savoir si la liste contient des éléments
-
 
252
		if (liste.size() > 0) {
-
 
253
			String[] listesTraitables = {};
-
 
254
			
-
 
255
			Boolean implemente = false;
-
 
256
			for (int i = 0; i < listesTraitables.length;  i++) {
-
 
257
				String id = listesTraitables[i];
-
 
258
				GWT.log(id, null);
-
 
259
				if (listeValeurs.getId().equals(config.getListeId(id))) {
-
 
260
					champsLsv.get(id).removeAll();
-
 
261
					champsLsv.get(id).add(liste);
-
 
262
					champsCbv.get(id).setStore(champsLsv.get(id));
-
 
263
					implemente = true;
-
 
264
					break;
-
 
265
				}
-
 
266
			}
-
 
267
			if (implemente == false) {
-
 
268
				GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
-
 
269
			}
-
 
270
		}
-
 
271
	}
221
	}
272
	
222
	
273
	private void actualiserPeuplementOnglet() {
223
	private void actualiserPeuplementOnglet() {
274
		onglets.setSelection(onglets.getSelectedItem());
224
		onglets.setSelection(onglets.getSelectedItem());
275
	}
225
	}
276
 
226
 
277
	private void actualiserTitrePanneau() {
227
	private void actualiserTitrePanneau() {
278
		String titre = i18nC.titreModifFormCollection();
228
		String titre = i18nC.titreModifFormCollection();
279
		// Composition du titre
229
		// Composition du titre
280
		titre += " - ID : "+collection.getId();
230
		titre += " - ID : "+collection.getId();
281
		panneauFormulaire.setHeading(titre);		
231
		panneauFormulaire.setHeading(titre);		
282
	}
232
	}
283
 
233
 
284
	@Override
234
	@Override
285
	protected SelectionListener<ButtonEvent> creerEcouteurBoutonFormulaire(final String code) {
235
	protected SelectionListener<ButtonEvent> creerEcouteurBoutonFormulaire(final String code) {
286
		SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
236
		SelectionListener<ButtonEvent> ecouteur = new SelectionListener<ButtonEvent>() {
287
			@Override
237
			@Override
288
			public void componentSelected(ButtonEvent ce) {
238
			public void componentSelected(ButtonEvent ce) {
289
				if (code.equals(Formulaire.CODE_BOUTON_VALIDER)) {
239
				if (code.equals(Formulaire.CODE_BOUTON_VALIDER)) {
290
					soumettreFormulaire();
240
					soumettreFormulaire();
291
					clicBoutonvalidation = true;
241
					clicBoutonvalidation = true;
292
				} else if (code.equals(Formulaire.CODE_BOUTON_APPLIQUER)) {
242
				} else if (code.equals(Formulaire.CODE_BOUTON_APPLIQUER)) {
293
					soumettreFormulaire();
243
					soumettreFormulaire();
294
				} else if (code.equals(Formulaire.CODE_BOUTON_ANNULER)) {
244
				} else if (code.equals(Formulaire.CODE_BOUTON_ANNULER)) {
295
					mediateur.clicMenu(menuIdCourant);
245
					mediateur.clicMenu(menuIdCourant);
296
				} else if (code.equals(Formulaire.CODE_BOUTON_REINITIALISER)) {
246
				} else if (code.equals(Formulaire.CODE_BOUTON_REINITIALISER)) {
297
					if (mode.equals(StructureForm.MODE_MODIFIER)) {
247
					if (mode.equals(StructureForm.MODE_MODIFIER)) {
298
						mediateur.afficherFormCollection(collection.getId());
248
						mediateur.afficherFormCollection(collection.getId());
299
					} else {
249
					} else {
300
						mediateur.afficherFormCollection(null);
250
						mediateur.afficherFormCollection(null);
301
					}
251
					}
302
				}
252
				}
303
			}
253
			}
304
		};
254
		};
305
		
255
		
306
		return ecouteur;
256
		return ecouteur;
307
	}
257
	}
308
	
258
	
309
	protected void soumettreFormulaire() {
259
	protected void soumettreFormulaire() {
310
		// Vérification de la validité des champs du formulaire
260
		// Vérification de la validité des champs du formulaire
311
		if (verifierFormulaire()) {
261
		if (verifierFormulaire()) {
312
			// Collecte des données du formulaire
262
			// Collecte des données du formulaire
313
			Collection collection = collecterCollection();
263
			Collection collection = collecterCollection();
314
			
264
			
315
			if (mode.equals(MODE_AJOUTER)) {
265
			if (mode.equals(MODE_AJOUTER)) {
316
				mediateur.ajouterCollection(this, collection);
266
				mediateur.ajouterCollection(this, collection);
317
			} else if (mode.equals(MODE_MODIFIER)) {
267
			} else if (mode.equals(MODE_MODIFIER)) {
318
				if (collection == null) {
268
				if (collection == null) {
319
					Info.display("Modification d'une collection", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
269
					Info.display("Modification d'une collection", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
320
				} else {
270
				} else {
321
					mediateur.modifierCollection(this, collection);
271
					mediateur.modifierCollection(this, collection);
322
				}
272
				}
323
			}
273
			}
324
		}
274
		}
325
	}
275
	}
326
	
276
	
327
	private Collection collecterCollection() {
277
	private Collection collecterCollection() {
328
		collectionCollectee = (Collection) collection.cloner(new Collection());
278
		collectionCollectee = (Collection) collection.cloner(new Collection());
329
		
279
		
330
		collecterOngletGeneral();
280
		collecterOngletGeneral();
331
		
281
		
332
		Collection collectionARetourner = null;
282
		Collection collectionARetourner = null;
333
		if (!collectionCollectee.comparer(collection)) {
283
		if (!collectionCollectee.comparer(collection)) {
334
			collectionARetourner = collection = collectionCollectee;
284
			collectionARetourner = collection = collectionCollectee;
335
		}
285
		}
336
		return collectionARetourner;
286
		return collectionARetourner;
337
	}
287
	}
338
	
288
	
339
	private void collecterOngletGeneral() {
289
	private void collecterOngletGeneral() {
340
		if (generalOnglet.getData("acces").equals(true)) {
290
		if (generalOnglet.getData("acces").equals(true)) {
341
			
291
			
342
		}
292
		}
343
	}
293
	}
344
	
294
	
345
	private Boolean verifierFormulaire() {
295
	private Boolean verifierFormulaire() {
346
		return true;
296
		return true;
347
	}
297
	}
348
 
298
 
349
	@Override
299
	@Override
350
	protected void afficherChampSupplementaire(Radio radioBtn) {
300
	protected void afficherChampSupplementaire(Radio radioBtn) {
351
		// TODO Auto-generated method stub
301
		// TODO Auto-generated method stub
352
		
302
		
353
	}
303
	}
354
}
304
}