| Line 9... |
Line 9... |
| 9 |
import org.tela_botanica.client.modeles.ProjetListe;
|
9 |
import org.tela_botanica.client.modeles.ProjetListe;
|
| 10 |
import org.tela_botanica.client.modeles.Structure;
|
10 |
import org.tela_botanica.client.modeles.Structure;
|
| 11 |
import org.tela_botanica.client.modeles.StructureListe;
|
11 |
import org.tela_botanica.client.modeles.StructureListe;
|
| 12 |
import org.tela_botanica.client.modeles.Valeur;
|
12 |
import org.tela_botanica.client.modeles.Valeur;
|
| 13 |
import org.tela_botanica.client.modeles.ValeurListe;
|
13 |
import org.tela_botanica.client.modeles.ValeurListe;
|
| - |
|
14 |
|
| 14 |
import com.extjs.gxt.ui.client.store.ListStore;
|
15 |
import com.extjs.gxt.ui.client.store.ListStore;
|
| 15 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
16 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
| 16 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
17 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
| 17 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
18 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 18 |
import com.extjs.gxt.ui.client.widget.form.HiddenField;
|
19 |
import com.extjs.gxt.ui.client.widget.form.HiddenField;
|
| 19 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
- |
|
| 20 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
20 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
| 21 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
- |
|
| 22 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
21 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
| 23 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
22 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
| 24 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
23 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
| 25 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
24 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| 26 |
import com.google.gwt.core.client.GWT;
|
25 |
import com.google.gwt.core.client.GWT;
|
| 27 |
import com.google.gwt.i18n.client.NumberFormat;
|
- |
|
| Line 28... |
Line 26... |
| 28 |
|
26 |
|
| Line 29... |
Line 27... |
| 29 |
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
|
27 |
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
|
| Line 30... |
Line -... |
| 30 |
|
- |
|
| 31 |
private HiddenField<String> idCollectionChp;
|
- |
|
| 32 |
|
- |
|
| 33 |
private FieldSet descriptionFieldSet;
|
- |
|
| 34 |
private ListStore<Valeur> typesCollectionStore;
|
- |
|
| 35 |
private ListStore<Valeur> typeCollectionBotaStore;
|
- |
|
| 36 |
private ListStore<Valeur> typeDepotStore;
|
- |
|
| 37 |
private ComboBox<Valeur> typeDepotCombo;
|
- |
|
| 38 |
private ComboBox<Valeur> typesCollectionBotaCombo;
|
28 |
|
| 39 |
private ComboBox<Valeur> typesCollectionCombo;
|
29 |
private HiddenField<String> idCollectionChp;
|
| 40 |
|
- |
|
| 41 |
private ListStore<Projet> projetsStore;
|
30 |
|
| 42 |
private ComboBox<Projet> projetsCombo;
|
- |
|
| 43 |
|
31 |
private ListStore<Projet> projetsStore;
|
| 44 |
private ComboBox<Structure> structuresCombo;
|
- |
|
| 45 |
|
32 |
private ComboBox<Projet> projetsCombo;
|
| 46 |
private ListStore<Structure> structuresStore;
|
- |
|
| 47 |
|
33 |
private ComboBox<Structure> structuresCombo;
|
| - |
|
34 |
private ListStore<Structure> structuresStore;
|
| - |
|
35 |
private ComboBox<Collection> collectionsCombo;
|
| - |
|
36 |
private ListStore<Collection> collectionsStore;
|
| - |
|
37 |
|
| Line -... |
Line 38... |
| - |
|
38 |
private FieldSet descriptionFieldSet;
|
| - |
|
39 |
private ListStore<Valeur> typeDepotStore;
|
| 48 |
private ComboBox<Collection> collectionsCombo;
|
40 |
private ComboBox<Valeur> typeDepotCombo;
|
| 49 |
|
41 |
|
| 50 |
private ListStore<Collection> collectionsStore;
|
42 |
private TextArea lieuCouvertureChp;
|
| 51 |
|
43 |
|
| Line 52... |
Line 44... |
| 52 |
public CollectionFormGeneral(Formulaire formulaireCourrant) {
|
44 |
public CollectionFormGeneral(Formulaire formulaireCourrant) {
|
| 53 |
initialiserOnglet(formulaireCourrant);
|
45 |
initialiserOnglet(formulaireCourrant);
|
| 54 |
setId("general");
|
46 |
setId("general");
|
| 55 |
setText(Mediateur.i18nC.collectionGeneral());
|
47 |
setText(Mediateur.i18nC.collectionGeneral());
|
| - |
|
48 |
|
| 56 |
|
49 |
creerChampsCache();
|
| Line 57... |
Line 50... |
| 57 |
creerChampsCache();
|
50 |
creerFieldsetLiaison();
|
| 58 |
creerFieldsetLiaison();
|
51 |
creerFieldsetAdministratif();
|
| 59 |
creerFieldsetAdministratif();
|
52 |
creerFieldsetDescription();
|
| 60 |
creerFieldsetDescription();
|
53 |
creerFieldsetCouverture();
|
| 61 |
}
|
54 |
}
|
| Line 62... |
Line 55... |
| 62 |
|
55 |
|
| 63 |
private void creerChampsCache() {
|
- |
|
| 64 |
// Champs cachés
|
56 |
private void creerChampsCache() {
|
| 65 |
idCollectionChp = new HiddenField<String>();
|
57 |
// Champs cachés
|
| 66 |
this.add(idCollectionChp);
|
58 |
idCollectionChp = new HiddenField<String>();
|
| 67 |
}
|
59 |
this.add(idCollectionChp);
|
| Line 68... |
Line 60... |
| 68 |
|
60 |
}
|
| 69 |
private void creerFieldsetLiaison() {
|
61 |
|
| 70 |
// Fieldset LIAISON
|
62 |
private void creerFieldsetLiaison() {
|
| 71 |
FieldSet liaisonFieldSet = new FieldSet();
|
63 |
FieldSet liaisonFieldSet = new FieldSet();
|
| Line 158... |
Line 150... |
| 158 |
private void creerFieldsetAdministratif() {
|
150 |
private void creerFieldsetAdministratif() {
|
| 159 |
// Fieldset ADMINISTRATIF
|
151 |
// Fieldset ADMINISTRATIF
|
| 160 |
FieldSet administratifFieldSet = new FieldSet();
|
152 |
FieldSet administratifFieldSet = new FieldSet();
|
| 161 |
administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
|
153 |
administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
|
| 162 |
administratifFieldSet.setCollapsible(true);
|
154 |
administratifFieldSet.setCollapsible(true);
|
| 163 |
administratifFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
|
155 |
administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
| 164 |
|
- |
|
| 165 |
typesCollectionStore = new ListStore<Valeur>();
|
- |
|
| 166 |
typesCollectionCombo = new ComboBox<Valeur>();
|
- |
|
| 167 |
typesCollectionCombo.setTabIndex(tabIndex++);
|
- |
|
| 168 |
typesCollectionCombo.setFieldLabel(i18nC.typeCollectionNcd());
|
- |
|
| 169 |
typesCollectionCombo.setDisplayField("nom");
|
- |
|
| 170 |
typesCollectionCombo.setForceSelection(true);
|
- |
|
| 171 |
typesCollectionCombo.setValidator(new Validator() {
|
- |
|
| 172 |
@Override
|
- |
|
| 173 |
public String validate(Field<?> field, String value) {
|
- |
|
| 174 |
String retour = null;
|
- |
|
| 175 |
if (field.getRawValue().equals("")) {
|
- |
|
| 176 |
field.setValue(null);
|
- |
|
| 177 |
} else if (typesCollectionStore.findModel("nom", field.getRawValue()) == null) {
|
- |
|
| 178 |
String contenuBrut = field.getRawValue();
|
- |
|
| 179 |
field.setValue(null);
|
- |
|
| 180 |
field.setRawValue(contenuBrut);
|
- |
|
| 181 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
- |
|
| 182 |
}
|
- |
|
| 183 |
return retour;
|
- |
|
| 184 |
}
|
- |
|
| 185 |
});
|
- |
|
| 186 |
typesCollectionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 187 |
typesCollectionCombo.setStore(typesCollectionStore);
|
- |
|
| 188 |
administratifFieldSet.add(typesCollectionCombo, new FormData(250, 0));
|
- |
|
| 189 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionNcd");
|
- |
|
| 190 |
|
- |
|
| 191 |
typeCollectionBotaStore = new ListStore<Valeur>();
|
- |
|
| 192 |
typesCollectionBotaCombo = new ComboBox<Valeur>();
|
- |
|
| 193 |
typesCollectionBotaCombo.setTabIndex(tabIndex++);
|
- |
|
| 194 |
typesCollectionBotaCombo.setFieldLabel(i18nC.typeCollectionBotanique());
|
- |
|
| 195 |
typesCollectionBotaCombo.setDisplayField("nom");
|
- |
|
| 196 |
typesCollectionBotaCombo.setForceSelection(true);
|
- |
|
| 197 |
typesCollectionBotaCombo.setValidator(new Validator() {
|
- |
|
| 198 |
@Override
|
- |
|
| 199 |
public String validate(Field<?> field, String value) {
|
- |
|
| 200 |
String retour = null;
|
- |
|
| 201 |
if (field.getRawValue().equals("")) {
|
- |
|
| 202 |
field.setValue(null);
|
- |
|
| 203 |
} else if (typeCollectionBotaStore.findModel("nom", field.getRawValue()) == null) {
|
- |
|
| 204 |
String contenuBrut = field.getRawValue();
|
- |
|
| 205 |
field.setValue(null);
|
- |
|
| 206 |
field.setRawValue(contenuBrut);
|
- |
|
| 207 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
- |
|
| 208 |
}
|
- |
|
| 209 |
return retour;
|
- |
|
| 210 |
}
|
- |
|
| 211 |
});
|
- |
|
| 212 |
typesCollectionBotaCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 213 |
typesCollectionBotaCombo.setStore(typeCollectionBotaStore);
|
- |
|
| 214 |
administratifFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
|
- |
|
| 215 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionBota");
|
- |
|
| Line 216... |
Line 156... |
| 216 |
|
156 |
|
| 217 |
typeDepotStore = new ListStore<Valeur>();
|
157 |
typeDepotStore = new ListStore<Valeur>();
|
| 218 |
typeDepotCombo = new ComboBox<Valeur>();
|
158 |
typeDepotCombo = new ComboBox<Valeur>();
|
| 219 |
typeDepotCombo.setTabIndex(tabIndex++);
|
159 |
typeDepotCombo.setTabIndex(tabIndex++);
|
| Line 234... |
Line 174... |
| 234 |
}
|
174 |
}
|
| 235 |
return retour;
|
175 |
return retour;
|
| 236 |
}
|
176 |
}
|
| 237 |
});
|
177 |
});
|
| 238 |
typeDepotCombo.setTriggerAction(TriggerAction.ALL);
|
178 |
typeDepotCombo.setTriggerAction(TriggerAction.ALL);
|
| 239 |
typeDepotCombo.setStore(typeCollectionBotaStore);
|
179 |
typeDepotCombo.setStore(typeDepotStore);
|
| 240 |
administratifFieldSet.add(typeDepotCombo, new FormData(250, 0));
|
180 |
administratifFieldSet.add(typeDepotCombo, new FormData(250, 0));
|
| 241 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeDepot");
|
181 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeDepot");
|
| 242 |
|
182 |
|
| 243 |
TextField<String> coteChp = new TextField<String>();
|
- |
|
| 244 |
coteChp.setTabIndex(tabIndex++);
|
- |
|
| 245 |
coteChp.setFieldLabel(i18nC.cote());
|
- |
|
| 246 |
administratifFieldSet.add(coteChp, new FormData(450, 0));
|
- |
|
| 247 |
|
- |
|
| 248 |
NumberField nbreEchantillonChp = new NumberField();
|
- |
|
| 249 |
nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
|
- |
|
| 250 |
nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
|
- |
|
| 251 |
nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
|
- |
|
| 252 |
nbreEchantillonChp.setToolTip(i18nC.champNumerique());
|
- |
|
| 253 |
administratifFieldSet.add(nbreEchantillonChp);
|
- |
|
| 254 |
|
- |
|
| 255 |
TextField<String> nomChp = new TextField<String>();
|
- |
|
| 256 |
nomChp.setTabIndex(tabIndex++);
|
- |
|
| 257 |
nomChp.setFieldLabel(i18nC.nomCollection());
|
- |
|
| 258 |
nomChp.setAllowBlank(false);
|
- |
|
| 259 |
nomChp.getMessages().setBlankText(i18nC.champObligatoire());
|
- |
|
| 260 |
administratifFieldSet.add(nomChp, new FormData(450, 0));
|
- |
|
| 261 |
|
- |
|
| 262 |
ChampMultiValeurs nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
|
183 |
ChampMultiValeurs nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
|
| 263 |
administratifFieldSet.add(nomsAlternatifsChp);
|
184 |
administratifFieldSet.add(nomsAlternatifsChp);
|
| Line 264... |
Line 185... |
| 264 |
|
185 |
|
| 265 |
ChampMultiValeurs codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
|
186 |
ChampMultiValeurs codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
|
| Line 271... |
Line 192... |
| 271 |
private void creerFieldsetDescription() {
|
192 |
private void creerFieldsetDescription() {
|
| 272 |
// Fieldset DESCRIPTION
|
193 |
// Fieldset DESCRIPTION
|
| 273 |
descriptionFieldSet = new FieldSet();
|
194 |
descriptionFieldSet = new FieldSet();
|
| 274 |
descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
|
195 |
descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
|
| 275 |
descriptionFieldSet.setCollapsible(true);
|
196 |
descriptionFieldSet.setCollapsible(true);
|
| 276 |
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(150, LabelAlign.LEFT));
|
197 |
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
| Line 277... |
Line 198... |
| 277 |
|
198 |
|
| 278 |
TextArea descriptionChp = new TextArea();
|
199 |
TextArea descriptionChp = new TextArea();
|
| 279 |
descriptionChp.setFieldLabel(i18nC.description());
|
200 |
descriptionChp.setFieldLabel(i18nC.description());
|
| Line 291... |
Line 212... |
| 291 |
descriptionFieldSet.add(urlsChp);
|
212 |
descriptionFieldSet.add(urlsChp);
|
| Line 292... |
Line 213... |
| 292 |
|
213 |
|
| 293 |
this.add(descriptionFieldSet);
|
214 |
this.add(descriptionFieldSet);
|
| Line -... |
Line 215... |
| - |
|
215 |
}
|
| - |
|
216 |
|
| - |
|
217 |
private void creerFieldsetCouverture() {
|
| - |
|
218 |
FieldSet couvertureFieldSet = new FieldSet();
|
| - |
|
219 |
couvertureFieldSet.setHeading("Couvertures");
|
| - |
|
220 |
couvertureFieldSet.setCollapsible(true);
|
| - |
|
221 |
couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
| - |
|
222 |
|
| - |
|
223 |
lieuCouvertureChp = new TextArea();
|
| - |
|
224 |
lieuCouvertureChp.setFieldLabel(i18nC.lieuCouvertureCollection());
|
| - |
|
225 |
couvertureFieldSet.add(lieuCouvertureChp, new FormData(550, 0));
|
| - |
|
226 |
|
| - |
|
227 |
this.add(couvertureFieldSet);
|
| 294 |
}
|
228 |
}
|
| 295 |
|
- |
|
| 296 |
public void rafraichir(Object nouvellesDonnees) {
|
- |
|
| 297 |
if (nouvellesDonnees instanceof ValeurListe) {
|
- |
|
| 298 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
229 |
|
| 299 |
rafraichirValeurListe(listeValeurs);
|
230 |
public void rafraichir(Object nouvellesDonnees) {
|
| 300 |
} else if (nouvellesDonnees instanceof ProjetListe) {
|
231 |
if (nouvellesDonnees instanceof ProjetListe) {
|
| 301 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
232 |
ProjetListe projets = (ProjetListe) nouvellesDonnees;
|
| 302 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
233 |
Formulaire.rafraichirComboBox(projets, projetsCombo);
|
| 303 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
234 |
} else if (nouvellesDonnees instanceof StructureListe) {
|
| 304 |
StructureListe structures = (StructureListe) nouvellesDonnees;
|
235 |
StructureListe structures = (StructureListe) nouvellesDonnees;
|
| 305 |
Formulaire.rafraichirComboBox(structures, structuresCombo);
|
236 |
Formulaire.rafraichirComboBox(structures, structuresCombo);
|
| 306 |
} else if (nouvellesDonnees instanceof CollectionListe) {
|
237 |
} else if (nouvellesDonnees instanceof CollectionListe) {
|
| - |
|
238 |
CollectionListe collections = (CollectionListe) nouvellesDonnees;
|
| - |
|
239 |
Formulaire.rafraichirComboBox(collections, collectionsCombo);
|
| - |
|
240 |
} else if (nouvellesDonnees instanceof ValeurListe) {
|
| 307 |
CollectionListe collections = (CollectionListe) nouvellesDonnees;
|
241 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
| 308 |
Formulaire.rafraichirComboBox(collections, collectionsCombo);
|
242 |
rafraichirValeurListe(listeValeurs);
|
| 309 |
} else {
|
243 |
} else {
|
| 310 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
244 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
| Line 311... |
Line 245... |
| 311 |
}
|
245 |
}
|
| 312 |
}
|
- |
|
| 313 |
|
- |
|
| 314 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
- |
|
| 315 |
if (listeValeurs.getId().equals(config.getListeId("typeCollectionNcd"))) {
|
- |
|
| 316 |
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionCombo);
|
246 |
}
|
| 317 |
} else if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
|
247 |
|
| 318 |
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
|
248 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
| 319 |
} else if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
|
249 |
if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
|
| 320 |
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
|
250 |
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
|
| 321 |
} else {
|
251 |
} else {
|