1 |
package org.tela_botanica.client.vues.collection;
|
1 |
package org.tela_botanica.client.vues.collection;
|
2 |
|
2 |
|
3 |
import java.util.ArrayList;
|
3 |
import java.util.ArrayList;
|
4 |
|
4 |
|
5 |
import org.tela_botanica.client.ComposantClass;
|
5 |
import org.tela_botanica.client.ComposantClass;
|
6 |
import org.tela_botanica.client.Mediateur;
|
6 |
import org.tela_botanica.client.Mediateur;
|
7 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
7 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
9 |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
|
10 |
import org.tela_botanica.client.composants.ChampMultiValeurs;
|
10 |
import org.tela_botanica.client.composants.ChampMultiValeurs;
|
11 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
11 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
12 |
import org.tela_botanica.client.composants.pagination.ProxyCollections;
|
12 |
import org.tela_botanica.client.composants.pagination.ProxyCollections;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
13 |
import org.tela_botanica.client.composants.pagination.ProxyStructures;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
16 |
import org.tela_botanica.client.modeles.collection.Collection;
|
16 |
import org.tela_botanica.client.modeles.collection.Collection;
|
17 |
import org.tela_botanica.client.modeles.structure.Structure;
|
17 |
import org.tela_botanica.client.modeles.structure.Structure;
|
18 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
18 |
import org.tela_botanica.client.synchronisation.Sequenceur;
|
19 |
import org.tela_botanica.client.util.Debug;
|
19 |
import org.tela_botanica.client.util.Debug;
|
20 |
import org.tela_botanica.client.util.UtilString;
|
20 |
import org.tela_botanica.client.util.UtilString;
|
21 |
import org.tela_botanica.client.vues.Formulaire;
|
21 |
import org.tela_botanica.client.vues.Formulaire;
|
22 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
22 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
23 |
|
23 |
|
24 |
import com.extjs.gxt.ui.client.data.ModelData;
|
24 |
import com.extjs.gxt.ui.client.data.ModelData;
|
25 |
import com.extjs.gxt.ui.client.data.ModelType;
|
25 |
import com.extjs.gxt.ui.client.data.ModelType;
|
26 |
import com.extjs.gxt.ui.client.event.Events;
|
26 |
import com.extjs.gxt.ui.client.event.Events;
|
27 |
import com.extjs.gxt.ui.client.util.Margins;
|
27 |
import com.extjs.gxt.ui.client.util.Margins;
|
28 |
import com.extjs.gxt.ui.client.widget.Text;
|
28 |
import com.extjs.gxt.ui.client.widget.Text;
|
29 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
29 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
30 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
30 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
31 |
import com.extjs.gxt.ui.client.widget.form.HiddenField;
|
31 |
import com.extjs.gxt.ui.client.widget.form.HiddenField;
|
32 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
32 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
33 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
33 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
34 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
34 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
35 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
35 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
36 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
36 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
37 |
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
|
37 |
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
|
38 |
import com.google.gwt.i18n.client.NumberFormat;
|
38 |
import com.google.gwt.i18n.client.NumberFormat;
|
39 |
|
39 |
|
40 |
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
|
40 |
public class CollectionFormGeneral extends FormulaireOnglet implements Rafraichissable {
|
41 |
|
41 |
|
42 |
public static final String ID = "general";
|
42 |
public static final String ID = "general";
|
43 |
private Collection collection = null;
|
43 |
private Collection collection = null;
|
44 |
private Collection collectionCollectee = null;
|
44 |
private Collection collectionCollectee = null;
|
45 |
|
45 |
|
46 |
private HiddenField<String> idCollectionChp = null;
|
46 |
private HiddenField<String> idCollectionChp = null;
|
47 |
|
47 |
|
48 |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
|
48 |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
|
49 |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
|
49 |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
|
50 |
|
50 |
|
51 |
private ChampCaseACocher periodeConstitutionChp = null;
|
51 |
private ChampCaseACocher periodeConstitutionChp = null;
|
52 |
private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
|
- |
|
53 |
private ChampMultiValeurs lieuCouvertureChp = null;
|
52 |
private ChampMultiValeurs lieuCouvertureChp = null;
|
54 |
|
53 |
|
55 |
private ChampComboBoxListeValeurs specimenTypeCombo = null;
|
54 |
private ChampComboBoxListeValeurs specimenTypeCombo = null;
|
56 |
private ChampComboBoxListeValeurs precisionTypeNbreCombo = null;
|
55 |
private ChampComboBoxListeValeurs precisionTypeNbreCombo = null;
|
57 |
private NumberField nbreTypeChp = null;
|
56 |
private NumberField nbreTypeChp = null;
|
58 |
private ChampComboBoxListeValeurs classementSpecimenTypeCombo = null;
|
57 |
private ChampComboBoxListeValeurs classementSpecimenTypeCombo = null;
|
59 |
|
58 |
|
60 |
private ChampComboBoxListeValeurs typeDepotCombo = null;
|
59 |
private ChampComboBoxListeValeurs typeDepotCombo = null;
|
61 |
private TextField<String> coteChp = null;
|
60 |
private TextField<String> coteChp = null;
|
62 |
private ChampMultiValeurs idAlternatifsChp = null;
|
- |
|
63 |
private ChampMultiValeurs nomsAlternatifsChp = null;
|
61 |
private ChampMultiValeurs nomsAlternatifsChp = null;
|
64 |
private ChampMultiValeurs codesAlternatifsChp = null;
|
62 |
private ChampMultiValeurs codesAlternatifsChp = null;
|
65 |
|
- |
|
66 |
private TextArea descriptionSpecialisteChp = null;
|
63 |
|
67 |
private TextArea descriptionChp = null;
|
64 |
private TextArea descriptionChp = null;
|
68 |
private TextArea historiqueChp = null;
|
65 |
private TextArea historiqueChp = null;
|
69 |
private ChampMultiValeurs urlsChp = null;
|
66 |
private ChampMultiValeurs urlsChp = null;
|
70 |
|
- |
|
71 |
private ChampComboBoxListeValeurs butRealisationCombo = null;
|
- |
|
72 |
|
67 |
|
73 |
private Sequenceur sequenceur = new Sequenceur();
|
68 |
private Sequenceur sequenceur = new Sequenceur();
|
74 |
|
69 |
|
75 |
public CollectionFormGeneral(Formulaire formulaireCourrant) {
|
70 |
public CollectionFormGeneral(Formulaire formulaireCourrant) {
|
76 |
initialiserOnglet(formulaireCourrant);
|
71 |
initialiserOnglet(formulaireCourrant);
|
77 |
setId(ID);
|
72 |
setId(ID);
|
78 |
setText(Mediateur.i18nC.collectionGeneral());
|
73 |
setText(Mediateur.i18nC.collectionGeneral());
|
79 |
|
74 |
|
80 |
creerChampsCache();
|
75 |
creerChampsCache();
|
81 |
creerFieldsetLiaison();
|
76 |
creerFieldsetLiaison();
|
82 |
creerFieldsetAdministratif();
|
77 |
creerFieldsetAdministratif();
|
83 |
creerFieldsetDescription();
|
78 |
creerFieldsetDescription();
|
84 |
creerFieldsetCouverture();
|
79 |
creerFieldsetCouverture();
|
85 |
creerFieldsetType();
|
80 |
creerFieldsetType();
|
86 |
}
|
81 |
}
|
87 |
|
82 |
|
88 |
private void initialiserCollection() {
|
83 |
private void initialiserCollection() {
|
89 |
collection = ((CollectionForm) formulaire).collection;
|
84 |
collection = ((CollectionForm) formulaire).collection;
|
90 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
85 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
91 |
}
|
86 |
}
|
92 |
|
87 |
|
93 |
private void creerChampsCache() {
|
88 |
private void creerChampsCache() {
|
94 |
// Champs cachés
|
89 |
// Champs cachés
|
95 |
idCollectionChp = new HiddenField<String>();
|
90 |
idCollectionChp = new HiddenField<String>();
|
96 |
this.add(idCollectionChp);
|
91 |
this.add(idCollectionChp);
|
97 |
}
|
92 |
}
|
98 |
|
93 |
|
99 |
private void creerFieldsetLiaison() {
|
94 |
private void creerFieldsetLiaison() {
|
100 |
|
95 |
|
101 |
FieldSet liaisonFieldSet = new FieldSet();
|
96 |
FieldSet liaisonFieldSet = new FieldSet();
|
102 |
liaisonFieldSet.setHeadingHtml(i18nC.liaisonTitreCollection());
|
97 |
liaisonFieldSet.setHeadingHtml(i18nC.liaisonTitreCollection());
|
103 |
liaisonFieldSet.setCollapsible(true);
|
98 |
liaisonFieldSet.setCollapsible(true);
|
104 |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
99 |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
105 |
|
100 |
|
106 |
|
101 |
|
107 |
//+-----------------------------------------------------------------------------------------------------------+
|
102 |
//+-----------------------------------------------------------------------------------------------------------+
|
108 |
// Champ Structures
|
103 |
// Champ Structures
|
109 |
|
104 |
|
110 |
ModelType modelTypeStructures = new ModelType();
|
105 |
ModelType modelTypeStructures = new ModelType();
|
111 |
modelTypeStructures.setRoot("structures");
|
106 |
modelTypeStructures.setRoot("structures");
|
112 |
modelTypeStructures.setTotalName("nbElements");
|
107 |
modelTypeStructures.setTotalName("nbElements");
|
113 |
modelTypeStructures.addField("cs_nom");
|
108 |
modelTypeStructures.addField("cs_nom");
|
114 |
modelTypeStructures.addField("cs_id_structure");
|
109 |
modelTypeStructures.addField("cs_id_structure");
|
115 |
|
110 |
|
116 |
String displayNameStructures = "cs_nom";
|
111 |
String displayNameStructures = "cs_nom";
|
117 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
|
112 |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
|
118 |
|
113 |
|
119 |
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
114 |
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
|
120 |
structuresCombo.setWidth(250, 600);
|
115 |
structuresCombo.setWidth(250, 600);
|
121 |
structuresCombo.getCombo().setTabIndex(tabIndex++);
|
116 |
structuresCombo.getCombo().setTabIndex(tabIndex++);
|
122 |
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
|
117 |
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
|
123 |
structuresCombo.getCombo().setForceSelection(true);
|
118 |
structuresCombo.getCombo().setForceSelection(true);
|
124 |
|
119 |
|
125 |
structuresCombo.getCombo().setValidator(new Validator() {
|
120 |
structuresCombo.getCombo().setValidator(new Validator() {
|
126 |
public String validate(Field<?> field, String value) {
|
121 |
public String validate(Field<?> field, String value) {
|
127 |
String retour = null;
|
122 |
String retour = null;
|
128 |
if (field.getRawValue().equals("")) {
|
123 |
if (field.getRawValue().equals("")) {
|
129 |
field.setValue(null);
|
124 |
field.setValue(null);
|
130 |
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
|
125 |
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
|
131 |
String contenuBrut = field.getRawValue();
|
126 |
String contenuBrut = field.getRawValue();
|
132 |
field.setValue(null);
|
127 |
field.setValue(null);
|
133 |
field.setRawValue(contenuBrut);
|
128 |
field.setRawValue(contenuBrut);
|
134 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
129 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
135 |
}
|
130 |
}
|
136 |
return retour;
|
131 |
return retour;
|
137 |
}
|
132 |
}
|
138 |
});
|
133 |
});
|
139 |
|
134 |
|
140 |
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
|
135 |
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
|
141 |
|
136 |
|
142 |
|
137 |
|
143 |
//+-----------------------------------------------------------------------------------------------------------+
|
138 |
//+-----------------------------------------------------------------------------------------------------------+
|
144 |
// Champ Collections
|
139 |
// Champ Collections
|
145 |
|
140 |
|
146 |
ModelType modelTypeCollections = new ModelType();
|
141 |
ModelType modelTypeCollections = new ModelType();
|
147 |
modelTypeCollections.setRoot("collections");
|
142 |
modelTypeCollections.setRoot("collections");
|
148 |
modelTypeCollections.setTotalName("nbElements");
|
143 |
modelTypeCollections.setTotalName("nbElements");
|
149 |
modelTypeCollections.addField("cc_nom");
|
144 |
modelTypeCollections.addField("cc_nom");
|
150 |
modelTypeCollections.addField("cc_id_collection");
|
145 |
modelTypeCollections.addField("cc_id_collection");
|
151 |
modelTypeCollections.addField("cc_ce_mere");
|
146 |
modelTypeCollections.addField("cc_ce_mere");
|
152 |
|
147 |
|
153 |
String displayNameCollections = "cc_nom";
|
148 |
String displayNameCollections = "cc_nom";
|
154 |
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(null);
|
149 |
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(null);
|
155 |
|
150 |
|
156 |
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
|
151 |
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
|
157 |
collectionsCombo.setWidth(250, 600);
|
152 |
collectionsCombo.setWidth(250, 600);
|
158 |
collectionsCombo.getCombo().setTabIndex(tabIndex++);
|
153 |
collectionsCombo.getCombo().setTabIndex(tabIndex++);
|
159 |
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
|
154 |
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
|
160 |
collectionsCombo.getCombo().setForceSelection(true);
|
155 |
collectionsCombo.getCombo().setForceSelection(true);
|
161 |
|
156 |
|
162 |
collectionsCombo.getCombo().setValidator(new Validator() {
|
157 |
collectionsCombo.getCombo().setValidator(new Validator() {
|
163 |
public String validate(Field<?> field, String value) {
|
158 |
public String validate(Field<?> field, String value) {
|
164 |
String retour = null;
|
159 |
String retour = null;
|
165 |
if (field.getRawValue().equals("")) {
|
160 |
if (field.getRawValue().equals("")) {
|
166 |
field.setValue(null);
|
161 |
field.setValue(null);
|
167 |
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
|
162 |
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
|
168 |
String contenuBrut = field.getRawValue();
|
163 |
String contenuBrut = field.getRawValue();
|
169 |
field.setValue(null);
|
164 |
field.setValue(null);
|
170 |
field.setRawValue(contenuBrut);
|
165 |
field.setRawValue(contenuBrut);
|
171 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
166 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
172 |
}
|
167 |
}
|
173 |
return retour;
|
168 |
return retour;
|
174 |
}
|
169 |
}
|
175 |
});
|
170 |
});
|
176 |
|
171 |
|
177 |
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
|
172 |
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
|
178 |
|
173 |
|
179 |
this.add(liaisonFieldSet);
|
174 |
this.add(liaisonFieldSet);
|
180 |
}
|
175 |
}
|
181 |
|
176 |
|
182 |
private void creerFieldsetAdministratif() {
|
177 |
private void creerFieldsetAdministratif() {
|
183 |
// Fieldset ADMINISTRATIF
|
178 |
// Fieldset ADMINISTRATIF
|
184 |
FieldSet administratifFieldSet = new FieldSet();
|
179 |
FieldSet administratifFieldSet = new FieldSet();
|
185 |
administratifFieldSet.setHeadingHtml(i18nC.collectionGeneralTitre());
|
180 |
administratifFieldSet.setHeadingHtml(i18nC.collectionGeneralTitre());
|
186 |
administratifFieldSet.setCollapsible(true);
|
181 |
administratifFieldSet.setCollapsible(true);
|
187 |
administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
182 |
administratifFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
188 |
|
183 |
|
189 |
typeDepotCombo = new ChampComboBoxListeValeurs(i18nC.typeDepot(), "typeDepot", tabIndex++);
|
184 |
typeDepotCombo = new ChampComboBoxListeValeurs(i18nC.typeDepot(), "typeDepot", tabIndex++);
|
190 |
administratifFieldSet.add(typeDepotCombo);
|
185 |
administratifFieldSet.add(typeDepotCombo);
|
191 |
|
186 |
|
192 |
coteChp = new TextField<String>();
|
187 |
coteChp = new TextField<String>();
|
193 |
coteChp.setTabIndex(tabIndex++);
|
188 |
coteChp.setTabIndex(tabIndex++);
|
194 |
coteChp.setFieldLabel(i18nC.cote());
|
189 |
coteChp.setFieldLabel(i18nC.cote());
|
195 |
administratifFieldSet.add(coteChp, new FormData(450, 0));
|
190 |
administratifFieldSet.add(coteChp, new FormData(450, 0));
|
196 |
|
- |
|
197 |
idAlternatifsChp = new ChampMultiValeurs(i18nC.idAlternatifCollection());
|
- |
|
198 |
administratifFieldSet.add(idAlternatifsChp);
|
- |
|
199 |
|
191 |
|
200 |
nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
|
192 |
nomsAlternatifsChp = new ChampMultiValeurs(i18nC.intituleAlternatifCollection());
|
201 |
administratifFieldSet.add(nomsAlternatifsChp);
|
193 |
administratifFieldSet.add(nomsAlternatifsChp);
|
202 |
|
194 |
|
203 |
codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
|
195 |
codesAlternatifsChp = new ChampMultiValeurs(i18nC.codeAlternatifCollection());
|
204 |
administratifFieldSet.add(codesAlternatifsChp);
|
196 |
administratifFieldSet.add(codesAlternatifsChp);
|
205 |
|
197 |
|
206 |
this.add(administratifFieldSet);
|
198 |
this.add(administratifFieldSet);
|
207 |
}
|
199 |
}
|
208 |
|
200 |
|
209 |
private void creerFieldsetDescription() {
|
201 |
private void creerFieldsetDescription() {
|
210 |
// Fieldset DESCRIPTION
|
202 |
// Fieldset DESCRIPTION
|
211 |
FieldSet descriptionFieldSet = new FieldSet();
|
203 |
FieldSet descriptionFieldSet = new FieldSet();
|
212 |
descriptionFieldSet.setHeadingHtml(i18nC.collectionDescriptionTitre());
|
204 |
descriptionFieldSet.setHeadingHtml(i18nC.collectionDescriptionTitre());
|
213 |
descriptionFieldSet.setCollapsible(true);
|
205 |
descriptionFieldSet.setCollapsible(true);
|
214 |
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
206 |
descriptionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
215 |
|
207 |
|
216 |
descriptionChp = new TextArea();
|
208 |
descriptionChp = new TextArea();
|
217 |
descriptionChp.setFieldLabel(i18nC.description());
|
209 |
descriptionChp.setFieldLabel(i18nC.description());
|
218 |
descriptionFieldSet.add(descriptionChp, new FormData(550, 0));
|
210 |
descriptionFieldSet.add(descriptionChp, new FormData(550, 0));
|
219 |
|
- |
|
220 |
descriptionSpecialisteChp = new TextArea();
|
- |
|
221 |
descriptionSpecialisteChp.setFieldLabel(i18nC.descriptionSpecialiste());
|
- |
|
222 |
descriptionFieldSet.add(descriptionSpecialisteChp, new FormData(550, 0));
|
- |
|
223 |
|
211 |
|
224 |
historiqueChp = new TextArea();
|
212 |
historiqueChp = new TextArea();
|
225 |
historiqueChp.setFieldLabel(i18nC.historique());
|
213 |
historiqueChp.setFieldLabel(i18nC.historique());
|
226 |
descriptionFieldSet.add(historiqueChp, new FormData(550, 0));
|
214 |
descriptionFieldSet.add(historiqueChp, new FormData(550, 0));
|
227 |
|
215 |
|
228 |
urlsChp = new ChampMultiValeurs(i18nC.urlsCollection());
|
216 |
urlsChp = new ChampMultiValeurs(i18nC.urlsCollection());
|
229 |
descriptionFieldSet.add(urlsChp);
|
217 |
descriptionFieldSet.add(urlsChp);
|
230 |
|
218 |
|
231 |
this.add(descriptionFieldSet);
|
219 |
this.add(descriptionFieldSet);
|
232 |
}
|
220 |
}
|
233 |
|
221 |
|
234 |
private void creerFieldsetCouverture() {
|
222 |
private void creerFieldsetCouverture() {
|
235 |
FieldSet couvertureFieldSet = new FieldSet();
|
223 |
FieldSet couvertureFieldSet = new FieldSet();
|
236 |
couvertureFieldSet.setHeadingHtml("Couvertures");
|
224 |
couvertureFieldSet.setHeadingHtml("Couvertures");
|
237 |
couvertureFieldSet.setCollapsible(true);
|
225 |
couvertureFieldSet.setCollapsible(true);
|
238 |
couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
226 |
couvertureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
239 |
|
227 |
|
240 |
periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
|
228 |
periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
|
241 |
couvertureFieldSet.add(periodeConstitutionChp);
|
229 |
couvertureFieldSet.add(periodeConstitutionChp);
|
242 |
|
- |
|
243 |
groupementPrincipeCombo = new ChampComboBoxListeValeurs(i18nC.groupementPrincipeCollection(), "groupementPrincipe", tabIndex++);
|
- |
|
244 |
groupementPrincipeCombo.setToolTip(i18nC.groupementPrincipeCollectionInfo());
|
- |
|
245 |
couvertureFieldSet.add(groupementPrincipeCombo);
|
- |
|
246 |
|
- |
|
247 |
butRealisationCombo = new ChampComboBoxListeValeurs(i18nC.butCollection(), "realisationBut", tabIndex++);
|
- |
|
248 |
couvertureFieldSet.add(butRealisationCombo);
|
- |
|
249 |
|
230 |
|
250 |
lieuCouvertureChp = new ChampMultiValeurs(i18nC.lieuCouvertureCollection());
|
231 |
lieuCouvertureChp = new ChampMultiValeurs(i18nC.lieuCouvertureCollection());
|
251 |
couvertureFieldSet.add(lieuCouvertureChp);
|
232 |
couvertureFieldSet.add(lieuCouvertureChp);
|
252 |
|
233 |
|
253 |
this.add(couvertureFieldSet);
|
234 |
this.add(couvertureFieldSet);
|
254 |
}
|
235 |
}
|
255 |
|
236 |
|
256 |
private void creerFieldsetType() {
|
237 |
private void creerFieldsetType() {
|
257 |
FieldSet typeFieldSet = new FieldSet();
|
238 |
FieldSet typeFieldSet = new FieldSet();
|
258 |
typeFieldSet.setHeadingHtml("Spécimens «types»");
|
239 |
typeFieldSet.setHeadingHtml("Spécimens «types»");
|
259 |
typeFieldSet.setCollapsible(true);
|
240 |
typeFieldSet.setCollapsible(true);
|
260 |
typeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
241 |
typeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
261 |
|
242 |
|
262 |
specimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.specimenTypeCollection(), "onpi", tabIndex++);
|
243 |
specimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.specimenTypeCollection(), "onpi", tabIndex++);
|
263 |
typeFieldSet.add(specimenTypeCombo);
|
244 |
typeFieldSet.add(specimenTypeCombo);
|
264 |
|
245 |
|
265 |
ConteneurMultiChamps nbreTypeConteneur = new ConteneurMultiChamps(i18nC.nbreSpecimenTypeCollection());
|
246 |
ConteneurMultiChamps nbreTypeConteneur = new ConteneurMultiChamps(i18nC.nbreSpecimenTypeCollection());
|
266 |
|
247 |
|
267 |
nbreTypeChp = new NumberField();
|
248 |
nbreTypeChp = new NumberField();
|
268 |
nbreTypeChp.setFormat(NumberFormat.getFormat("#"));
|
249 |
nbreTypeChp.setFormat(NumberFormat.getFormat("#"));
|
269 |
nbreTypeConteneur.ajouterChamp(nbreTypeChp, new HBoxLayoutData(new Margins(0, 20, 0, 0)));
|
250 |
nbreTypeConteneur.ajouterChamp(nbreTypeChp, new HBoxLayoutData(new Margins(0, 20, 0, 0)));
|
270 |
|
251 |
|
271 |
precisionTypeNbreCombo = new ChampComboBoxListeValeurs(null, "ea");
|
252 |
precisionTypeNbreCombo = new ChampComboBoxListeValeurs(null, "ea");
|
272 |
precisionTypeNbreCombo.setTrie("id_valeur");
|
253 |
precisionTypeNbreCombo.setTrie("id_valeur");
|
273 |
precisionTypeNbreCombo.setEmptyText(i18nC.precisionNbreSpecimenTypeCollectionChpVide());
|
254 |
precisionTypeNbreCombo.setEmptyText(i18nC.precisionNbreSpecimenTypeCollectionChpVide());
|
274 |
nbreTypeConteneur.ajouterChamp(precisionTypeNbreCombo);
|
255 |
nbreTypeConteneur.ajouterChamp(precisionTypeNbreCombo);
|
275 |
|
256 |
|
276 |
typeFieldSet.add(nbreTypeConteneur);
|
257 |
typeFieldSet.add(nbreTypeConteneur);
|
277 |
|
258 |
|
278 |
classementSpecimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.classementSpecimenTypeCollection(), "typeClassement", tabIndex++);
|
259 |
classementSpecimenTypeCombo = new ChampComboBoxListeValeurs(i18nC.classementSpecimenTypeCollection(), "typeClassement", tabIndex++);
|
279 |
typeFieldSet.add(classementSpecimenTypeCombo);
|
260 |
typeFieldSet.add(classementSpecimenTypeCombo);
|
280 |
|
261 |
|
281 |
Text infoType = new Text(i18nC.specimenTypeCollectionInfo());
|
262 |
Text infoType = new Text(i18nC.specimenTypeCollectionInfo());
|
282 |
typeFieldSet.add(infoType);
|
263 |
typeFieldSet.add(infoType);
|
283 |
|
264 |
|
284 |
this.add(typeFieldSet);
|
265 |
this.add(typeFieldSet);
|
285 |
}
|
266 |
}
|
286 |
|
267 |
|
287 |
public void peupler() {
|
268 |
public void peupler() {
|
288 |
initialiserCollection();
|
269 |
initialiserCollection();
|
289 |
if (collection != null) {
|
270 |
if (collection != null) {
|
290 |
idCollectionChp.setValue(collection.getId());
|
271 |
idCollectionChp.setValue(collection.getId());
|
291 |
setValeurComboStructures();
|
272 |
setValeurComboStructures();
|
292 |
setValeurComboCollections();
|
273 |
setValeurComboCollections();
|
293 |
|
274 |
|
294 |
typeDepotCombo.peupler(collection.getTypeDepot());
|
275 |
typeDepotCombo.peupler(collection.getTypeDepot());
|
295 |
coteChp.setValue(collection.getCote());
|
276 |
coteChp.setValue(collection.getCote());
|
296 |
idAlternatifsChp.peupler(collection.getIdAlternatif());
|
- |
|
297 |
nomsAlternatifsChp.peupler(collection.getNomAlternatif());
|
277 |
nomsAlternatifsChp.peupler(collection.getNomAlternatif());
|
298 |
codesAlternatifsChp.peupler(collection.getCode());
|
278 |
codesAlternatifsChp.peupler(collection.getCode());
|
299 |
|
279 |
|
300 |
descriptionChp.setValue(collection.getDescription());
|
280 |
descriptionChp.setValue(collection.getDescription());
|
301 |
descriptionSpecialisteChp.setValue(collection.getDescriptionSpecialiste());
|
- |
|
302 |
historiqueChp.setValue(collection.getHistorique());
|
281 |
historiqueChp.setValue(collection.getHistorique());
|
303 |
urlsChp.peupler(collection.getUrls());
|
282 |
urlsChp.peupler(collection.getUrls());
|
304 |
|
283 |
|
305 |
periodeConstitutionChp.peupler(collection.getPeriodeConstitution());
|
284 |
periodeConstitutionChp.peupler(collection.getPeriodeConstitution());
|
306 |
groupementPrincipeCombo.peupler(collection.getGroupementPrincipe());
|
- |
|
307 |
butRealisationCombo.peupler(collection.getGroupementBut());
|
- |
|
308 |
lieuCouvertureChp.peupler(collection.getCouvertureLieu());
|
285 |
lieuCouvertureChp.peupler(collection.getCouvertureLieu());
|
309 |
|
286 |
|
310 |
specimenTypeCombo.peupler(collection.getSpecimenType());
|
287 |
specimenTypeCombo.peupler(collection.getSpecimenType());
|
311 |
nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
|
288 |
nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
|
312 |
precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
|
289 |
precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
|
313 |
classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
|
290 |
classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
|
314 |
}
|
291 |
}
|
315 |
}
|
292 |
}
|
316 |
|
293 |
|
317 |
public ArrayList<String> verifier() {
|
294 |
public ArrayList<String> verifier() {
|
318 |
ArrayList<String> messages = new ArrayList<String>();
|
295 |
ArrayList<String> messages = new ArrayList<String>();
|
319 |
return messages;
|
296 |
return messages;
|
320 |
}
|
297 |
}
|
321 |
|
298 |
|
322 |
public void collecter() {
|
299 |
public void collecter() {
|
323 |
initialiserCollection();
|
300 |
initialiserCollection();
|
324 |
// l'onglet collection est obligatoirement rempli lors d'un ajout
|
301 |
// l'onglet collection est obligatoirement rempli lors d'un ajout
|
325 |
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
|
302 |
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
|
326 |
collectionCollectee.setId(idCollectionChp.getValue());
|
303 |
collectionCollectee.setId(idCollectionChp.getValue());
|
327 |
collectionCollectee.setIdStructure(getValeurComboStructures());
|
304 |
collectionCollectee.setIdStructure(getValeurComboStructures());
|
328 |
collectionCollectee.setCollectionMereId(getValeurComboCollections());
|
305 |
collectionCollectee.setCollectionMereId(getValeurComboCollections());
|
329 |
|
306 |
|
330 |
collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
|
307 |
collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
|
331 |
collectionCollectee.setCote(coteChp.getValue());
|
308 |
collectionCollectee.setCote(coteChp.getValue());
|
332 |
collectionCollectee.setIdAlternatif(idAlternatifsChp.getValeurs());
|
- |
|
333 |
collectionCollectee.setNomAlternatif(nomsAlternatifsChp.getValeurs());
|
309 |
collectionCollectee.setNomAlternatif(nomsAlternatifsChp.getValeurs());
|
334 |
collectionCollectee.setCode(codesAlternatifsChp.getValeurs());
|
310 |
collectionCollectee.setCode(codesAlternatifsChp.getValeurs());
|
335 |
|
311 |
|
336 |
collectionCollectee.setDescription(descriptionChp.getValue());
|
312 |
collectionCollectee.setDescription(descriptionChp.getValue());
|
337 |
collectionCollectee.setDescriptionSpecialiste(descriptionSpecialisteChp.getValue());
|
- |
|
338 |
collectionCollectee.setHistorique(historiqueChp.getValue());
|
313 |
collectionCollectee.setHistorique(historiqueChp.getValue());
|
339 |
collectionCollectee.setUrls(urlsChp.getValeurs());
|
314 |
collectionCollectee.setUrls(urlsChp.getValeurs());
|
340 |
|
315 |
|
341 |
collectionCollectee.setPeriodeConstitution(periodeConstitutionChp.getValeur());
|
316 |
collectionCollectee.setPeriodeConstitution(periodeConstitutionChp.getValeur());
|
342 |
collectionCollectee.setGroupementPrincipe(groupementPrincipeCombo.getValeur());
|
- |
|
343 |
collectionCollectee.setGroupementBut(butRealisationCombo.getValeur());
|
- |
|
344 |
collectionCollectee.setCouvertureLieu(lieuCouvertureChp.getValeurs());
|
317 |
collectionCollectee.setCouvertureLieu(lieuCouvertureChp.getValeurs());
|
345 |
|
318 |
|
346 |
collectionCollectee.setSpecimenType(specimenTypeCombo.getValeur());
|
319 |
collectionCollectee.setSpecimenType(specimenTypeCombo.getValeur());
|
347 |
if (nbreTypeChp.getValue() != null) {
|
320 |
if (nbreTypeChp.getValue() != null) {
|
348 |
collectionCollectee.setSpecimenTypeNbre(nbreTypeChp.getValue().toString());
|
321 |
collectionCollectee.setSpecimenTypeNbre(nbreTypeChp.getValue().toString());
|
349 |
}
|
322 |
}
|
350 |
collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
|
323 |
collectionCollectee.setSpecimenTypeNbrePrecision(precisionTypeNbreCombo.getValeur());
|
351 |
collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
|
324 |
collectionCollectee.setSpecimenTypeClassement(classementSpecimenTypeCombo.getValeur());
|
352 |
}
|
325 |
}
|
353 |
}
|
326 |
}
|
354 |
|
327 |
|
355 |
private String getValeurComboStructures() {
|
328 |
private String getValeurComboStructures() {
|
356 |
String valeur = "";
|
329 |
String valeur = "";
|
357 |
if (structuresCombo.getCombo().getValue() != null) {
|
330 |
if (structuresCombo.getCombo().getValue() != null) {
|
358 |
Structure structure = new Structure(structuresCombo.getValeur());
|
331 |
Structure structure = new Structure(structuresCombo.getValeur());
|
359 |
valeur = structure.getId();
|
332 |
valeur = structure.getId();
|
360 |
}
|
333 |
}
|
361 |
return valeur;
|
334 |
return valeur;
|
362 |
}
|
335 |
}
|
363 |
private void setValeurComboStructures() {
|
336 |
private void setValeurComboStructures() {
|
364 |
if (structuresCombo.getCombo().getStore() != null
|
337 |
if (structuresCombo.getCombo().getStore() != null
|
365 |
&& collection != null
|
338 |
&& collection != null
|
366 |
&& collection.getStructureNom() != null
|
339 |
&& collection.getStructureNom() != null
|
367 |
&& !UtilString.isEmpty(collection.getStructureNom())) {
|
340 |
&& !UtilString.isEmpty(collection.getStructureNom())) {
|
368 |
structuresCombo.chargerValeurInitiale(collection.getStructureNom(), "cs_nom");
|
341 |
structuresCombo.chargerValeurInitiale(collection.getStructureNom(), "cs_nom");
|
369 |
} else {
|
342 |
} else {
|
370 |
structuresCombo.getCombo().setValue(null);
|
343 |
structuresCombo.getCombo().setValue(null);
|
371 |
}
|
344 |
}
|
372 |
}
|
345 |
}
|
373 |
|
346 |
|
374 |
private String getValeurComboCollections() {
|
347 |
private String getValeurComboCollections() {
|
375 |
String valeur = "";
|
348 |
String valeur = "";
|
376 |
if (collectionsCombo.getCombo().getValue() != null) {
|
349 |
if (collectionsCombo.getCombo().getValue() != null) {
|
377 |
Collection collection = new Collection(collectionsCombo.getValeur());
|
350 |
Collection collection = new Collection(collectionsCombo.getValeur());
|
378 |
valeur = collection.getId();
|
351 |
valeur = collection.getId();
|
379 |
}
|
352 |
}
|
380 |
return valeur;
|
353 |
return valeur;
|
381 |
}
|
354 |
}
|
382 |
private void setValeurComboCollections() {
|
355 |
private void setValeurComboCollections() {
|
383 |
if (collectionsCombo.getCombo().getStore() != null
|
356 |
if (collectionsCombo.getCombo().getStore() != null
|
384 |
&& collection != null
|
357 |
&& collection != null
|
385 |
&& collection.getCollectionMereNom() != null
|
358 |
&& collection.getCollectionMereNom() != null
|
386 |
&& !UtilString.isEmpty(collection.getCollectionMereNom())) {
|
359 |
&& !UtilString.isEmpty(collection.getCollectionMereNom())) {
|
387 |
collectionsCombo.chargerValeurInitiale(collection.getCollectionMereNom(), "cc_nom");
|
360 |
collectionsCombo.chargerValeurInitiale(collection.getCollectionMereNom(), "cc_nom");
|
388 |
}
|
361 |
}
|
389 |
}
|
362 |
}
|
390 |
|
363 |
|
391 |
public void rafraichir(Object nouvellesDonnees) {
|
364 |
public void rafraichir(Object nouvellesDonnees) {
|
392 |
if (nouvellesDonnees instanceof ValeurListe) {
|
365 |
if (nouvellesDonnees instanceof ValeurListe) {
|
393 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
366 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
394 |
rafraichirValeurListe(listeValeurs);
|
367 |
rafraichirValeurListe(listeValeurs);
|
395 |
} else {
|
368 |
} else {
|
396 |
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
|
369 |
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
|
397 |
}
|
370 |
}
|
398 |
}
|
371 |
}
|
399 |
|
372 |
|
400 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
373 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
401 |
if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
|
374 |
if (listeValeurs.getId().equals(config.getListeId("typeDepot"))) {
|
402 |
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
|
375 |
Formulaire.rafraichirComboBox(listeValeurs, typeDepotCombo);
|
403 |
} else {
|
376 |
} else {
|
404 |
Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
|
377 |
Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
|
405 |
}
|
378 |
}
|
406 |
}
|
379 |
}
|
407 |
|
380 |
|
408 |
|
381 |
|
409 |
|
382 |
|
410 |
}
|
383 |
}
|