Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1637 Rev 1661
1
package org.tela_botanica.client.vues.structure;
1
package org.tela_botanica.client.vues.structure;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Date;
4
import java.util.Date;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.LinkedList;
6
import java.util.LinkedList;
7
import java.util.List;
7
import java.util.List;
8
 
8
 
9
import org.tela_botanica.client.ComposantClass;
9
import org.tela_botanica.client.ComposantClass;
10
import org.tela_botanica.client.Mediateur;
10
import org.tela_botanica.client.Mediateur;
11
import org.tela_botanica.client.RegistreId;
11
import org.tela_botanica.client.RegistreId;
12
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
12
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
13
import org.tela_botanica.client.composants.GrillePaginable;
13
import org.tela_botanica.client.composants.GrillePaginable;
14
import org.tela_botanica.client.composants.InfoLogger;
14
import org.tela_botanica.client.composants.InfoLogger;
15
import org.tela_botanica.client.composants.pagination.ProxyCollectionAPersonne;
15
import org.tela_botanica.client.composants.pagination.ProxyCollectionAPersonne;
16
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
16
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
17
import org.tela_botanica.client.composants.pagination.ProxyProjets;
17
import org.tela_botanica.client.composants.pagination.ProxyProjets;
18
import org.tela_botanica.client.composants.pagination.ProxyStructureAPersonne;
18
import org.tela_botanica.client.composants.pagination.ProxyStructureAPersonne;
19
import org.tela_botanica.client.composants.pagination.ProxyValeur;
19
import org.tela_botanica.client.composants.pagination.ProxyValeur;
20
import org.tela_botanica.client.images.Images;
20
import org.tela_botanica.client.images.Images;
21
import org.tela_botanica.client.interfaces.Rafraichissable;
21
import org.tela_botanica.client.interfaces.Rafraichissable;
22
import org.tela_botanica.client.modeles.Information;
22
import org.tela_botanica.client.modeles.Information;
23
import org.tela_botanica.client.modeles.InterneValeur;
23
import org.tela_botanica.client.modeles.InterneValeur;
24
import org.tela_botanica.client.modeles.InterneValeurListe;
24
import org.tela_botanica.client.modeles.InterneValeurListe;
25
import org.tela_botanica.client.modeles.MenuApplicationId;
25
import org.tela_botanica.client.modeles.MenuApplicationId;
26
import org.tela_botanica.client.modeles.Valeur;
26
import org.tela_botanica.client.modeles.Valeur;
27
import org.tela_botanica.client.modeles.ValeurListe;
27
import org.tela_botanica.client.modeles.ValeurListe;
28
import org.tela_botanica.client.modeles.aDonnee;
28
import org.tela_botanica.client.modeles.aDonnee;
29
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
29
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
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.structure.Structure;
34
import org.tela_botanica.client.modeles.structure.Structure;
35
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
35
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
36
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
36
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
37
import org.tela_botanica.client.modeles.structure.StructureConservation;
37
import org.tela_botanica.client.modeles.structure.StructureConservation;
38
import org.tela_botanica.client.modeles.structure.StructureValorisation;
38
import org.tela_botanica.client.modeles.structure.StructureValorisation;
39
import org.tela_botanica.client.synchronisation.Sequenceur;
39
import org.tela_botanica.client.synchronisation.Sequenceur;
40
import org.tela_botanica.client.util.Debug;
40
import org.tela_botanica.client.util.Debug;
41
import org.tela_botanica.client.util.Pattern;
41
import org.tela_botanica.client.util.Pattern;
42
import org.tela_botanica.client.util.UtilArray;
42
import org.tela_botanica.client.util.UtilArray;
43
import org.tela_botanica.client.util.UtilString;
43
import org.tela_botanica.client.util.UtilString;
44
import org.tela_botanica.client.vues.Formulaire;
44
import org.tela_botanica.client.vues.Formulaire;
45
import org.tela_botanica.client.vues.structure.StructureFormPersonne.EtatPersonnelStructure;
45
import org.tela_botanica.client.vues.structure.StructureFormPersonne.EtatPersonnelStructure;
46
 
46
 
47
import com.extjs.gxt.ui.client.Style.Scroll;
47
import com.extjs.gxt.ui.client.Style.Scroll;
48
import com.extjs.gxt.ui.client.data.ModelData;
48
import com.extjs.gxt.ui.client.data.ModelData;
49
import com.extjs.gxt.ui.client.data.ModelType;
49
import com.extjs.gxt.ui.client.data.ModelType;
50
import com.extjs.gxt.ui.client.event.Events;
50
import com.extjs.gxt.ui.client.event.Events;
51
import com.extjs.gxt.ui.client.Registry;
51
import com.extjs.gxt.ui.client.Registry;
52
import com.extjs.gxt.ui.client.event.BaseEvent;
52
import com.extjs.gxt.ui.client.event.BaseEvent;
53
import com.extjs.gxt.ui.client.event.ButtonEvent;
53
import com.extjs.gxt.ui.client.event.ButtonEvent;
54
import com.extjs.gxt.ui.client.event.ComponentEvent;
54
import com.extjs.gxt.ui.client.event.ComponentEvent;
55
import com.extjs.gxt.ui.client.event.EventType;
55
import com.extjs.gxt.ui.client.event.EventType;
56
import com.extjs.gxt.ui.client.event.KeyListener;
56
import com.extjs.gxt.ui.client.event.KeyListener;
57
import com.extjs.gxt.ui.client.event.Listener;
57
import com.extjs.gxt.ui.client.event.Listener;
58
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
58
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
59
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
59
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
60
import com.extjs.gxt.ui.client.event.SelectionListener;
60
import com.extjs.gxt.ui.client.event.SelectionListener;
61
import com.extjs.gxt.ui.client.store.ListStore;
61
import com.extjs.gxt.ui.client.store.ListStore;
62
import com.extjs.gxt.ui.client.store.Record;
62
import com.extjs.gxt.ui.client.store.Record;
63
import com.extjs.gxt.ui.client.store.Store;
63
import com.extjs.gxt.ui.client.store.Store;
64
import com.extjs.gxt.ui.client.store.StoreEvent;
64
import com.extjs.gxt.ui.client.store.StoreEvent;
65
import com.extjs.gxt.ui.client.widget.Component;
65
import com.extjs.gxt.ui.client.widget.Component;
66
import com.extjs.gxt.ui.client.widget.ContentPanel;
66
import com.extjs.gxt.ui.client.widget.ContentPanel;
67
import com.extjs.gxt.ui.client.widget.Html;
67
import com.extjs.gxt.ui.client.widget.Html;
68
import com.extjs.gxt.ui.client.widget.Info;
68
import com.extjs.gxt.ui.client.widget.Info;
69
import com.extjs.gxt.ui.client.widget.LayoutContainer;
69
import com.extjs.gxt.ui.client.widget.LayoutContainer;
70
import com.extjs.gxt.ui.client.widget.MessageBox;
70
import com.extjs.gxt.ui.client.widget.MessageBox;
71
import com.extjs.gxt.ui.client.widget.TabItem;
71
import com.extjs.gxt.ui.client.widget.TabItem;
72
import com.extjs.gxt.ui.client.widget.TabPanel;
72
import com.extjs.gxt.ui.client.widget.TabPanel;
73
import com.extjs.gxt.ui.client.widget.button.Button;
73
import com.extjs.gxt.ui.client.widget.button.Button;
74
import com.extjs.gxt.ui.client.widget.form.CheckBox;
74
import com.extjs.gxt.ui.client.widget.form.CheckBox;
75
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
75
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
76
import com.extjs.gxt.ui.client.widget.form.ComboBox;
76
import com.extjs.gxt.ui.client.widget.form.ComboBox;
77
import com.extjs.gxt.ui.client.widget.form.DateField;
77
import com.extjs.gxt.ui.client.widget.form.DateField;
78
import com.extjs.gxt.ui.client.widget.form.Field;
78
import com.extjs.gxt.ui.client.widget.form.Field;
79
import com.extjs.gxt.ui.client.widget.form.FieldSet;
79
import com.extjs.gxt.ui.client.widget.form.FieldSet;
80
import com.extjs.gxt.ui.client.widget.form.HiddenField;
80
import com.extjs.gxt.ui.client.widget.form.HiddenField;
81
import com.extjs.gxt.ui.client.widget.form.LabelField;
81
import com.extjs.gxt.ui.client.widget.form.LabelField;
82
import com.extjs.gxt.ui.client.widget.form.NumberField;
82
import com.extjs.gxt.ui.client.widget.form.NumberField;
83
import com.extjs.gxt.ui.client.widget.form.Radio;
83
import com.extjs.gxt.ui.client.widget.form.Radio;
84
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
84
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
85
import com.extjs.gxt.ui.client.widget.form.TextArea;
85
import com.extjs.gxt.ui.client.widget.form.TextArea;
86
import com.extjs.gxt.ui.client.widget.form.TextField;
86
import com.extjs.gxt.ui.client.widget.form.TextField;
87
import com.extjs.gxt.ui.client.widget.form.Validator;
87
import com.extjs.gxt.ui.client.widget.form.Validator;
88
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
88
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
89
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
89
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
90
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
90
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
91
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
91
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
92
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
92
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
93
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
93
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
94
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
94
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
95
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
95
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
96
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
96
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
97
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
97
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
98
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
98
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
99
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
99
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
100
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
100
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
101
import com.extjs.gxt.ui.client.widget.layout.FormData;
101
import com.extjs.gxt.ui.client.widget.layout.FormData;
102
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
102
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
103
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
103
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
104
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
104
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
105
import com.google.gwt.core.client.GWT;
105
import com.google.gwt.core.client.GWT;
106
import com.google.gwt.i18n.client.DateTimeFormat;
106
import com.google.gwt.i18n.client.DateTimeFormat;
107
import com.google.gwt.i18n.client.NumberFormat;
107
import com.google.gwt.i18n.client.NumberFormat;
108
import com.google.gwt.user.client.Window;
108
import com.google.gwt.user.client.Window;
109
 
109
 
110
public class StructureForm extends Formulaire implements Rafraichissable {
110
public class StructureForm extends Formulaire implements Rafraichissable {
111
		
111
		
112
	private TabPanel onglets = null;
112
	private TabPanel onglets = null;
113
	private StructureFormIdentification identificationOnglet = null;
113
	private StructureFormIdentification identificationOnglet = null;
114
	private StructureFormPersonne personnelOnglet = null;
114
	private StructureFormPersonne personnelOnglet = null;
115
	private StructureFormConservation conservationOnglet = null;
115
	private StructureFormConservation conservationOnglet = null;
116
	private StructureFormValorisation valorisationOnglet = null;
116
	private StructureFormValorisation valorisationOnglet = null;
117
	
117
	
118
	// Onglet IDENTIFICATION
118
	// Onglet IDENTIFICATION
119
	public Structure identification = null;
119
	public Structure identification = null;
120
 
120
 
121
	// Onglet PERSONNEL
121
	// Onglet PERSONNEL
122
	// Vide suite à refactoring
122
	// Vide suite à refactoring
123
	
123
	
124
	// Onglet CONSERVATION
124
	// Onglet CONSERVATION
125
	public StructureConservation conservation = null;
125
	public StructureConservation conservation = null;
126
		
126
		
127
	// Onglet VALORISATION
127
	// Onglet VALORISATION
128
	public StructureValorisation valorisation = null;
128
	public StructureValorisation valorisation = null;
129
	
129
	
130
	private Sequenceur sequenceur;
130
	private Sequenceur sequenceur;
131
	
131
	
132
	private Structure structure = null;
132
	private Structure structure = null;
133
	
133
	
134
	public Rafraichissable vueExterneARafraichirApresValidation = null;
134
	public Rafraichissable vueExterneARafraichirApresValidation = null;
135
	
135
	
136
	public StructureForm(Mediateur mediateurCourrant, String modeDeCreation, Sequenceur sequenceur) {
136
	public StructureForm(Mediateur mediateurCourrant, String modeDeCreation, Sequenceur sequenceur) {
137
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
137
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
138
		this.sequenceur = sequenceur;
138
		this.sequenceur = sequenceur;
139
		
139
		
140
		// Ajout du titre
140
		// Ajout du titre
141
		panneauFormulaire.setHeading(i18nC.titreAjoutFormStructurePanneau());
141
		panneauFormulaire.setHeading(i18nC.titreAjoutFormStructurePanneau());
142
		// Création des onglets
142
		// Création des onglets
143
		onglets = creerOnglets();
143
		onglets = creerOnglets();
144
		
144
		
145
		// Ajout des onglets au formulaire général
145
		// Ajout des onglets au formulaire général
146
		panneauFormulaire.add(onglets);
146
		panneauFormulaire.add(onglets);
147
	}
147
	}
148
	
148
	
149
	protected TabPanel creerOnglets() {
149
	protected TabPanel creerOnglets() {
150
		TabPanel ongletsStructure = new TabPanel();
150
		TabPanel ongletsStructure = new TabPanel();
151
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
151
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
152
		ongletsStructure.setHeight("100%");
152
		ongletsStructure.setHeight("100%");
153
		
153
		
154
		// Onlget formulaire IDENTIFICATION
154
		// Onlget formulaire IDENTIFICATION
155
		ongletsStructure.add(creerOngletIdentification());
155
		ongletsStructure.add(creerOngletIdentification());
156
		
156
		
157
		// Onlget formulaire PERSONNEL
157
		// Onlget formulaire PERSONNEL
158
		ongletsStructure.add(creerOngletPersonnel());
158
		ongletsStructure.add(creerOngletPersonnel());
159
		
159
		
160
		// Onlget formulaire CONSERVATION
160
		// Onlget formulaire CONSERVATION
161
		ongletsStructure.add(creerOngletConservation());
161
		ongletsStructure.add(creerOngletConservation());
162
		
162
		
163
		// Onlget formulaire VALORISATION
163
		// Onlget formulaire VALORISATION
164
		ongletsStructure.add(creerOngletValorisation());
164
		ongletsStructure.add(creerOngletValorisation());
165
		
165
		
166
		// Sélection de l'onglet par défaut
166
		// Sélection de l'onglet par défaut
167
		//ongletsStructure(personnelOnglet);
167
		//ongletsStructure(personnelOnglet);
168
		
168
		
169
		return ongletsStructure;
169
		return ongletsStructure;
170
	}
170
	}
171
	
-
 
172
	public void reinitialiserFormulaire() {
-
 
173
		if (mode.equals(StructureForm.MODE_MODIFIER)) {
-
 
174
			mediateur.afficherFormStructure(identification.getId());
-
 
175
		} else {
-
 
176
			mediateur.afficherFormStructure(null);
-
 
177
		}
-
 
178
	}
-
 
179
	
171
	
180
	private void repandreRafraichissement() {
172
	private void repandreRafraichissement() {
181
		if (vueExterneARafraichirApresValidation != null) {
173
		if (vueExterneARafraichirApresValidation != null) {
182
			String type = "structure_modifiee";
174
			String type = "structure_modifiee";
183
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
175
			if (mode.equals(Formulaire.MODE_AJOUTER)) {
184
				type = "structure_ajoutee";
176
				type = "structure_ajoutee";
185
			}
177
			}
186
			Information info = new Information(type);
178
			Information info = new Information(type);
187
			info.setDonnee(0, structure);
179
			info.setDonnee(0, structure);
188
			vueExterneARafraichirApresValidation.rafraichir(info);
180
			vueExterneARafraichirApresValidation.rafraichir(info);
189
		}
181
		}
190
	}
182
	}
191
	
183
	
192
	public boolean soumettreFormulaire() {
184
	public boolean soumettreFormulaire() {
193
		
185
		
194
		// Vérification de la validité des champs du formulaire
186
		// Vérification de la validité des champs du formulaire
195
		boolean fomulaireValide = verifierFormulaire();
187
		boolean fomulaireValide = verifierFormulaire();
196
		
188
		
197
		Structure identification = collecterStructureIdentification();
189
		Structure identification = collecterStructureIdentification();
198
		
190
		
199
		if(identification != null) {
191
		if(identification != null) {
200
			structure = identification;
192
			structure = identification;
201
		} else {
193
		} else {
202
			structure = this.identification;
194
			structure = this.identification;
203
		}
195
		}
204
		
196
		
205
 
197
 
206
		structure.setConservation(this.conservation);
198
		structure.setConservation(this.conservation);
207
		structure.setValorisation(this.valorisation); 
199
		structure.setValorisation(this.valorisation); 
208
		
200
		
209
		if (fomulaireValide) {
201
		if (fomulaireValide) {
210
			// Collecte des données du formulaire
202
			// Collecte des données du formulaire
211
			StructureConservation conservation = collecterStructureConservation();
203
			StructureConservation conservation = collecterStructureConservation();
212
			StructureValorisation valorisation = collecterStructureValorisation();
204
			StructureValorisation valorisation = collecterStructureValorisation();
213
			
205
			
214
			if(conservation != null) {
206
			if(conservation != null) {
215
				structure.setConservation(conservation);
207
				structure.setConservation(conservation);
216
			}
208
			}
217
			
209
			
218
			if(valorisation != null) {
210
			if(valorisation != null) {
219
				structure.setValorisation(valorisation);
211
				structure.setValorisation(valorisation);
220
			}
212
			}
221
			
213
			
222
			EtatPersonnelStructure etatPersonnel = personnelOnglet.collecter();
214
			EtatPersonnelStructure etatPersonnel = personnelOnglet.collecter();
223
			
215
			
224
			structure.setPersonnel(etatPersonnel.personnel);
216
			structure.setPersonnel(etatPersonnel.personnel);
225
			structure.setConservation(conservation);
217
			structure.setConservation(conservation);
226
			structure.setValorisation(valorisation);
218
			structure.setValorisation(valorisation);
227
			
219
			
228
			if (mode.equals(MODE_AJOUTER)) {
220
			if (mode.equals(MODE_AJOUTER)) {
229
				// Ajout des informations sur la Structure
221
				// Ajout des informations sur la Structure
230
				mediateur.ajouterStructure(this, structure, conservation, valorisation);
222
				mediateur.ajouterStructure(this, structure, conservation, valorisation);
231
				// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
223
				// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
232
				// Voir la méthode rafraichir().
224
				// Voir la méthode rafraichir().
233
			} else if (mode.equals(MODE_MODIFIER)) {
225
			} else if (mode.equals(MODE_MODIFIER)) {
234
				
226
				
235
				// Modification des informations sur la Structure
227
				// Modification des informations sur la Structure
236
				if (structure == null && conservation == null && valorisation == null) {
228
				if (structure == null && conservation == null && valorisation == null) {
237
					//InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
229
					//InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
238
				} else {
230
				} else {
239
					mediateur.modifierStructure(this, structure.getId(), structure, conservation, valorisation);
231
					mediateur.modifierStructure(this, structure.getId(), structure, conservation, valorisation);
240
				}
232
				}
241
				
233
				
242
				if (etatPersonnel.personnelModifie.size() == 0 && etatPersonnel.personnelAjoute.size() == 0 && etatPersonnel.personnelSupprime.size() == 0) {
234
				if (etatPersonnel.personnelModifie.size() == 0 && etatPersonnel.personnelAjoute.size() == 0 && etatPersonnel.personnelSupprime.size() == 0) {
243
					//InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
235
					//InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
244
				} else {
236
				} else {
245
					if (etatPersonnel.personnelModifie.size() != 0) {
237
					if (etatPersonnel.personnelModifie.size() != 0) {
246
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
238
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
247
						mediateur.modifierStructureAPersonne(this, etatPersonnel.personnelModifie);
239
						mediateur.modifierStructureAPersonne(this, etatPersonnel.personnelModifie);
248
					}
240
					}
249
					// Ajout des relations StructureAPersonne
241
					// Ajout des relations StructureAPersonne
250
					if (etatPersonnel.personnelAjoute.size() != 0) {
242
					if (etatPersonnel.personnelAjoute.size() != 0) {
251
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
243
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
252
						mediateur.ajouterStructureAPersonne(this, structure.getId(), etatPersonnel.personnelAjoute);
244
						mediateur.ajouterStructureAPersonne(this, structure.getId(), etatPersonnel.personnelAjoute);
253
					}
245
					}
254
					// Suppression des relations StructureAPersonne
246
					// Suppression des relations StructureAPersonne
255
					if (etatPersonnel.personnelSupprime.size() != 0) {
247
					if (etatPersonnel.personnelSupprime.size() != 0) {
256
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
248
						personnelOnglet.incrementerDecompteRafraichissementPersonnel();
257
						mediateur.supprimerStructureAPersonne(this, etatPersonnel.personnelSupprime);
249
						mediateur.supprimerStructureAPersonne(this, etatPersonnel.personnelSupprime);
258
					}
250
					}
259
				}
251
				}
260
			}
252
			}
261
		}
253
		}
262
		
254
		
263
		return fomulaireValide;
255
		return fomulaireValide;
264
	}
256
	}
265
	
257
	
266
	public boolean verifierFormulaire() {
258
	public boolean verifierFormulaire() {
267
		ArrayList<String> messages = new ArrayList<String>();
259
		ArrayList<String> messages = new ArrayList<String>();
268
		messages.addAll(verifierOnglets());
260
		messages.addAll(verifierOnglets());
269
		
261
		
270
		// Affichage des messages d'alerte
262
		// Affichage des messages d'alerte
271
		if (messages.size() != 0) {
263
		if (messages.size() != 0) {
272
			String[] a = {};
264
			String[] a = {};
273
			a = messages.toArray(a);
265
			a = messages.toArray(a);
274
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
266
			MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
275
			return false;
267
			return false;
276
		}
268
		}
277
		
269
		
278
		return true;
270
		return true;
279
	}
271
	}
280
		
272
		
281
	private ArrayList<String> verifierOnglets() {
273
	private ArrayList<String> verifierOnglets() {
282
		ArrayList<String> messages = new ArrayList<String>();
274
		ArrayList<String> messages = new ArrayList<String>();
283
		messages.addAll(identificationOnglet.verifier());
275
		messages.addAll(identificationOnglet.verifier());
284
		messages.addAll(personnelOnglet.verifier());
276
		messages.addAll(personnelOnglet.verifier());
285
		return messages;
277
		return messages;
286
	}
278
	}
287
	
279
	
288
	private StructureValorisation collecterStructureValorisation() {
280
	private StructureValorisation collecterStructureValorisation() {
289
		return valorisationOnglet.collecter();
281
		return valorisationOnglet.collecter();
290
	}
282
	}
291
	
283
	
292
	private void peuplerStructureValorisation() {
284
	private void peuplerStructureValorisation() {
293
		valorisationOnglet.peupler();
285
		valorisationOnglet.peupler();
294
	}
286
	}
295
	
287
	
296
	private StructureConservation collecterStructureConservation() {
288
	private StructureConservation collecterStructureConservation() {
297
		return conservationOnglet.collecter();
289
		return conservationOnglet.collecter();
298
	}
290
	}
299
	
291
	
300
	private void peuplerStructureConservation() {
292
	private void peuplerStructureConservation() {
301
		conservationOnglet.peupler();
293
		conservationOnglet.peupler();
302
	}
294
	}
303
	
295
	
304
	private Structure collecterStructureIdentification() {
296
	private Structure collecterStructureIdentification() {
305
		Structure structureARetourner = identificationOnglet.collecter();
297
		Structure structureARetourner = identificationOnglet.collecter();
306
		return structureARetourner;
298
		return structureARetourner;
307
	}
299
	}
308
	
300
	
309
	private TabItem creerOngletValorisation() {
301
	private TabItem creerOngletValorisation() {
310
		valorisationOnglet = new StructureFormValorisation(mediateur, this, sequenceur);
302
		valorisationOnglet = new StructureFormValorisation(mediateur, this, sequenceur);
311
		return valorisationOnglet;
303
		return valorisationOnglet;
312
	}
304
	}
313
	
305
	
314
	private TabItem creerOngletConservation() {
306
	private TabItem creerOngletConservation() {
315
		conservationOnglet = new StructureFormConservation(mediateur, this, sequenceur);
307
		conservationOnglet = new StructureFormConservation(mediateur, this, sequenceur);
316
		return conservationOnglet;
308
		return conservationOnglet;
317
	}
309
	}
318
	
310
	
319
	private EtatPersonnelStructure collecterStructurePersonnel() {
311
	private EtatPersonnelStructure collecterStructurePersonnel() {
320
		return personnelOnglet.collecter();
312
		return personnelOnglet.collecter();
321
	}
313
	}
322
	
314
	
323
	private void peuplerStructurePersonnel(StructureAPersonneListe personnel) {
315
	private void peuplerStructurePersonnel(StructureAPersonneListe personnel) {
324
		personnelOnglet.peupler(personnel);
316
		personnelOnglet.peupler(personnel);
325
	}
317
	}
326
	
318
	
327
	private TabItem creerOngletPersonnel() {
319
	private TabItem creerOngletPersonnel() {
328
		personnelOnglet = new StructureFormPersonne(this, mediateur);
320
		personnelOnglet = new StructureFormPersonne(this, mediateur);
329
		return personnelOnglet;
321
		return personnelOnglet;
330
	}
322
	}
331
	
323
	
332
	private TabItem creerOngletIdentification() {
324
	private TabItem creerOngletIdentification() {
333
		identificationOnglet = new StructureFormIdentification(this);
325
		identificationOnglet = new StructureFormIdentification(this);
334
		return identificationOnglet;
326
		return identificationOnglet;
335
	}
327
	}
336
		
328
		
337
	public void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
329
	public void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
338
		String[] valeurs = donnees.split(";;");
330
		String[] valeurs = donnees.split(";;");
339
		for (int i = 0; i < valeurs.length; i++) {
331
		for (int i = 0; i < valeurs.length; i++) {
340
			if (valeurs[i].startsWith("AUTRE##")) {
332
			if (valeurs[i].startsWith("AUTRE##")) {
341
				champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
333
				champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
342
			} else {
334
			} else {
343
				//TODO : check : List<CheckBox> cases = groupeCac.getAll();
335
				//TODO : check : List<CheckBox> cases = groupeCac.getAll();
344
				List<Field<?>> cases = groupeCac.getAll();
336
				List<Field<?>> cases = groupeCac.getAll();
345
				for (int j = 0; j < cases.size(); j++) {
337
				for (int j = 0; j < cases.size(); j++) {
346
					if (cases.get(j).getId().equals("val-"+valeurs[i])) {
338
					if (cases.get(j).getId().equals("val-"+valeurs[i])) {
347
						((CheckBox) cases.get(j)).setValue(true);
339
						((CheckBox) cases.get(j)).setValue(true);
348
					}
340
					}
349
				}
341
				}
350
			}
342
			}
351
		}
343
		}
352
	}
344
	}
353
	
345
	
354
	public void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
346
	public void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
355
		//List<Radio> boutons = groupeBr.getAll();
347
		//List<Radio> boutons = groupeBr.getAll();
356
		List<Field<?>> boutons = groupeBr.getAll();
348
		List<Field<?>> boutons = groupeBr.getAll();
357
		String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
349
		String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
358
		for (int i = 0; i < boutons.size(); i++) {
350
		for (int i = 0; i < boutons.size(); i++) {
359
			if (boutons.get(i).getId().equals(id)) {
351
			if (boutons.get(i).getId().equals(id)) {
360
				((Radio) boutons.get(i)).setValue(true);
352
				((Radio) boutons.get(i)).setValue(true);
361
			}
353
			}
362
		}
354
		}
363
	}
355
	}
364
	
356
	
365
	public String creerChaineDenormalisee(List<CheckBox> liste) {
357
	public String creerChaineDenormalisee(List<CheckBox> liste) {
366
		String identifiants = "";
358
		String identifiants = "";
367
		if (liste != null) {
359
		if (liste != null) {
368
			int taille = liste.size();
360
			int taille = liste.size();
369
			for (int i = 0; i < taille; i++) {
361
			for (int i = 0; i < taille; i++) {
370
				CheckBox cac = liste.get(i);
362
				CheckBox cac = liste.get(i);
371
				if (cac.isEnabled()) {
363
				if (cac.isEnabled()) {
372
					identifiants = identifiants.concat(";;"+cac.getData("id"));
364
					identifiants = identifiants.concat(";;"+cac.getData("id"));
373
				}
365
				}
374
			}
366
			}
375
			identifiants.replaceFirst("^;;", "");
367
			identifiants.replaceFirst("^;;", "");
376
		}
368
		}
377
		return identifiants;
369
		return identifiants;
378
	}
370
	}
379
	
371
	
380
	public void afficherChampSupplementaire(Radio radioBtn) {	
372
	public void afficherChampSupplementaire(Radio radioBtn) {	
381
		valorisationOnglet.afficherChampSupplementaire(radioBtn) ;
373
		valorisationOnglet.afficherChampSupplementaire(radioBtn) ;
382
		conservationOnglet.afficherChampSupplementaires(radioBtn);
374
		conservationOnglet.afficherChampSupplementaires(radioBtn);
383
	}
375
	}
384
	
376
	
385
	public void rafraichir(Object nouvellesDonnees) {
377
	public void rafraichir(Object nouvellesDonnees) {
386
		try {
378
		try {
387
			if (nouvellesDonnees instanceof Information) {
379
			if (nouvellesDonnees instanceof Information) {
388
				Information info = (Information) nouvellesDonnees;
380
				Information info = (Information) nouvellesDonnees;
389
				rafraichirInformation(info);
381
				rafraichirInformation(info);
390
				if(!info.getType().equals("selection_structure") && !info.getType().equals("selection_structure")) {
382
				if(!info.getType().equals("selection_structure") && !info.getType().equals("selection_structure")) {
391
					repandreRafraichissement();
383
					repandreRafraichissement();
392
				}
384
				}
393
			} else if (nouvellesDonnees instanceof ValeurListe) {
385
			} else if (nouvellesDonnees instanceof ValeurListe) {
394
				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
386
				ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
395
				rafraichirValeurListe(listeValeurs);
387
				rafraichirValeurListe(listeValeurs);
396
			} else {
388
			} else {
397
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
389
				GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
398
			}
390
			}
399
		} catch (Exception e) {
391
		} catch (Exception e) {
400
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
392
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
401
		}
393
		}
402
		
394
		
403
		controlerFermeture();
395
		controlerFermeture();
404
	}
396
	}
405
	
397
	
406
	public void rafraichirInformation(Information info) {		
398
	public void rafraichirInformation(Information info) {		
407
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
399
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
408
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
400
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
409
		}
401
		}
410
		
402
		
411
		if (info.getType().equals("modif_structure")) {
403
		if (info.getType().equals("modif_structure")) {
412
			InfoLogger.display("Modification d'une institution", info.toString());
404
			InfoLogger.display("Modification d'une institution", info.toString());
413
			controlerFermeture();
405
			controlerFermeture();
414
		} else if (info.getType().equals("ajout_structure")) {
406
		} else if (info.getType().equals("ajout_structure")) {
415
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
407
			if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
416
				this.mode = MODE_MODIFIER;
408
				this.mode = MODE_MODIFIER;
417
				String structureId = (String) info.getDonnee(0);
409
				String structureId = (String) info.getDonnee(0);
418
				structure.setId(structureId);
410
				structure.setId(structureId);
419
				identification = structure;
411
				identification = structure;
420
				identificationOnglet.rafraichir(info);
412
				identificationOnglet.rafraichir(info);
421
				personnelOnglet.rafraichir(info);
413
				personnelOnglet.rafraichir(info);
422
				conservationOnglet.rafraichir(info);
414
				conservationOnglet.rafraichir(info);
423
				valorisationOnglet.rafraichir(info);
415
				valorisationOnglet.rafraichir(info);
424
				InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
416
				InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
425
			} else {
417
			} else {
426
				InfoLogger.display("Ajout d'une Institution", info.toString());
418
				InfoLogger.display("Ajout d'une Institution", info.toString());
427
			}
419
			}
428
		} else if (info.getType().equals("modif_structure_a_personne")) {
420
		} else if (info.getType().equals("modif_structure_a_personne")) {
429
			InfoLogger.display("Modification du Personnel", info.toString());
421
			InfoLogger.display("Modification du Personnel", info.toString());
430
			personnelOnglet.rafraichir(info);
422
			personnelOnglet.rafraichir(info);
431
		} else if (info.getType().equals("suppression_structure_a_personne")) {
423
		} else if (info.getType().equals("suppression_structure_a_personne")) {
432
			InfoLogger.display("Suppression du Personnel", info.toString());
424
			InfoLogger.display("Suppression du Personnel", info.toString());
433
			personnelOnglet.rafraichir(info);
425
			personnelOnglet.rafraichir(info);
434
		} else if (info.getType().equals("ajout_structure_a_personne")) {
426
		} else if (info.getType().equals("ajout_structure_a_personne")) {
435
			InfoLogger.display("Ajout du Personnel", info.toString());
427
			InfoLogger.display("Ajout du Personnel", info.toString());
436
			personnelOnglet.rafraichir(info);
428
			personnelOnglet.rafraichir(info);
437
		} else if (info.getType().equals("selection_structure")) {
429
		} else if (info.getType().equals("selection_structure")) {
438
			InfoLogger.display("Modification d'une institution", info.toString());
430
			InfoLogger.display("Modification d'une institution", info.toString());
439
			String titre = i18nC.titreModifFormStructurePanneau();
431
			String titre = i18nC.titreModifFormStructurePanneau();
440
			if (info.getDonnee(0) != null) {
432
			if (info.getDonnee(0) != null) {
441
				identification = (Structure)info.getDonnee(0);
433
				identification = (Structure)info.getDonnee(0);
442
				identificationOnglet.rafraichir(info);
434
				identificationOnglet.rafraichir(info);
443
				// Composition du titre
435
				// Composition du titre
444
				titre += " - ID : "+identification.getId();
436
				titre += " - ID : "+identification.getId();
445
			}
437
			}
446
			if (info.getDonnee(1) != null) {
438
			if (info.getDonnee(1) != null) {
447
				conservation = (StructureConservation)info.getDonnee(1);
439
				conservation = (StructureConservation)info.getDonnee(1);
448
				conservationOnglet.rafraichir(info);
440
				conservationOnglet.rafraichir(info);
449
			}
441
			}
450
			if (info.getDonnee(2) != null) {
442
			if (info.getDonnee(2) != null) {
451
				valorisation = (StructureValorisation)info.getDonnee(2);
443
				valorisation = (StructureValorisation)info.getDonnee(2);
452
				valorisationOnglet.rafraichir(info);
444
				valorisationOnglet.rafraichir(info);
453
			}
445
			}
454
		} else if (info.getType().equals("liste_structure_a_personne")) {
446
		} else if (info.getType().equals("liste_structure_a_personne")) {
455
				personnelOnglet.rafraichir(info);
447
				personnelOnglet.rafraichir(info);
456
		}
448
		}
457
	}
449
	}
458
	
450
	
459
	public void rafraichirValeurListe(ValeurListe listeValeurs) {
451
	public void rafraichirValeurListe(ValeurListe listeValeurs) {
460
		List<Valeur> liste = listeValeurs.toList();
452
		List<Valeur> liste = listeValeurs.toList();
461
 
453
 
462
		// Test pour savoir si la liste contient des éléments
454
		// Test pour savoir si la liste contient des éléments
463
		if (liste.size() > 0) {
455
		if (liste.size() > 0) {
464
			identificationOnglet.rafraichir(listeValeurs);
456
			identificationOnglet.rafraichir(listeValeurs);
465
			personnelOnglet.rafraichir(listeValeurs);
457
			personnelOnglet.rafraichir(listeValeurs);
466
			conservationOnglet.rafraichir(listeValeurs);
458
			conservationOnglet.rafraichir(listeValeurs);
467
			valorisationOnglet.rafraichir(listeValeurs);
459
			valorisationOnglet.rafraichir(listeValeurs);
468
			//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
460
			//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
469
		} else {
461
		} else {
470
			GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
462
			GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
471
		}
463
		}
472
	}
464
	}
473
 
465
 
474
	public String getIdIdentification() {
466
	public String getIdIdentification() {
475
		return identification.getId();
467
		return identification.getId();
476
	}
468
	}
477
	
469
	
478
	public ModelData getValeurProjetCombo() {
470
	public ModelData getValeurProjetCombo() {
479
		return identificationOnglet.getValeurProjetCombo();
471
		return identificationOnglet.getValeurProjetCombo();
480
	}
472
	}
481
	
473
	
482
	public ModelData getValeurProjet() {
474
	public ModelData getValeurProjet() {
483
		return identificationOnglet.getValeurProjet();
475
		return identificationOnglet.getValeurProjet();
484
	}
476
	}
485
}
477
}