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.Collections;
|
4 |
import java.util.Collections;
|
5 |
import java.util.Comparator;
|
5 |
import java.util.Comparator;
|
6 |
import java.util.Iterator;
|
6 |
import java.util.Iterator;
|
7 |
import java.util.List;
|
7 |
import java.util.List;
|
8 |
|
8 |
|
9 |
import org.tela_botanica.client.Mediateur;
|
9 |
import org.tela_botanica.client.Mediateur;
|
10 |
import org.tela_botanica.client.Modele;
|
10 |
import org.tela_botanica.client.Modele;
|
11 |
import org.tela_botanica.client.RegistreId;
|
11 |
import org.tela_botanica.client.RegistreId;
|
12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
12 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
13 |
import org.tela_botanica.client.modeles.Configuration;
|
13 |
import org.tela_botanica.client.modeles.Configuration;
|
- |
|
14 |
import org.tela_botanica.client.modeles.InterneValeur;
|
- |
|
15 |
import org.tela_botanica.client.modeles.InterneValeurListe;
|
14 |
import org.tela_botanica.client.modeles.Structure;
|
16 |
import org.tela_botanica.client.modeles.Structure;
|
15 |
import org.tela_botanica.client.modeles.StructureListe;
|
17 |
import org.tela_botanica.client.modeles.StructureListe;
|
16 |
import org.tela_botanica.client.modeles.Valeur;
|
18 |
import org.tela_botanica.client.modeles.Valeur;
|
17 |
import org.tela_botanica.client.modeles.ValeurListe;
|
19 |
import org.tela_botanica.client.modeles.ValeurListe;
|
18 |
|
20 |
|
19 |
import com.extjs.gxt.ui.client.Registry;
|
21 |
import com.extjs.gxt.ui.client.Registry;
|
20 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
22 |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment;
|
21 |
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
23 |
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
|
22 |
import com.extjs.gxt.ui.client.data.BasePagingLoader;
|
24 |
import com.extjs.gxt.ui.client.data.BasePagingLoader;
|
23 |
import com.extjs.gxt.ui.client.data.JsonReader;
|
25 |
import com.extjs.gxt.ui.client.data.JsonReader;
|
24 |
import com.extjs.gxt.ui.client.data.ListLoadResult;
|
26 |
import com.extjs.gxt.ui.client.data.ListLoadResult;
|
25 |
import com.extjs.gxt.ui.client.data.ModelData;
|
27 |
import com.extjs.gxt.ui.client.data.ModelData;
|
26 |
import com.extjs.gxt.ui.client.data.ModelType;
|
28 |
import com.extjs.gxt.ui.client.data.ModelType;
|
27 |
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
29 |
import com.extjs.gxt.ui.client.data.PagingLoadConfig;
|
28 |
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
30 |
import com.extjs.gxt.ui.client.data.PagingLoadResult;
|
29 |
import com.extjs.gxt.ui.client.data.PagingLoader;
|
31 |
import com.extjs.gxt.ui.client.data.PagingLoader;
|
30 |
import com.extjs.gxt.ui.client.data.ScriptTagProxy;
|
32 |
import com.extjs.gxt.ui.client.data.ScriptTagProxy;
|
- |
|
33 |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
|
- |
|
34 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
|
31 |
import com.extjs.gxt.ui.client.store.ListStore;
|
35 |
import com.extjs.gxt.ui.client.store.ListStore;
|
32 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
36 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
- |
|
37 |
import com.extjs.gxt.ui.client.widget.TabItem;
|
- |
|
38 |
import com.extjs.gxt.ui.client.widget.TabPanel;
|
33 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
39 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
34 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
40 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
41 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
- |
|
42 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
35 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
43 |
import com.extjs.gxt.ui.client.widget.form.FormPanel;
|
36 |
import com.extjs.gxt.ui.client.widget.form.Radio;
|
44 |
import com.extjs.gxt.ui.client.widget.form.Radio;
|
37 |
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
|
45 |
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
|
38 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
46 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
39 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
47 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
48 |
import com.extjs.gxt.ui.client.widget.form.DateField.DateFieldMessages;
|
40 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
49 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
41 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
50 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
42 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
51 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
43 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
52 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
44 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
53 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
- |
|
54 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
45 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
55 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
46 |
import com.google.gwt.core.client.GWT;
|
56 |
import com.google.gwt.core.client.GWT;
|
- |
|
57 |
import com.google.gwt.i18n.client.DateTimeFormat;
|
47 |
|
58 |
|
48 |
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
|
59 |
public class FormStructureVue extends LayoutContainer implements Rafraichissable {
|
49 |
|
60 |
|
50 |
private Modele coelModele = null ;
|
61 |
private Modele coelModele = null ;
|
51 |
private ListStore<Valeur> magazinLstpr = null;
|
62 |
private ListStore<Valeur> magazinLstpr = null;
|
52 |
private ComboBox<Valeur> comboLstpr = null;
|
63 |
private ComboBox<Valeur> comboLstpr = null;
|
53 |
private ListStore<Valeur> magazinLstpu = null;
|
64 |
private ListStore<Valeur> magazinLstpu = null;
|
54 |
private ComboBox<Valeur> comboLstpu = null;
|
65 |
private ComboBox<Valeur> comboLstpu = null;
|
- |
|
66 |
private ComboBox<InterneValeur> comboAcronyme = null;
|
- |
|
67 |
private TextField<String> ihChp = null;
|
- |
|
68 |
private TextField<String> mnhnChp = null;
|
- |
|
69 |
private ComboBox<InterneValeur> comboTypeStructure = null;
|
55 |
|
70 |
|
56 |
public FormStructureVue() {
|
71 |
public FormStructureVue() {
|
57 |
setLayout(new FitLayout());
|
- |
|
58 |
|
72 |
//+-----------------------------------------------------------------------------------------------------------+
|
- |
|
73 |
// Initialisation de variables
|
59 |
// Initialisation de variables
|
74 |
setLayout(new FitLayout());
|
- |
|
75 |
coelModele = Registry.get(RegistreId.MODELE);
|
- |
|
76 |
|
- |
|
77 |
// Création de la disposition : FIELDSET
|
- |
|
78 |
FormLayout layoutFieldset = new FormLayout();
|
- |
|
79 |
layoutFieldset.setLabelWidth(200);
|
- |
|
80 |
layoutFieldset.setPadding(4);
|
60 |
coelModele = Registry.get(RegistreId.MODELE);
|
81 |
|
61 |
|
82 |
//+-----------------------------------------------------------------------------------------------------------+
|
62 |
// Création du panneau Formulaire
|
83 |
// Création du panneau Formulaire
|
63 |
FormPanel panel = new FormPanel();
|
84 |
FormPanel panel = new FormPanel();
|
64 |
panel.setFrame(true);
|
85 |
panel.setFrame(true);
|
65 |
panel.setIconStyle("icone-form-ajouter");
|
86 |
panel.setIconStyle("icone-form-ajouter");
|
66 |
panel.setCollapsible(false);
|
87 |
panel.setCollapsible(false);
|
67 |
panel.setHeading("Ajout d'une institution");
|
88 |
panel.setHeading("Ajout d'une institution");
|
68 |
panel.setButtonAlign(HorizontalAlignment.CENTER);
|
89 |
panel.setButtonAlign(HorizontalAlignment.CENTER);
|
69 |
panel.setLayout(new FlowLayout());
|
90 |
panel.setLayout(new FlowLayout());
|
70 |
|
- |
|
71 |
LayoutContainer main = new LayoutContainer();
|
- |
|
72 |
main.setLayout(new ColumnLayout());
|
- |
|
73 |
|
- |
|
74 |
// Création de la dispostion : GAUCHE
|
- |
|
75 |
LayoutContainer gauche = new LayoutContainer();
|
- |
|
76 |
FormLayout layout = new FormLayout();
|
- |
|
77 |
layout.setLabelAlign(LabelAlign.LEFT);
|
- |
|
78 |
layout.setLabelWidth(200);
|
- |
|
79 |
gauche.setLayout(layout);
|
- |
|
80 |
|
91 |
|
81 |
// Création de la dispostion : DROITE
|
92 |
// Création des onglets
|
82 |
LayoutContainer droite = new LayoutContainer();
|
93 |
TabPanel onglets = new TabPanel();
|
- |
|
94 |
//tabs.setDeferredRender(false);
|
- |
|
95 |
|
- |
|
96 |
//+-----------------------------------------------------------------------------------------------------------+
|
83 |
layout = new FormLayout();
|
97 |
// Onlget formulaire IDENTIFICATION
|
- |
|
98 |
TabItem identificationOnglet = new TabItem();
|
84 |
layout.setLabelAlign(LabelAlign.LEFT);
|
99 |
identificationOnglet.setText("Identification");
|
85 |
droite.setLayout(layout);
|
100 |
identificationOnglet.setLayout(new FormLayout());
|
- |
|
101 |
|
- |
|
102 |
// Fieldset IDENTITÉ
|
- |
|
103 |
FieldSet fieldSetIdentite = new FieldSet();
|
- |
|
104 |
fieldSetIdentite.setHeading("Identité");
|
- |
|
105 |
fieldSetIdentite.setCollapsible(true);
|
86 |
|
106 |
fieldSetIdentite.setLayout(layoutFieldset);
|
87 |
// Formulaire GAUCHE
|
107 |
|
88 |
TextField<String> nomStructureChp = new TextField<String>();
|
108 |
TextField<String> nomStructureChp = new TextField<String>();
|
89 |
nomStructureChp.setFieldLabel("Nom de la structure");
|
109 |
nomStructureChp.setFieldLabel("Nom de la structure");
|
90 |
nomStructureChp.setAllowBlank(false);
|
110 |
nomStructureChp.setAllowBlank(false);
|
- |
|
111 |
nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
|
- |
|
112 |
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
|
- |
|
113 |
|
- |
|
114 |
// Création du sous-formulaire : Acronyme
|
- |
|
115 |
LayoutContainer ligne = new LayoutContainer();
|
- |
|
116 |
ligne.setLayout(new ColumnLayout());
|
- |
|
117 |
LayoutContainer gauche = new LayoutContainer();
|
- |
|
118 |
FormLayout layoutGauche = new FormLayout();
|
- |
|
119 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
- |
|
120 |
layoutGauche.setLabelWidth(200);
|
- |
|
121 |
layoutGauche.setPadding(0);
|
- |
|
122 |
gauche.setLayout(layoutGauche);
|
- |
|
123 |
LayoutContainer droite = new LayoutContainer();
|
- |
|
124 |
FormLayout layoutDroite = new FormLayout();
|
- |
|
125 |
layoutDroite.setLabelWidth(0);
|
- |
|
126 |
layoutDroite.setPadding(0);
|
- |
|
127 |
droite.setLayout(layoutDroite);
|
- |
|
128 |
|
- |
|
129 |
ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();
|
- |
|
130 |
acronymes.add(InterneValeurListe.getTypeAcronyme());
|
- |
|
131 |
|
- |
|
132 |
comboAcronyme = new ComboBox<InterneValeur>();
|
- |
|
133 |
comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
|
- |
|
134 |
comboAcronyme.setFieldLabel("Acronymes");
|
- |
|
135 |
comboAcronyme.setDisplayField("nom");
|
- |
|
136 |
comboAcronyme.setStore(acronymes);
|
- |
|
137 |
comboAcronyme.setEditable(false);
|
- |
|
138 |
comboAcronyme.setTypeAhead(true);
|
- |
|
139 |
comboAcronyme.setTriggerAction(TriggerAction.ALL);
|
- |
|
140 |
comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
|
- |
|
141 |
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
|
- |
|
142 |
String acronymeAbr = se.getSelectedItem().getAbr();
|
- |
|
143 |
if (acronymeAbr.equals("IH")) {
|
- |
|
144 |
mnhnChp.hide();
|
- |
|
145 |
ihChp.show();
|
- |
|
146 |
} else if (acronymeAbr.equals("MNHN")) {
|
- |
|
147 |
ihChp.hide();
|
- |
|
148 |
mnhnChp.show();
|
- |
|
149 |
} else if (acronymeAbr.equals("")) {
|
- |
|
150 |
ihChp.hide();
|
- |
|
151 |
mnhnChp.hide();
|
- |
|
152 |
comboAcronyme.clearSelections();
|
- |
|
153 |
}
|
- |
|
154 |
}
|
- |
|
155 |
});
|
91 |
gauche.add(nomStructureChp);
|
156 |
gauche.add(comboAcronyme);
|
92 |
|
157 |
|
93 |
TextField<String> ihChp = new TextField<String>();
|
158 |
ihChp = new TextField<String>();
|
- |
|
159 |
//ihChp.setEmptyText("Index Herbariorum");
|
94 |
ihChp.setFieldLabel("Acronyme Index Herbariorum");
|
160 |
ihChp.setLabelSeparator("");
|
- |
|
161 |
ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
|
95 |
ihChp.setToolTip("Herbier de plus de 5000 échantillons");
|
162 |
ihChp.hide();
|
96 |
gauche.add(ihChp);
|
163 |
droite.add(ihChp);
|
97 |
|
164 |
|
- |
|
165 |
mnhnChp = new TextField<String>();
|
98 |
TextField<String> mnhnChp = new TextField<String>();
|
166 |
//mnhnChp.setEmptyText("MNHN");
|
99 |
mnhnChp.setFieldLabel("Acronyme MNHN");
|
167 |
mnhnChp.setLabelSeparator("");
|
- |
|
168 |
mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
|
100 |
mnhnChp.setToolTip("Herbier de moins de 5000 échantillons");
|
169 |
mnhnChp.hide();
|
- |
|
170 |
droite.add(mnhnChp);
|
- |
|
171 |
|
- |
|
172 |
ligne.add(gauche, new ColumnData(0.5));
|
- |
|
173 |
ligne.add(droite, new ColumnData(0.5));
|
- |
|
174 |
fieldSetIdentite.add(ligne);
|
- |
|
175 |
|
- |
|
176 |
// Création du sous-formulaire : Type de Structure
|
- |
|
177 |
LayoutContainer ligneTs = new LayoutContainer();
|
- |
|
178 |
ligneTs.setLayout(new ColumnLayout());
|
- |
|
179 |
|
- |
|
180 |
LayoutContainer gaucheTs = new LayoutContainer();
|
- |
|
181 |
layoutGauche = new FormLayout();
|
- |
|
182 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
- |
|
183 |
layoutGauche.setLabelWidth(200);
|
- |
|
184 |
layoutGauche.setPadding(0);
|
- |
|
185 |
gaucheTs.setLayout(layoutGauche);
|
- |
|
186 |
|
- |
|
187 |
LayoutContainer droiteTs = new LayoutContainer();
|
- |
|
188 |
layoutDroite = new FormLayout();
|
- |
|
189 |
layoutDroite.setLabelWidth(0);
|
- |
|
190 |
layoutDroite.setPadding(0);
|
- |
|
191 |
droiteTs.setLayout(layoutDroite);
|
- |
|
192 |
|
- |
|
193 |
ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();
|
- |
|
194 |
typesStructure.add(InterneValeurListe.getTypeStructure());
|
- |
|
195 |
|
- |
|
196 |
this.comboTypeStructure = new ComboBox<InterneValeur>();
|
- |
|
197 |
comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
|
- |
|
198 |
comboTypeStructure.setFieldLabel("Statut des structures");
|
- |
|
199 |
comboTypeStructure.setDisplayField("nom");
|
- |
|
200 |
comboTypeStructure.setStore(typesStructure);
|
- |
|
201 |
comboTypeStructure.setEditable(false);
|
- |
|
202 |
comboTypeStructure.setTypeAhead(true);
|
- |
|
203 |
comboTypeStructure.setTriggerAction(TriggerAction.ALL);
|
- |
|
204 |
comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
|
- |
|
205 |
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
|
- |
|
206 |
String typeAbr = se.getSelectedItem().getAbr();
|
- |
|
207 |
if (typeAbr.equals("stpu")) {
|
- |
|
208 |
comboLstpr.hide();
|
- |
|
209 |
comboLstpu.show();
|
- |
|
210 |
} else if (typeAbr.equals("stpr")) {
|
- |
|
211 |
comboLstpu.hide();
|
- |
|
212 |
comboLstpr.show();
|
- |
|
213 |
} else if (typeAbr.equals("")) {
|
- |
|
214 |
comboLstpr.hide();
|
- |
|
215 |
comboLstpu.hide();
|
- |
|
216 |
comboTypeStructure.clearSelections();
|
- |
|
217 |
}
|
- |
|
218 |
}
|
- |
|
219 |
});
|
101 |
gauche.add(mnhnChp);
|
- |
|
102 |
|
220 |
gaucheTs.add(comboTypeStructure);
|
103 |
// Combobox
|
221 |
|
104 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpu"));
|
222 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpu"));
|
105 |
magazinLstpu = new ListStore<Valeur>();
|
223 |
magazinLstpu = new ListStore<Valeur>();
|
106 |
magazinLstpu.add(new ArrayList<Valeur>());
|
224 |
magazinLstpu.add(new ArrayList<Valeur>());
|
107 |
comboLstpu = new ComboBox<Valeur>();
|
225 |
comboLstpu = new ComboBox<Valeur>();
|
108 |
comboLstpu.setFieldLabel("Statut des structures publiques");
|
226 |
//comboLstpu.setFieldLabel("Statut des structures publiques");
|
- |
|
227 |
comboLstpu.setLabelSeparator("");
|
109 |
comboLstpu.setDisplayField("nom");
|
228 |
comboLstpu.setDisplayField("nom");
|
- |
|
229 |
comboLstpu.setEditable(false);
|
110 |
comboLstpu.setTriggerAction(TriggerAction.ALL);
|
230 |
comboLstpu.setTriggerAction(TriggerAction.ALL);
|
111 |
comboLstpu.setStore(magazinLstpu);
|
231 |
comboLstpu.setStore(magazinLstpu);
|
- |
|
232 |
comboLstpu.hide();
|
112 |
gauche.add(comboLstpu);
|
233 |
droiteTs.add(comboLstpu);
|
113 |
|
234 |
|
114 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpr"));
|
235 |
coelModele.obtenirListeValeurs(((Configuration) Registry.get(RegistreId.CONFIG)).getListeId("stpr"));
|
115 |
magazinLstpr = new ListStore<Valeur>();
|
236 |
magazinLstpr = new ListStore<Valeur>();
|
116 |
magazinLstpr.add(new ArrayList<Valeur>());
|
237 |
magazinLstpr.add(new ArrayList<Valeur>());
|
117 |
comboLstpr = new ComboBox<Valeur>();
|
238 |
comboLstpr = new ComboBox<Valeur>();
|
118 |
comboLstpr.setFieldLabel("Statut des structures privées");
|
239 |
//comboLstpr.setFieldLabel("Statut des structures privées");
|
- |
|
240 |
comboLstpr.setLabelSeparator("");
|
119 |
comboLstpr.setDisplayField("nom");
|
241 |
comboLstpr.setDisplayField("nom");
|
- |
|
242 |
comboLstpr.setEditable(false);
|
120 |
comboLstpr.setTriggerAction(TriggerAction.ALL);
|
243 |
comboLstpr.setTriggerAction(TriggerAction.ALL);
|
121 |
comboLstpr.setStore(magazinLstpr);
|
244 |
comboLstpr.setStore(magazinLstpr);
|
- |
|
245 |
comboLstpr.hide();
|
122 |
gauche.add(comboLstpr);
|
246 |
droiteTs.add(comboLstpr);
|
- |
|
247 |
|
- |
|
248 |
ligneTs.add(gaucheTs, new ColumnData(0.5));
|
- |
|
249 |
ligneTs.add(droiteTs, new ColumnData(0.5));
|
- |
|
250 |
fieldSetIdentite.add(ligneTs);
|
- |
|
251 |
|
- |
|
252 |
DateField dateFondationChp = new DateField();
|
- |
|
253 |
dateFondationChp.setFieldLabel("Date de fondation");
|
- |
|
254 |
dateFondationChp.getPropertyEditor().getFormat();
|
- |
|
255 |
dateFondationChp.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
|
- |
|
256 |
dateFondationChp.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa».");
|
- |
|
257 |
fieldSetIdentite.add(dateFondationChp);
|
- |
|
258 |
|
- |
|
259 |
identificationOnglet.add(fieldSetIdentite);
|
- |
|
260 |
|
- |
|
261 |
// Fieldset ADRESSE
|
- |
|
262 |
LayoutContainer principalFdAdresse = new LayoutContainer();
|
- |
|
263 |
principalFdAdresse.setLayout(new ColumnLayout());
|
- |
|
264 |
|
- |
|
265 |
LayoutContainer gaucheFdAdresse = new LayoutContainer();
|
- |
|
266 |
layoutGauche = new FormLayout();
|
- |
|
267 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
- |
|
268 |
layoutGauche.setLabelWidth(100);
|
- |
|
269 |
layoutGauche.setPadding(0);
|
- |
|
270 |
gaucheFdAdresse.setLayout(layoutGauche);
|
- |
|
271 |
|
- |
|
272 |
LayoutContainer droiteFdAdresse = new LayoutContainer();
|
- |
|
273 |
layoutDroite = new FormLayout();
|
- |
|
274 |
layoutDroite.setLabelAlign(LabelAlign.LEFT);
|
- |
|
275 |
layoutDroite.setLabelWidth(100);
|
- |
|
276 |
layoutDroite.setPadding(0);
|
- |
|
277 |
droiteFdAdresse.setLayout(layoutDroite);
|
- |
|
278 |
|
- |
|
279 |
FieldSet fieldSetAdresse = new FieldSet();
|
- |
|
280 |
fieldSetAdresse.setHeading("Adresse");
|
- |
|
281 |
fieldSetAdresse.setCollapsible(true);
|
- |
|
282 |
|
- |
|
283 |
layoutFieldset = new FormLayout();
|
- |
|
284 |
layoutFieldset.setLabelWidth(100);
|
- |
|
285 |
layoutFieldset.setPadding(4);
|
- |
|
286 |
fieldSetAdresse.setLayout(layoutFieldset);
|
123 |
|
287 |
|
124 |
TextField<String> adrChp = new TextField<String>();
|
288 |
TextField<String> adrChp = new TextField<String>();
|
125 |
adrChp.setFieldLabel("Adresse");
|
289 |
adrChp.setFieldLabel("Adresse");
|
126 |
gauche.add(adrChp);
|
290 |
fieldSetAdresse.add(adrChp, new FormData(550, 0));
|
127 |
|
291 |
|
128 |
TextField<String> cpChp = new TextField<String>();
|
292 |
TextField<String> cpChp = new TextField<String>();
|
129 |
cpChp.setFieldLabel("Code postal");
|
293 |
cpChp.setFieldLabel("Code postal");
|
130 |
gauche.add(cpChp);
|
294 |
gaucheFdAdresse.add(cpChp);
|
131 |
|
295 |
|
132 |
TextField<String> villeChp = new TextField<String>();
|
296 |
TextField<String> villeChp = new TextField<String>();
|
133 |
villeChp.setFieldLabel("Ville");
|
297 |
villeChp.setFieldLabel("Ville");
|
134 |
gauche.add(villeChp);
|
298 |
droiteFdAdresse.add(villeChp);
|
135 |
|
299 |
|
136 |
TextField<String> regionChp = new TextField<String>();
|
300 |
TextField<String> regionChp = new TextField<String>();
|
137 |
regionChp.setFieldLabel("Région");
|
301 |
regionChp.setFieldLabel("Région");
|
138 |
gauche.add(regionChp);
|
302 |
gaucheFdAdresse.add(regionChp);
|
139 |
|
303 |
|
140 |
TextField<String> paysChp = new TextField<String>();
|
304 |
TextField<String> paysChp = new TextField<String>();
|
141 |
paysChp.setFieldLabel("Pays");
|
305 |
paysChp.setFieldLabel("Pays");
|
142 |
gauche.add(paysChp);
|
306 |
droiteFdAdresse.add(paysChp);
|
- |
|
307 |
|
- |
|
308 |
principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
|
- |
|
309 |
principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
|
- |
|
310 |
fieldSetAdresse.add(principalFdAdresse);
|
- |
|
311 |
identificationOnglet.add(fieldSetAdresse);
|
- |
|
312 |
|
- |
|
313 |
// Fieldset TÉLÉPHONE et EMAIL
|
- |
|
314 |
|
- |
|
315 |
LayoutContainer principalFdTelMail = new LayoutContainer();
|
- |
|
316 |
principalFdTelMail.setLayout(new ColumnLayout());
|
- |
|
317 |
|
- |
|
318 |
LayoutContainer gaucheFdTelMail = new LayoutContainer();
|
- |
|
319 |
layoutGauche = new FormLayout();
|
- |
|
320 |
layoutGauche.setLabelAlign(LabelAlign.LEFT);
|
- |
|
321 |
layoutGauche.setLabelWidth(100);
|
- |
|
322 |
layoutGauche.setPadding(0);
|
- |
|
323 |
gaucheFdTelMail.setLayout(layoutGauche);
|
- |
|
324 |
|
- |
|
325 |
LayoutContainer droiteFdTelMail = new LayoutContainer();
|
- |
|
326 |
layoutDroite = new FormLayout();
|
- |
|
327 |
layoutDroite.setLabelAlign(LabelAlign.LEFT);
|
- |
|
328 |
layoutDroite.setLabelWidth(100);
|
- |
|
329 |
layoutDroite.setPadding(0);
|
- |
|
330 |
droiteFdTelMail.setLayout(layoutDroite);
|
- |
|
331 |
|
- |
|
332 |
FieldSet fieldSetTelMail = new FieldSet();
|
- |
|
333 |
fieldSetTelMail.setHeading("Communication");
|
- |
|
334 |
fieldSetTelMail.setCollapsible(true);
|
- |
|
335 |
|
- |
|
336 |
layoutFieldset = new FormLayout();
|
- |
|
337 |
layoutFieldset.setLabelWidth(200);
|
- |
|
338 |
layoutFieldset.setPadding(4);
|
- |
|
339 |
fieldSetTelMail.setLayout(layoutFieldset);
|
143 |
|
340 |
|
144 |
TextField<String> telChp = new TextField<String>();
|
341 |
TextField<String> telChp = new TextField<String>();
|
145 |
telChp.setFieldLabel("Téléphone");
|
342 |
telChp.setFieldLabel("Téléphone");
|
146 |
gauche.add(telChp);
|
343 |
gaucheFdTelMail.add(telChp);
|
147 |
|
344 |
|
148 |
TextField<String> faxChp = new TextField<String>();
|
345 |
TextField<String> faxChp = new TextField<String>();
|
149 |
faxChp.setFieldLabel("Fax");
|
346 |
faxChp.setFieldLabel("Fax");
|
150 |
gauche.add(faxChp);
|
347 |
droiteFdTelMail.add(faxChp);
|
151 |
|
348 |
|
152 |
TextField<String> emailChp = new TextField<String>();
|
349 |
TextField<String> emailChp = new TextField<String>();
|
153 |
emailChp.setFieldLabel("Courriel");
|
350 |
emailChp.setFieldLabel("Courriel");
|
154 |
emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
|
351 |
emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
|
155 |
gauche.add(emailChp);
|
352 |
gaucheFdTelMail.add(emailChp);
|
156 |
|
353 |
|
157 |
TextField<String> urlChp = new TextField<String>();
|
354 |
TextField<String> urlChp = new TextField<String>();
|
158 |
urlChp.setFieldLabel("Site web");
|
355 |
urlChp.setFieldLabel("Site web");
|
159 |
gauche.add(urlChp);
|
356 |
droiteFdTelMail.add(urlChp);
|
- |
|
357 |
|
- |
|
358 |
principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
|
- |
|
359 |
principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
|
- |
|
360 |
fieldSetTelMail.add(principalFdTelMail);
|
- |
|
361 |
identificationOnglet.add(fieldSetTelMail);
|
- |
|
362 |
|
- |
|
363 |
onglets.add(identificationOnglet);
|
- |
|
364 |
|
- |
|
365 |
//+-----------------------------------------------------------------------------------------------------------+
|
- |
|
366 |
// Onlget formulaire PERSONNEL
|
- |
|
367 |
TabItem personnelOnglet = new TabItem();
|
- |
|
368 |
personnelOnglet.setText("Personnel");
|
- |
|
369 |
personnelOnglet.setLayout(new FormLayout());
|
- |
|
370 |
|
- |
|
371 |
|
- |
|
372 |
onglets.add(personnelOnglet);
|
- |
|
373 |
|
- |
|
374 |
//+-----------------------------------------------------------------------------------------------------------+
|
160 |
|
375 |
// Onlget formulaire CONSERVATION
|
- |
|
376 |
TabItem conservationOnglet = new TabItem();
|
- |
|
377 |
conservationOnglet.setText("Conservation");
|
- |
|
378 |
conservationOnglet.setLayout(new FormLayout());
|
- |
|
379 |
|
- |
|
380 |
|
- |
|
381 |
onglets.add(conservationOnglet);
|
- |
|
382 |
|
- |
|
383 |
//+-----------------------------------------------------------------------------------------------------------+
|
- |
|
384 |
// Onlget formulaire VALORISATION
|
161 |
TextField<String> dateFondationChp = new TextField<String>();
|
385 |
TabItem valorisationOnglet = new TabItem();
|
- |
|
386 |
valorisationOnglet.setText("Valorisation");
|
- |
|
387 |
valorisationOnglet.setLayout(new FormLayout());
|
- |
|
388 |
|
162 |
dateFondationChp.setFieldLabel("Date de fondation");
|
389 |
|
- |
|
390 |
onglets.add(valorisationOnglet);
|
- |
|
391 |
|
- |
|
392 |
//+-----------------------------------------------------------------------------------------------------------+
|
- |
|
393 |
// Gestion du FORMULAIRE GÉNÉRAL
|
- |
|
394 |
// Ajout du type
|
- |
|
395 |
LayoutContainer typeConteneur = new LayoutContainer();
|
- |
|
396 |
layoutDroite = new FormLayout();
|
- |
|
397 |
layoutDroite.setLabelWidth(50);
|
- |
|
398 |
layoutDroite.setPadding(5);
|
163 |
gauche.add(dateFondationChp);
|
- |
|
164 |
|
399 |
typeConteneur.setLayout(layoutDroite);
|
165 |
// Formulaire DROITE
|
400 |
|
166 |
RadioGroup group = new RadioGroup();
|
401 |
RadioGroup group = new RadioGroup();
|
167 |
group.setFieldLabel("Type");
|
402 |
group.setFieldLabel("Type");
|
168 |
Radio structureRadio = new Radio();
|
403 |
Radio structureRadio = new Radio();
|
169 |
structureRadio.setBoxLabel("Structure");
|
404 |
structureRadio.setBoxLabel("Structure");
|
170 |
structureRadio.setValue(true);
|
405 |
structureRadio.setValue(true);
|
171 |
group.add(structureRadio);
|
406 |
group.add(structureRadio);
|
172 |
Radio particulierRadio = new Radio();
|
407 |
Radio particulierRadio = new Radio();
|
173 |
particulierRadio.setBoxLabel("Particulier");
|
408 |
particulierRadio.setBoxLabel("Particulier");
|
174 |
group.add(particulierRadio);
|
409 |
group.add(particulierRadio);
|
175 |
droite.add(group);
|
410 |
typeConteneur.add(group);
|
- |
|
411 |
panel.add(typeConteneur);
|
176 |
|
412 |
|
177 |
// Ajout des colonnes
|
- |
|
178 |
main.add(gauche, new ColumnData(.5));
|
- |
|
179 |
main.add(droite, new ColumnData(.5));
|
413 |
// Ajout des onglets
|
180 |
panel.add(main);
|
414 |
panel.add(onglets);
|
181 |
|
415 |
|
182 |
// Ajout des boutons au panneau formulaire
|
416 |
// Ajout des boutons au panneau formulaire
|
183 |
Button annulerBtn = new Button("Annuler");
|
417 |
Button annulerBtn = new Button("Annuler");
|
184 |
panel.addButton(annulerBtn);
|
418 |
panel.addButton(annulerBtn);
|
185 |
Button validerBtn = new Button("Valider");
|
419 |
Button validerBtn = new Button("Valider");
|
186 |
panel.addButton(validerBtn);
|
420 |
panel.addButton(validerBtn);
|
187 |
|
421 |
|
188 |
// Ajout du panneau Formulaire à la disposition générale
|
422 |
// Ajout du panneau Formulaire à la disposition générale
|
189 |
add(panel);
|
423 |
add(panel);
|
190 |
}
|
424 |
}
|
191 |
|
425 |
|
192 |
public void rafraichir(Object nouvelleDonnees) {
|
426 |
public void rafraichir(Object nouvelleDonnees) {
|
193 |
if (nouvelleDonnees instanceof ValeurListe) {
|
427 |
if (nouvelleDonnees instanceof ValeurListe) {
|
194 |
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
|
428 |
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees;
|
195 |
|
429 |
|
196 |
List<Valeur> liste = new ArrayList<Valeur>();
|
430 |
List<Valeur> liste = new ArrayList<Valeur>();
|
197 |
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
|
431 |
for (Iterator<String> it = listeValeurs.keySet().iterator(); it.hasNext();) {
|
198 |
liste.add(listeValeurs.get(it.next()));
|
432 |
liste.add(listeValeurs.get(it.next()));
|
199 |
}
|
433 |
}
|
200 |
// Test pour savoir si la liste contient des éléments
|
434 |
// Test pour savoir si la liste contient des éléments
|
201 |
if (liste.size() > 0) {
|
435 |
if (liste.size() > 0) {
|
202 |
Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
|
436 |
Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
|
203 |
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
|
437 |
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
|
204 |
GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
|
438 |
GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
|
205 |
magazinLstpr.removeAll();
|
439 |
magazinLstpr.removeAll();
|
206 |
magazinLstpr.add(liste);
|
440 |
magazinLstpr.add(liste);
|
207 |
comboLstpr.setStore(magazinLstpr);
|
441 |
comboLstpr.setStore(magazinLstpr);
|
208 |
}
|
442 |
}
|
209 |
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
|
443 |
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
|
210 |
GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
|
444 |
GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
|
211 |
magazinLstpu.removeAll();
|
445 |
magazinLstpu.removeAll();
|
212 |
magazinLstpu.add(liste);
|
446 |
magazinLstpu.add(liste);
|
213 |
comboLstpu.setStore(magazinLstpu);
|
447 |
comboLstpu.setStore(magazinLstpu);
|
214 |
}
|
448 |
}
|
215 |
} else {
|
449 |
} else {
|
216 |
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
|
450 |
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
|
217 |
}
|
451 |
}
|
218 |
}
|
452 |
}
|
219 |
}
|
453 |
}
|
- |
|
454 |
|
220 |
}
|
455 |
}
|