69 |
jpm |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
91 |
jpm |
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.Iterator;
|
69 |
jpm |
5 |
import java.util.List;
|
|
|
6 |
|
91 |
jpm |
7 |
import org.tela_botanica.client.Modele;
|
|
|
8 |
import org.tela_botanica.client.RegistreId;
|
69 |
jpm |
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
91 |
jpm |
10 |
import org.tela_botanica.client.modeles.Configuration;
|
100 |
jpm |
11 |
import org.tela_botanica.client.modeles.InterneValeur;
|
|
|
12 |
import org.tela_botanica.client.modeles.InterneValeurListe;
|
102 |
jpm |
13 |
import org.tela_botanica.client.modeles.Personne;
|
91 |
jpm |
14 |
import org.tela_botanica.client.modeles.Valeur;
|
|
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
69 |
jpm |
16 |
|
91 |
jpm |
17 |
import com.extjs.gxt.ui.client.Registry;
|
69 |
jpm |
18 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
103 |
jpm |
19 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
100 |
jpm |
20 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
|
|
21 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
103 |
jpm |
22 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
|
|
23 |
import com.extjs.gxt.ui.client.event.ToolBarEvent;
|
69 |
jpm |
24 |
import com.extjs.gxt.ui.client.store.ListStore;
|
102 |
jpm |
25 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
69 |
jpm |
26 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
100 |
jpm |
27 |
import com.extjs.gxt.ui.client.widget.TabItem;
|
|
|
28 |
import com.extjs.gxt.ui.client.widget.TabPanel;
|
69 |
jpm |
29 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
|
|
30 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
100 |
jpm |
31 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
|
|
32 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
69 |
jpm |
33 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
103 |
jpm |
34 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
102 |
jpm |
35 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
69 |
jpm |
36 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
|
|
37 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
|
|
38 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
102 |
jpm |
39 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
|
|
40 |
import com.extjs.gxt.ui.client.widget.grid.CheckBoxSelectionModel;
|
|
|
41 |
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
|
|
|
42 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
|
|
43 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
|
|
44 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
69 |
jpm |
45 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
|
|
46 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
|
|
47 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
|
|
48 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
100 |
jpm |
49 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
69 |
jpm |
50 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
102 |
jpm |
51 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
|
|
52 |
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
|
|
|
53 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
91 |
jpm |
54 |
import com.google.gwt.core.client.GWT;
|
100 |
jpm |
55 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
102 |
jpm |
56 |
import com.google.gwt.i18n.client.NumberFormat;
|
69 |
jpm |
57 |
|
|
|
58 |
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
|
|
|
59 |
|
91 |
jpm |
60 |
private Modele coelModele = null ;
|
|
|
61 |
private ListStore<Valeur> magazinLstpr = null;
|
|
|
62 |
private ComboBox<Valeur> comboLstpr = null;
|
|
|
63 |
private ListStore<Valeur> magazinLstpu = null;
|
|
|
64 |
private ComboBox<Valeur> comboLstpu = null;
|
103 |
jpm |
65 |
private ListStore<Valeur> magazinLiStatut = null;
|
|
|
66 |
private ComboBox<Valeur> comboLiStatut = null;
|
|
|
67 |
private ListStore<Valeur> magazinLiFonction = null;
|
|
|
68 |
private ComboBox<Valeur> comboLiFonction = null;
|
100 |
jpm |
69 |
private ComboBox<InterneValeur> comboAcronyme = null;
|
|
|
70 |
private TextField<String> ihChp = null;
|
|
|
71 |
private TextField<String> mnhnChp = null;
|
|
|
72 |
private ComboBox<InterneValeur> comboTypeStructure = null;
|
103 |
jpm |
73 |
private EditorGrid<Personne> grillePersonnel = null;
|
|
|
74 |
private ListStore<Personne> personnelGrilleMagazin = null;
|
|
|
75 |
private LabelField nbreTotalPersonnelChp = null;
|
91 |
jpm |
76 |
|
69 |
jpm |
77 |
public FormStructureVue() {
|
100 |
jpm |
78 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
79 |
// Initialisation de variables
|
69 |
jpm |
80 |
setLayout(new FitLayout());
|
91 |
jpm |
81 |
coelModele = Registry.get(RegistreId.MODELE);
|
|
|
82 |
|
100 |
jpm |
83 |
// Création de la disposition : FIELDSET
|
|
|
84 |
FormLayout layoutFieldset = new FormLayout();
|
|
|
85 |
layoutFieldset.setLabelWidth(200);
|
|
|
86 |
layoutFieldset.setPadding(4);
|
|
|
87 |
|
|
|
88 |
//+-----------------------------------------------------------------------------------------------------------+
|
69 |
jpm |
89 |
// Création du panneau Formulaire
|
|
|
90 |
FormPanel panel = new FormPanel();
|
100 |
jpm |
91 |
panel.setFrame(true);
|
69 |
jpm |
92 |
panel.setIconStyle("icone-form-ajouter");
|
|
|
93 |
panel.setCollapsible(false);
|
|
|
94 |
panel.setHeading("Ajout d'une institution");
|
|
|
95 |
panel.setButtonAlign(HorizontalAlignment.CENTER);
|
100 |
jpm |
96 |
panel.setLayout(new FlowLayout());
|
|
|
97 |
|
|
|
98 |
// Création des onglets
|
102 |
jpm |
99 |
TabPanel onglets = new TabPanel();
|
|
|
100 |
onglets.setAutoHeight(true);
|
100 |
jpm |
101 |
//tabs.setDeferredRender(false);
|
69 |
jpm |
102 |
|
100 |
jpm |
103 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
104 |
// Onlget formulaire IDENTIFICATION
|
|
|
105 |
TabItem identificationOnglet = new TabItem();
|
|
|
106 |
identificationOnglet.setText("Identification");
|
|
|
107 |
identificationOnglet.setLayout(new FormLayout());
|
69 |
jpm |
108 |
|
100 |
jpm |
109 |
// Fieldset IDENTITÉ
|
|
|
110 |
FieldSet fieldSetIdentite = new FieldSet();
|
|
|
111 |
fieldSetIdentite.setHeading("Identité");
|
|
|
112 |
fieldSetIdentite.setCollapsible(true);
|
|
|
113 |
fieldSetIdentite.setLayout(layoutFieldset);
|
|
|
114 |
|
69 |
jpm |
115 |
TextField<String> nomStructureChp = new TextField<String>();
|
|
|
116 |
nomStructureChp.setFieldLabel("Nom de la structure");
|
|
|
117 |
nomStructureChp.setAllowBlank(false);
|
100 |
jpm |
118 |
nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
|
|
|
119 |
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
|
69 |
jpm |
120 |
|
100 |
jpm |
121 |
// Création du sous-formulaire : Acronyme
|
|
|
122 |
LayoutContainer ligne = new LayoutContainer();
|
|
|
123 |
ligne.setLayout(new ColumnLayout());
|
|
|
124 |
LayoutContainer gauche = new LayoutContainer();
|
|
|
125 |
FormLayout layoutGauche = new FormLayout();
|
|
|
126 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
|
|
127 |
layoutGauche.setLabelWidth(200);
|
|
|
128 |
layoutGauche.setPadding(0);
|
|
|
129 |
gauche.setLayout(layoutGauche);
|
|
|
130 |
LayoutContainer droite = new LayoutContainer();
|
|
|
131 |
FormLayout layoutDroite = new FormLayout();
|
|
|
132 |
layoutDroite.setLabelWidth(0);
|
|
|
133 |
layoutDroite.setPadding(0);
|
|
|
134 |
droite.setLayout(layoutDroite);
|
69 |
jpm |
135 |
|
100 |
jpm |
136 |
ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();
|
|
|
137 |
acronymes.add(InterneValeurListe.getTypeAcronyme());
|
69 |
jpm |
138 |
|
100 |
jpm |
139 |
comboAcronyme = new ComboBox<InterneValeur>();
|
|
|
140 |
comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
|
|
|
141 |
comboAcronyme.setFieldLabel("Acronymes");
|
|
|
142 |
comboAcronyme.setDisplayField("nom");
|
|
|
143 |
comboAcronyme.setStore(acronymes);
|
|
|
144 |
comboAcronyme.setEditable(false);
|
|
|
145 |
comboAcronyme.setTypeAhead(true);
|
|
|
146 |
comboAcronyme.setTriggerAction(TriggerAction.ALL);
|
|
|
147 |
comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
|
102 |
jpm |
148 |
@Override
|
100 |
jpm |
149 |
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
|
|
|
150 |
String acronymeAbr = se.getSelectedItem().getAbr();
|
|
|
151 |
if (acronymeAbr.equals("IH")) {
|
|
|
152 |
mnhnChp.hide();
|
|
|
153 |
ihChp.show();
|
|
|
154 |
} else if (acronymeAbr.equals("MNHN")) {
|
|
|
155 |
ihChp.hide();
|
|
|
156 |
mnhnChp.show();
|
|
|
157 |
} else if (acronymeAbr.equals("")) {
|
|
|
158 |
ihChp.hide();
|
|
|
159 |
mnhnChp.hide();
|
|
|
160 |
comboAcronyme.clearSelections();
|
|
|
161 |
}
|
|
|
162 |
}
|
|
|
163 |
});
|
|
|
164 |
gauche.add(comboAcronyme);
|
|
|
165 |
|
|
|
166 |
ihChp = new TextField<String>();
|
|
|
167 |
//ihChp.setEmptyText("Index Herbariorum");
|
|
|
168 |
ihChp.setLabelSeparator("");
|
|
|
169 |
ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
|
|
|
170 |
ihChp.hide();
|
|
|
171 |
droite.add(ihChp);
|
|
|
172 |
|
|
|
173 |
mnhnChp = new TextField<String>();
|
|
|
174 |
//mnhnChp.setEmptyText("MNHN");
|
|
|
175 |
mnhnChp.setLabelSeparator("");
|
|
|
176 |
mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
|
|
|
177 |
mnhnChp.hide();
|
|
|
178 |
droite.add(mnhnChp);
|
|
|
179 |
|
|
|
180 |
ligne.add(gauche, new ColumnData(0.5));
|
|
|
181 |
ligne.add(droite, new ColumnData(0.5));
|
|
|
182 |
fieldSetIdentite.add(ligne);
|
|
|
183 |
|
|
|
184 |
// Création du sous-formulaire : Type de Structure
|
|
|
185 |
LayoutContainer ligneTs = new LayoutContainer();
|
|
|
186 |
ligneTs.setLayout(new ColumnLayout());
|
|
|
187 |
|
|
|
188 |
LayoutContainer gaucheTs = new LayoutContainer();
|
|
|
189 |
layoutGauche = new FormLayout();
|
|
|
190 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
|
|
191 |
layoutGauche.setLabelWidth(200);
|
|
|
192 |
layoutGauche.setPadding(0);
|
|
|
193 |
gaucheTs.setLayout(layoutGauche);
|
|
|
194 |
|
|
|
195 |
LayoutContainer droiteTs = new LayoutContainer();
|
|
|
196 |
layoutDroite = new FormLayout();
|
|
|
197 |
layoutDroite.setLabelWidth(0);
|
|
|
198 |
layoutDroite.setPadding(0);
|
|
|
199 |
droiteTs.setLayout(layoutDroite);
|
|
|
200 |
|
|
|
201 |
ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();
|
|
|
202 |
typesStructure.add(InterneValeurListe.getTypeStructure());
|
|
|
203 |
|
|
|
204 |
this.comboTypeStructure = new ComboBox<InterneValeur>();
|
|
|
205 |
comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
|
|
|
206 |
comboTypeStructure.setFieldLabel("Statut des structures");
|
|
|
207 |
comboTypeStructure.setDisplayField("nom");
|
|
|
208 |
comboTypeStructure.setStore(typesStructure);
|
|
|
209 |
comboTypeStructure.setEditable(false);
|
|
|
210 |
comboTypeStructure.setTypeAhead(true);
|
|
|
211 |
comboTypeStructure.setTriggerAction(TriggerAction.ALL);
|
|
|
212 |
comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
|
102 |
jpm |
213 |
@Override
|
100 |
jpm |
214 |
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
|
|
|
215 |
String typeAbr = se.getSelectedItem().getAbr();
|
|
|
216 |
if (typeAbr.equals("stpu")) {
|
|
|
217 |
comboLstpr.hide();
|
|
|
218 |
comboLstpu.show();
|
|
|
219 |
} else if (typeAbr.equals("stpr")) {
|
|
|
220 |
comboLstpu.hide();
|
|
|
221 |
comboLstpr.show();
|
|
|
222 |
} else if (typeAbr.equals("")) {
|
|
|
223 |
comboLstpr.hide();
|
|
|
224 |
comboLstpu.hide();
|
|
|
225 |
comboTypeStructure.clearSelections();
|
|
|
226 |
}
|
|
|
227 |
}
|
|
|
228 |
});
|
|
|
229 |
gaucheTs.add(comboTypeStructure);
|
|
|
230 |
|
91 |
jpm |
231 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpu"));
|
|
|
232 |
magazinLstpu = new ListStore<Valeur>();
|
|
|
233 |
magazinLstpu.add(new ArrayList<Valeur>());
|
|
|
234 |
comboLstpu = new ComboBox<Valeur>();
|
100 |
jpm |
235 |
//comboLstpu.setFieldLabel("Statut des structures publiques");
|
|
|
236 |
comboLstpu.setLabelSeparator("");
|
91 |
jpm |
237 |
comboLstpu.setDisplayField("nom");
|
100 |
jpm |
238 |
comboLstpu.setEditable(false);
|
91 |
jpm |
239 |
comboLstpu.setTriggerAction(TriggerAction.ALL);
|
|
|
240 |
comboLstpu.setStore(magazinLstpu);
|
100 |
jpm |
241 |
comboLstpu.hide();
|
|
|
242 |
droiteTs.add(comboLstpu);
|
69 |
jpm |
243 |
|
91 |
jpm |
244 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpr"));
|
|
|
245 |
magazinLstpr = new ListStore<Valeur>();
|
|
|
246 |
magazinLstpr.add(new ArrayList<Valeur>());
|
|
|
247 |
comboLstpr = new ComboBox<Valeur>();
|
100 |
jpm |
248 |
//comboLstpr.setFieldLabel("Statut des structures privées");
|
|
|
249 |
comboLstpr.setLabelSeparator("");
|
91 |
jpm |
250 |
comboLstpr.setDisplayField("nom");
|
100 |
jpm |
251 |
comboLstpr.setEditable(false);
|
91 |
jpm |
252 |
comboLstpr.setTriggerAction(TriggerAction.ALL);
|
|
|
253 |
comboLstpr.setStore(magazinLstpr);
|
100 |
jpm |
254 |
comboLstpr.hide();
|
|
|
255 |
droiteTs.add(comboLstpr);
|
69 |
jpm |
256 |
|
100 |
jpm |
257 |
ligneTs.add(gaucheTs, new ColumnData(0.5));
|
|
|
258 |
ligneTs.add(droiteTs, new ColumnData(0.5));
|
|
|
259 |
fieldSetIdentite.add(ligneTs);
|
|
|
260 |
|
|
|
261 |
DateField dateFondationChp = new DateField();
|
|
|
262 |
dateFondationChp.setFieldLabel("Date de fondation");
|
|
|
263 |
dateFondationChp.getPropertyEditor().getFormat();
|
|
|
264 |
dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
|
|
|
265 |
dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
|
|
|
266 |
fieldSetIdentite.add(dateFondationChp);
|
|
|
267 |
|
|
|
268 |
identificationOnglet.add(fieldSetIdentite);
|
|
|
269 |
|
|
|
270 |
// Fieldset ADRESSE
|
|
|
271 |
LayoutContainer principalFdAdresse = new LayoutContainer();
|
|
|
272 |
principalFdAdresse.setLayout(new ColumnLayout());
|
|
|
273 |
|
|
|
274 |
LayoutContainer gaucheFdAdresse = new LayoutContainer();
|
|
|
275 |
layoutGauche = new FormLayout();
|
|
|
276 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
|
|
277 |
layoutGauche.setLabelWidth(100);
|
|
|
278 |
layoutGauche.setPadding(0);
|
|
|
279 |
gaucheFdAdresse.setLayout(layoutGauche);
|
|
|
280 |
|
|
|
281 |
LayoutContainer droiteFdAdresse = new LayoutContainer();
|
|
|
282 |
layoutDroite = new FormLayout();
|
|
|
283 |
layoutDroite.setLabelAlign(LabelAlign.LEFT);
|
|
|
284 |
layoutDroite.setLabelWidth(100);
|
|
|
285 |
layoutDroite.setPadding(0);
|
|
|
286 |
droiteFdAdresse.setLayout(layoutDroite);
|
|
|
287 |
|
|
|
288 |
FieldSet fieldSetAdresse = new FieldSet();
|
|
|
289 |
fieldSetAdresse.setHeading("Adresse");
|
|
|
290 |
fieldSetAdresse.setCollapsible(true);
|
|
|
291 |
|
|
|
292 |
layoutFieldset = new FormLayout();
|
|
|
293 |
layoutFieldset.setLabelWidth(100);
|
|
|
294 |
layoutFieldset.setPadding(4);
|
|
|
295 |
fieldSetAdresse.setLayout(layoutFieldset);
|
|
|
296 |
|
91 |
jpm |
297 |
TextField<String> adrChp = new TextField<String>();
|
|
|
298 |
adrChp.setFieldLabel("Adresse");
|
100 |
jpm |
299 |
fieldSetAdresse.add(adrChp, new FormData(550, 0));
|
69 |
jpm |
300 |
|
91 |
jpm |
301 |
TextField<String> cpChp = new TextField<String>();
|
|
|
302 |
cpChp.setFieldLabel("Code postal");
|
100 |
jpm |
303 |
gaucheFdAdresse.add(cpChp);
|
69 |
jpm |
304 |
|
91 |
jpm |
305 |
TextField<String> villeChp = new TextField<String>();
|
|
|
306 |
villeChp.setFieldLabel("Ville");
|
100 |
jpm |
307 |
droiteFdAdresse.add(villeChp);
|
69 |
jpm |
308 |
|
91 |
jpm |
309 |
TextField<String> regionChp = new TextField<String>();
|
|
|
310 |
regionChp.setFieldLabel("Région");
|
100 |
jpm |
311 |
gaucheFdAdresse.add(regionChp);
|
91 |
jpm |
312 |
|
|
|
313 |
TextField<String> paysChp = new TextField<String>();
|
|
|
314 |
paysChp.setFieldLabel("Pays");
|
100 |
jpm |
315 |
droiteFdAdresse.add(paysChp);
|
91 |
jpm |
316 |
|
100 |
jpm |
317 |
principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
|
|
|
318 |
principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
|
|
|
319 |
fieldSetAdresse.add(principalFdAdresse);
|
|
|
320 |
identificationOnglet.add(fieldSetAdresse);
|
|
|
321 |
|
|
|
322 |
// Fieldset TÉLÉPHONE et EMAIL
|
|
|
323 |
|
|
|
324 |
LayoutContainer principalFdTelMail = new LayoutContainer();
|
|
|
325 |
principalFdTelMail.setLayout(new ColumnLayout());
|
|
|
326 |
|
|
|
327 |
LayoutContainer gaucheFdTelMail = new LayoutContainer();
|
|
|
328 |
layoutGauche = new FormLayout();
|
|
|
329 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
|
|
330 |
layoutGauche.setLabelWidth(100);
|
|
|
331 |
layoutGauche.setPadding(0);
|
|
|
332 |
gaucheFdTelMail.setLayout(layoutGauche);
|
|
|
333 |
|
|
|
334 |
LayoutContainer droiteFdTelMail = new LayoutContainer();
|
|
|
335 |
layoutDroite = new FormLayout();
|
|
|
336 |
layoutDroite.setLabelAlign(LabelAlign.LEFT);
|
|
|
337 |
layoutDroite.setLabelWidth(100);
|
|
|
338 |
layoutDroite.setPadding(0);
|
|
|
339 |
droiteFdTelMail.setLayout(layoutDroite);
|
|
|
340 |
|
|
|
341 |
FieldSet fieldSetTelMail = new FieldSet();
|
|
|
342 |
fieldSetTelMail.setHeading("Communication");
|
|
|
343 |
fieldSetTelMail.setCollapsible(true);
|
|
|
344 |
|
|
|
345 |
layoutFieldset = new FormLayout();
|
|
|
346 |
layoutFieldset.setLabelWidth(200);
|
|
|
347 |
layoutFieldset.setPadding(4);
|
|
|
348 |
fieldSetTelMail.setLayout(layoutFieldset);
|
|
|
349 |
|
91 |
jpm |
350 |
TextField<String> telChp = new TextField<String>();
|
|
|
351 |
telChp.setFieldLabel("Téléphone");
|
100 |
jpm |
352 |
gaucheFdTelMail.add(telChp);
|
91 |
jpm |
353 |
|
|
|
354 |
TextField<String> faxChp = new TextField<String>();
|
|
|
355 |
faxChp.setFieldLabel("Fax");
|
100 |
jpm |
356 |
droiteFdTelMail.add(faxChp);
|
91 |
jpm |
357 |
|
|
|
358 |
TextField<String> emailChp = new TextField<String>();
|
|
|
359 |
emailChp.setFieldLabel("Courriel");
|
|
|
360 |
emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
|
100 |
jpm |
361 |
gaucheFdTelMail.add(emailChp);
|
91 |
jpm |
362 |
|
|
|
363 |
TextField<String> urlChp = new TextField<String>();
|
|
|
364 |
urlChp.setFieldLabel("Site web");
|
100 |
jpm |
365 |
droiteFdTelMail.add(urlChp);
|
91 |
jpm |
366 |
|
100 |
jpm |
367 |
principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
|
|
|
368 |
principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
|
|
|
369 |
fieldSetTelMail.add(principalFdTelMail);
|
|
|
370 |
identificationOnglet.add(fieldSetTelMail);
|
|
|
371 |
|
|
|
372 |
onglets.add(identificationOnglet);
|
|
|
373 |
|
|
|
374 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
375 |
// Onlget formulaire PERSONNEL
|
103 |
jpm |
376 |
onglets.add(creerOngletPersonnel());
|
91 |
jpm |
377 |
|
100 |
jpm |
378 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
379 |
// Onlget formulaire CONSERVATION
|
|
|
380 |
TabItem conservationOnglet = new TabItem();
|
|
|
381 |
conservationOnglet.setText("Conservation");
|
|
|
382 |
conservationOnglet.setLayout(new FormLayout());
|
|
|
383 |
|
|
|
384 |
|
|
|
385 |
onglets.add(conservationOnglet);
|
|
|
386 |
|
|
|
387 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
388 |
// Onlget formulaire VALORISATION
|
|
|
389 |
TabItem valorisationOnglet = new TabItem();
|
|
|
390 |
valorisationOnglet.setText("Valorisation");
|
|
|
391 |
valorisationOnglet.setLayout(new FormLayout());
|
|
|
392 |
|
|
|
393 |
|
|
|
394 |
onglets.add(valorisationOnglet);
|
|
|
395 |
|
|
|
396 |
//+-----------------------------------------------------------------------------------------------------------+
|
|
|
397 |
// Gestion du FORMULAIRE GÉNÉRAL
|
|
|
398 |
|
|
|
399 |
// Ajout des onglets
|
|
|
400 |
panel.add(onglets);
|
69 |
jpm |
401 |
|
|
|
402 |
// Ajout des boutons au panneau formulaire
|
|
|
403 |
Button annulerBtn = new Button("Annuler");
|
|
|
404 |
panel.addButton(annulerBtn);
|
|
|
405 |
Button validerBtn = new Button("Valider");
|
|
|
406 |
panel.addButton(validerBtn);
|
|
|
407 |
|
|
|
408 |
// Ajout du panneau Formulaire à la disposition générale
|
|
|
409 |
add(panel);
|
|
|
410 |
}
|
|
|
411 |
|
103 |
jpm |
412 |
private TabItem creerOngletPersonnel() {
|
|
|
413 |
TabItem personnelOnglet = new TabItem();
|
|
|
414 |
personnelOnglet.setText("Personnel");
|
|
|
415 |
FormLayout personnelOngletLayout = new FormLayout();
|
|
|
416 |
personnelOngletLayout.setLabelWidth(400);
|
|
|
417 |
personnelOnglet.setLayout(personnelOngletLayout);
|
|
|
418 |
|
|
|
419 |
NumberField nbreTotalPersonneStructureChp = new NumberField();
|
|
|
420 |
nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
|
|
|
421 |
nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
|
|
|
422 |
nbreTotalPersonneStructureChp.setToolTip("Ce champ doit contenir un nombre");
|
|
|
423 |
personnelOnglet.add(nbreTotalPersonneStructureChp);
|
|
|
424 |
|
|
|
425 |
personnelOnglet.add(this.creerGrillePersonnel());
|
|
|
426 |
|
|
|
427 |
nbreTotalPersonnelChp = new LabelField();
|
|
|
428 |
nbreTotalPersonnelChp.setFieldLabel("Nombre de personne travaillant sur les collections");
|
|
|
429 |
nbreTotalPersonnelChp.setLabelSeparator(":");
|
|
|
430 |
nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
|
|
|
431 |
personnelOnglet.add(nbreTotalPersonnelChp);
|
|
|
432 |
|
|
|
433 |
return personnelOnglet;
|
|
|
434 |
}
|
|
|
435 |
|
102 |
jpm |
436 |
private ContentPanel creerGrillePersonnel() {
|
103 |
jpm |
437 |
|
102 |
jpm |
438 |
List<Personne> personnes = new ArrayList<Personne>();
|
|
|
439 |
personnes.add(new Personne(Valeur.FONCTION_DIRECTEUR));
|
|
|
440 |
personnes.add(new Personne(Valeur.FONCTION_CONSERVATEUR));
|
|
|
441 |
|
103 |
jpm |
442 |
personnelGrilleMagazin = new ListStore<Personne>();
|
|
|
443 |
personnelGrilleMagazin.add(personnes);
|
|
|
444 |
|
102 |
jpm |
445 |
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
|
|
|
446 |
|
|
|
447 |
CheckBoxSelectionModel<Personne> sm = new CheckBoxSelectionModel<Personne>();
|
|
|
448 |
configs.add(sm.getColumn());
|
103 |
jpm |
449 |
|
|
|
450 |
ColumnConfig column = new ColumnConfig("ce_truk_fonction", "Fonction", 100);
|
|
|
451 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("fonction"));
|
|
|
452 |
magazinLiFonction = new ListStore<Valeur>();
|
|
|
453 |
magazinLiFonction.add(new ArrayList<Valeur>());
|
|
|
454 |
|
|
|
455 |
comboLiFonction = new ComboBox<Valeur>();
|
|
|
456 |
comboLiFonction.setTriggerAction(TriggerAction.ALL);
|
|
|
457 |
comboLiFonction.setEditable(true);
|
|
|
458 |
comboLiFonction.setDisplayField("nom");
|
|
|
459 |
//comboLiStatut.setEmptyText("Sélectionez une fonction...");
|
|
|
460 |
comboLiFonction.setStore(magazinLiFonction);
|
|
|
461 |
|
|
|
462 |
CellEditor fonctionEditor = new CellEditor(comboLiFonction) {
|
|
|
463 |
@Override
|
|
|
464 |
public Object preProcessValue(Object value) {
|
|
|
465 |
if (value == null) {
|
|
|
466 |
return value;
|
|
|
467 |
}
|
|
|
468 |
//GWT.log("pre : "+value.toString(), null);
|
|
|
469 |
return comboLiFonction.getStore().findModel("nom", (String) value);
|
|
|
470 |
}
|
|
|
471 |
|
|
|
472 |
@Override
|
|
|
473 |
public Object postProcessValue(Object value) {
|
|
|
474 |
if (value == null) {
|
|
|
475 |
return value;
|
|
|
476 |
}
|
|
|
477 |
//GWT.log("post : "+value.toString(), null);
|
|
|
478 |
return ((Valeur) value).get("nom");
|
|
|
479 |
}
|
|
|
480 |
};
|
|
|
481 |
column.setEditor(fonctionEditor);
|
102 |
jpm |
482 |
configs.add(column);
|
|
|
483 |
|
|
|
484 |
column = new ColumnConfig();
|
|
|
485 |
column.setId("prenom");
|
103 |
jpm |
486 |
column.setHeader("Prénom");
|
|
|
487 |
column.setWidth(100);
|
|
|
488 |
TextField<String> prenomChp = new TextField<String>();
|
|
|
489 |
prenomChp.setAllowBlank(false);
|
|
|
490 |
prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
|
|
|
491 |
prenomChp.setAutoValidate(true);
|
|
|
492 |
column.setEditor(new CellEditor(prenomChp));
|
102 |
jpm |
493 |
configs.add(column);
|
|
|
494 |
|
|
|
495 |
column = new ColumnConfig();
|
|
|
496 |
column.setId("nom");
|
|
|
497 |
column.setHeader("Nom");
|
103 |
jpm |
498 |
column.setWidth(100);
|
|
|
499 |
TextField<String> nomChp = new TextField<String>();
|
|
|
500 |
nomChp.setAllowBlank(false);
|
|
|
501 |
nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
|
|
|
502 |
nomChp.setAutoValidate(true);
|
|
|
503 |
column.setEditor(new CellEditor(nomChp));
|
102 |
jpm |
504 |
configs.add(column);
|
|
|
505 |
|
103 |
jpm |
506 |
column = new ColumnConfig("tel", "Téléphone", 100);
|
|
|
507 |
TextField<String> telChp = new TextField<String>();
|
|
|
508 |
column.setEditor(new CellEditor(telChp));
|
102 |
jpm |
509 |
configs.add(column);
|
|
|
510 |
|
|
|
511 |
column = new ColumnConfig("fax", "Fax", 100);
|
103 |
jpm |
512 |
TextField<String> faxChp = new TextField<String>();
|
|
|
513 |
column.setEditor(new CellEditor(faxChp));
|
102 |
jpm |
514 |
configs.add(column);
|
|
|
515 |
|
103 |
jpm |
516 |
column = new ColumnConfig("courriel", "Courriel", 100);
|
|
|
517 |
TextField<String> emailChp = new TextField<String>();
|
|
|
518 |
column.setEditor(new CellEditor(emailChp));
|
102 |
jpm |
519 |
configs.add(column);
|
|
|
520 |
|
103 |
jpm |
521 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("statut"));
|
|
|
522 |
magazinLiStatut = new ListStore<Valeur>();
|
|
|
523 |
magazinLiStatut.add(new ArrayList<Valeur>());
|
|
|
524 |
|
|
|
525 |
comboLiStatut = new ComboBox<Valeur>();
|
|
|
526 |
comboLiStatut.setTriggerAction(TriggerAction.ALL);
|
|
|
527 |
comboLiStatut.setEditable(false);
|
|
|
528 |
comboLiStatut.setDisplayField("nom");
|
|
|
529 |
comboLiStatut.setEmptyText("Sélectionez un statut...");
|
|
|
530 |
comboLiStatut.setStore(magazinLiStatut);
|
|
|
531 |
|
|
|
532 |
CellEditor statutEditor = new CellEditor(comboLiStatut) {
|
|
|
533 |
@Override
|
|
|
534 |
public Object preProcessValue(Object value) {
|
|
|
535 |
if (value == null) {
|
|
|
536 |
return value;
|
|
|
537 |
}
|
|
|
538 |
//GWT.log("pre : "+value.toString(), null);
|
|
|
539 |
return comboLiStatut.getStore().findModel("nom", (String) value);
|
|
|
540 |
}
|
|
|
541 |
|
|
|
542 |
@Override
|
|
|
543 |
public Object postProcessValue(Object value) {
|
|
|
544 |
if (value == null) {
|
|
|
545 |
return value;
|
|
|
546 |
}
|
|
|
547 |
//GWT.log("post : "+value.toString(), null);
|
|
|
548 |
return ((Valeur) value).get("nom");
|
|
|
549 |
}
|
|
|
550 |
};
|
|
|
551 |
column = new ColumnConfig("statut", "Statut", 100);
|
|
|
552 |
column.setEditor(statutEditor);
|
102 |
jpm |
553 |
configs.add(column);
|
|
|
554 |
|
103 |
jpm |
555 |
column = new ColumnConfig("tps_w", "Temps travail", 100);
|
|
|
556 |
column.setNumberFormat(NumberFormat.getFormat("##"));
|
|
|
557 |
NumberField tpsWChp = new NumberField();
|
|
|
558 |
tpsWChp.setFormat(NumberFormat.getFormat("##"));
|
|
|
559 |
tpsWChp.setToolTip("Ce champ doit contenir un nombre");
|
|
|
560 |
column.setEditor(new CellEditor(tpsWChp));
|
|
|
561 |
configs.add(column);
|
|
|
562 |
|
|
|
563 |
column = new ColumnConfig("specialites", "Spécialités botaniques", 150);
|
|
|
564 |
TextField<String> speChp = new TextField<String>();
|
|
|
565 |
column.setEditor(new CellEditor(speChp));
|
|
|
566 |
configs.add(column);
|
|
|
567 |
|
|
|
568 |
CheckColumnConfig checkColumn = new CheckColumnConfig("mark_contact", "Contact ?", 60);
|
102 |
jpm |
569 |
configs.add(checkColumn);
|
|
|
570 |
|
|
|
571 |
ContentPanel cp = new ContentPanel();
|
|
|
572 |
cp.setHeading("Personnes travaillant sur les collections");
|
103 |
jpm |
573 |
cp.setIconStyle("icone-table");
|
|
|
574 |
cp.setLayout(new FitLayout());
|
102 |
jpm |
575 |
cp.setFrame(true);
|
|
|
576 |
|
|
|
577 |
ToolBar toolBar = new ToolBar();
|
103 |
jpm |
578 |
|
|
|
579 |
TextToolItem ajouterPersonnelBtn = new TextToolItem("Ajouter", "icone-vcard-ajouter");
|
|
|
580 |
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
|
|
581 |
@Override
|
|
|
582 |
public void componentSelected(ToolBarEvent ce) {
|
|
|
583 |
Personne personne = new Personne();
|
|
|
584 |
grillePersonnel.stopEditing();
|
|
|
585 |
personnelGrilleMagazin.insert(personne, 0);
|
|
|
586 |
grillePersonnel.startEditing(0, 0);
|
|
|
587 |
// Mise à jour du nombre de personnel travaillant sur les collections
|
|
|
588 |
nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
|
|
|
589 |
// Activation du bouton supprimer si la grille contient un élément
|
|
|
590 |
if (grillePersonnel.getStore().getCount() > 0) {
|
|
|
591 |
ce.component.enable();
|
|
|
592 |
}
|
|
|
593 |
}
|
|
|
594 |
});
|
|
|
595 |
toolBar.add(ajouterPersonnelBtn);
|
|
|
596 |
toolBar.add(new SeparatorToolItem());
|
|
|
597 |
TextToolItem supprimerPersonnelBtn = new TextToolItem("Supprimer", "icone-vcard-supprimer");
|
|
|
598 |
supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ToolBarEvent>() {
|
|
|
599 |
@Override
|
|
|
600 |
public void componentSelected(ToolBarEvent ce) {
|
|
|
601 |
grillePersonnel.getStore().remove(grillePersonnel.getStore().getAt(0));
|
|
|
602 |
// Mise à jour du nombre de personnel travaillant sur les collections
|
|
|
603 |
nbreTotalPersonnelChp.setValue(""+grillePersonnel.getStore().getCount());
|
|
|
604 |
// Désactivation du bouton supprimer si la grille contient plus d'élément
|
|
|
605 |
if (grillePersonnel.getStore().getCount() == 0) {
|
|
|
606 |
ce.item.disable();
|
|
|
607 |
}
|
|
|
608 |
}
|
|
|
609 |
});
|
|
|
610 |
toolBar.add(supprimerPersonnelBtn);
|
102 |
jpm |
611 |
cp.setTopComponent(toolBar);
|
|
|
612 |
|
|
|
613 |
ColumnModel cm = new ColumnModel(configs);
|
|
|
614 |
|
103 |
jpm |
615 |
grillePersonnel = new EditorGrid<Personne>(personnelGrilleMagazin, cm);
|
|
|
616 |
grillePersonnel.setBorders(true);
|
|
|
617 |
grillePersonnel.setSelectionModel(sm);
|
|
|
618 |
grillePersonnel.addPlugin(sm);
|
|
|
619 |
grillePersonnel.addPlugin(checkColumn);
|
|
|
620 |
grillePersonnel.setSize(1010, 400);
|
102 |
jpm |
621 |
|
103 |
jpm |
622 |
cp.add(grillePersonnel);
|
102 |
jpm |
623 |
return cp;
|
|
|
624 |
}
|
|
|
625 |
|
69 |
jpm |
626 |
public void rafraichir(Object nouvelleDonnees) {
|
91 |
jpm |
627 |
if (nouvelleDonnees instanceof ValeurListe) {
|
|
|
628 |
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
|
|
|
629 |
|
|
|
630 |
List<Valeur> liste = new ArrayList<Valeur>();
|
|
|
631 |
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
|
|
|
632 |
liste.add(listeValeurs.get(it.next()));
|
|
|
633 |
}
|
|
|
634 |
// Test pour savoir si la liste contient des éléments
|
|
|
635 |
if (liste.size() > 0) {
|
|
|
636 |
Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
|
|
|
637 |
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
|
|
|
638 |
magazinLstpr.removeAll();
|
|
|
639 |
magazinLstpr.add(liste);
|
|
|
640 |
comboLstpr.setStore(magazinLstpr);
|
|
|
641 |
}
|
|
|
642 |
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
|
|
|
643 |
magazinLstpu.removeAll();
|
|
|
644 |
magazinLstpu.add(liste);
|
|
|
645 |
comboLstpu.setStore(magazinLstpu);
|
|
|
646 |
}
|
103 |
jpm |
647 |
if (listeValeurs.getId().equals(config.getListeId("statut"))) {
|
|
|
648 |
magazinLiStatut.removeAll();
|
|
|
649 |
magazinLiStatut.add(liste);
|
|
|
650 |
comboLiStatut.setStore(magazinLiStatut);
|
|
|
651 |
}
|
|
|
652 |
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
|
|
|
653 |
magazinLiFonction.removeAll();
|
|
|
654 |
magazinLiFonction.add(liste);
|
|
|
655 |
comboLiFonction.setStore(magazinLiFonction);
|
|
|
656 |
}
|
|
|
657 |
GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
|
91 |
jpm |
658 |
} else {
|
|
|
659 |
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
|
|
|
660 |
}
|
|
|
661 |
}
|
69 |
jpm |
662 |
}
|
100 |
jpm |
663 |
|
69 |
jpm |
664 |
}
|