858 |
jpm |
1 |
package org.tela_botanica.client.vues;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.Mediateur;
|
|
|
4 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
|
|
5 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
|
|
6 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
|
|
7 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
|
|
8 |
import org.tela_botanica.client.modeles.Valeur;
|
|
|
9 |
import org.tela_botanica.client.modeles.ValeurListe;
|
|
|
10 |
|
|
|
11 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
|
|
12 |
import com.extjs.gxt.ui.client.event.Events;
|
|
|
13 |
import com.extjs.gxt.ui.client.event.Listener;
|
|
|
14 |
import com.extjs.gxt.ui.client.widget.Html;
|
|
|
15 |
import com.extjs.gxt.ui.client.widget.LayoutContainer;
|
|
|
16 |
import com.extjs.gxt.ui.client.widget.Text;
|
|
|
17 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
|
|
18 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
|
|
19 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
|
|
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.FormPanel.LabelAlign;
|
|
|
23 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
|
|
24 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
|
|
25 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
|
|
26 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
|
|
27 |
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
|
|
|
28 |
import com.google.gwt.core.client.GWT;
|
|
|
29 |
|
|
|
30 |
public class CollectionFormContenu extends FormulaireOnglet implements Rafraichissable {
|
|
|
31 |
|
|
|
32 |
private ChampCaseACocher natureChp = null;
|
|
|
33 |
private TextArea specialiteChp = null;
|
|
|
34 |
private ChampCaseACocher periodeConstitutionChp = null;
|
|
|
35 |
private ChampComboBoxListeValeurs dateDebutCombo = null;
|
|
|
36 |
private ChampComboBoxListeValeurs dateFinCombo = null;
|
|
|
37 |
private DateField dateDebutChp = null;
|
|
|
38 |
private DateField dateFinChp = null;
|
|
|
39 |
private TextArea annotationClassementChp = null;
|
|
|
40 |
private ChampComboBoxListeValeurs etatClassementCombo = null;
|
|
|
41 |
private ChampComboBoxListeValeurs precisionDateCombo = null;
|
|
|
42 |
private ChampComboBoxListeValeurs precisionLocaliteCombo = null;
|
|
|
43 |
private TextArea etiquetteAnnotationChp = null;
|
|
|
44 |
private ChampComboBoxListeValeurs integreCollectionCombo = null;
|
|
|
45 |
private ChampComboBoxListeValeurs infoIntegreCollectionCombo = null;
|
|
|
46 |
private ChampSliderPourcentage auteurTitrePourcentChp;
|
|
|
47 |
private ChampSliderPourcentage famillePourcentChp;
|
|
|
48 |
private ChampSliderPourcentage genrePourcentChp;
|
|
|
49 |
private ChampSliderPourcentage spPourcentChp;
|
|
|
50 |
private ChampSliderPourcentage auteurSpPourcentChp;
|
|
|
51 |
private ChampSliderPourcentage localitePourcentChp;
|
|
|
52 |
private ChampSliderPourcentage datePourcentChp;
|
|
|
53 |
|
|
|
54 |
public CollectionFormContenu(Formulaire formulaireCourrant) {
|
|
|
55 |
initialiserOnglet(formulaireCourrant);
|
|
|
56 |
setId("contenu");
|
|
|
57 |
setText(Mediateur.i18nC.collectionContenu());
|
|
|
58 |
|
|
|
59 |
creerFieldsetNature();
|
|
|
60 |
// TODO : réaliser un champ couverture géographique détaillé
|
|
|
61 |
creerFieldsetPeriode();
|
|
|
62 |
creerFieldsetClassement();
|
|
|
63 |
creerFieldsetEtiquette();
|
|
|
64 |
creerFieldsetIntegration();
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
private void creerFieldsetNature() {
|
|
|
68 |
FieldSet natureFieldSet = new FieldSet();
|
|
|
69 |
natureFieldSet.setHeading("Nature");
|
|
|
70 |
natureFieldSet.setCollapsible(true);
|
|
|
71 |
natureFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
72 |
|
|
|
73 |
natureChp = new ChampCaseACocher(i18nC.natureVegetaleContenu(), "natureVegetale", false);
|
|
|
74 |
natureFieldSet.add(natureChp);
|
|
|
75 |
|
|
|
76 |
specialiteChp = new TextArea();
|
|
|
77 |
specialiteChp.setFieldLabel(i18nC.specialiteCollection());
|
|
|
78 |
specialiteChp.setToolTip(i18nC.specialiteCollectionInfo());
|
|
|
79 |
natureFieldSet.add(specialiteChp, new FormData(550, 0));
|
|
|
80 |
|
|
|
81 |
add(natureFieldSet);
|
|
|
82 |
}
|
|
|
83 |
|
|
|
84 |
private void creerFieldsetPeriode() {
|
|
|
85 |
FieldSet periodeFieldSet = new FieldSet();
|
|
|
86 |
periodeFieldSet.setHeading("Période de constitution");
|
|
|
87 |
periodeFieldSet.setCollapsible(true);
|
|
|
88 |
periodeFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
89 |
|
|
|
90 |
periodeConstitutionChp = new ChampCaseACocher(i18nC.periodeConstitution(), "siecleNaturaliste", false);
|
|
|
91 |
periodeFieldSet.add(periodeConstitutionChp);
|
|
|
92 |
|
|
|
93 |
LayoutContainer dateDebutConteneurGeneral = new LayoutContainer();
|
|
|
94 |
dateDebutConteneurGeneral.setLayout(new RowLayout());
|
|
|
95 |
LabelField dateDebutLabel = new LabelField(i18nC.dateDebutCollection()+":");
|
|
|
96 |
dateDebutConteneurGeneral.add(dateDebutLabel);
|
|
|
97 |
LayoutContainer dateDebutConteneur = new LayoutContainer();
|
|
|
98 |
dateDebutConteneur.setLayout(new ColumnLayout());
|
|
|
99 |
dateDebutChp = new DateField();
|
|
|
100 |
dateDebutConteneur.add(dateDebutChp, new ColumnData(220));
|
|
|
101 |
dateDebutCombo = new ChampComboBoxListeValeurs(null, "dateDebut");
|
|
|
102 |
dateDebutCombo.setTrie("id_valeur");
|
|
|
103 |
dateDebutConteneur.add(dateDebutCombo, new ColumnData(160));
|
|
|
104 |
dateDebutConteneurGeneral.add(dateDebutConteneur);
|
|
|
105 |
periodeFieldSet.add(dateDebutConteneurGeneral);
|
|
|
106 |
|
|
|
107 |
LayoutContainer dateFinConteneurGeneral = new LayoutContainer();
|
|
|
108 |
dateFinConteneurGeneral.setLayout(new RowLayout());
|
|
|
109 |
LabelField dateFinLabel = new LabelField(i18nC.dateFinCollection()+":");
|
|
|
110 |
dateFinConteneurGeneral.add(dateFinLabel);
|
|
|
111 |
LayoutContainer dateFinConteneur = new LayoutContainer();
|
|
|
112 |
dateFinConteneur.setLayout(new ColumnLayout());
|
|
|
113 |
dateFinChp = new DateField();
|
|
|
114 |
dateFinConteneur.add(dateFinChp, new ColumnData(220));
|
|
|
115 |
dateFinCombo = new ChampComboBoxListeValeurs(null, "dateFin");
|
|
|
116 |
dateFinCombo.setTrie("id_valeur");
|
|
|
117 |
dateFinConteneur.add(dateFinCombo, new ColumnData(160));
|
|
|
118 |
dateFinConteneurGeneral.add(dateFinConteneur);
|
|
|
119 |
periodeFieldSet.add(dateFinConteneurGeneral);
|
|
|
120 |
|
|
|
121 |
add(periodeFieldSet);
|
|
|
122 |
}
|
|
|
123 |
|
|
|
124 |
private void creerFieldsetClassement() {
|
|
|
125 |
FieldSet classementFieldSet = new FieldSet();
|
|
|
126 |
classementFieldSet.setHeading("Classement");
|
|
|
127 |
classementFieldSet.setCollapsible(true);
|
|
|
128 |
classementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
129 |
|
|
|
130 |
annotationClassementChp = new TextArea();
|
|
|
131 |
annotationClassementChp.setFieldLabel(i18nC.annotationClassementCollection());
|
|
|
132 |
annotationClassementChp.setToolTip(i18nC.annotationClassementCollectionInfo());
|
|
|
133 |
classementFieldSet.add(annotationClassementChp, new FormData(550, 0));
|
|
|
134 |
|
|
|
135 |
etatClassementCombo = new ChampComboBoxListeValeurs(i18nC.etatClassementCollection(), "etat", tabIndex++);
|
|
|
136 |
classementFieldSet.add(etatClassementCombo);
|
|
|
137 |
|
|
|
138 |
add(classementFieldSet);
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
private void creerFieldsetEtiquette() {
|
|
|
142 |
FieldSet etiquetteFieldSet = new FieldSet();
|
|
|
143 |
etiquetteFieldSet.setHeading("Étiquette");
|
|
|
144 |
etiquetteFieldSet.setCollapsible(true);
|
|
|
145 |
etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
|
|
146 |
|
|
|
147 |
Text renseignementPoucentLabel = new Text(i18nC.renseignementEtiquetteCollection());
|
|
|
148 |
renseignementPoucentLabel.setTagName("label");
|
|
|
149 |
renseignementPoucentLabel.setStyleName("x-form-item-label");
|
|
|
150 |
etiquetteFieldSet.add(renseignementPoucentLabel);
|
|
|
151 |
|
|
|
152 |
auteurTitrePourcentChp = new ChampSliderPourcentage(i18nC.auteurTitrePourcentCollection());
|
|
|
153 |
etiquetteFieldSet.add(auteurTitrePourcentChp, new FormData(200, 0));
|
|
|
154 |
|
|
|
155 |
famillePourcentChp = new ChampSliderPourcentage(i18nC.famillePourcentCollection());
|
|
|
156 |
etiquetteFieldSet.add(famillePourcentChp, new FormData(200, 0));
|
|
|
157 |
|
|
|
158 |
genrePourcentChp = new ChampSliderPourcentage(i18nC.genrePourcentCollection());
|
|
|
159 |
etiquetteFieldSet.add(genrePourcentChp, new FormData(200, 0));
|
|
|
160 |
|
|
|
161 |
spPourcentChp = new ChampSliderPourcentage(i18nC.spPourcentCollection());
|
|
|
162 |
etiquetteFieldSet.add(spPourcentChp, new FormData(200, 0));
|
|
|
163 |
|
|
|
164 |
auteurSpPourcentChp = new ChampSliderPourcentage(i18nC.auteurSpPourcentCollection());
|
|
|
165 |
etiquetteFieldSet.add(auteurSpPourcentChp, new FormData(200, 0));
|
|
|
166 |
|
|
|
167 |
localitePourcentChp = new ChampSliderPourcentage(i18nC.localitePourcentCollection());
|
|
|
168 |
etiquetteFieldSet.add(localitePourcentChp, new FormData(200, 0));
|
|
|
169 |
|
|
|
170 |
datePourcentChp = new ChampSliderPourcentage(i18nC.datePourcentCollection());
|
|
|
171 |
etiquetteFieldSet.add(datePourcentChp, new FormData(200, 0));
|
|
|
172 |
|
|
|
173 |
precisionLocaliteCombo = new ChampComboBoxListeValeurs(i18nC.precisionLocaliteCollection(), "onep", tabIndex++);
|
|
|
174 |
etiquetteFieldSet.add(precisionLocaliteCombo);
|
|
|
175 |
|
|
|
176 |
precisionDateCombo = new ChampComboBoxListeValeurs(i18nC.precisionDateCollection(), "onep", tabIndex++);
|
|
|
177 |
etiquetteFieldSet.add(precisionDateCombo);
|
|
|
178 |
|
|
|
179 |
etiquetteAnnotationChp = new TextArea();
|
|
|
180 |
etiquetteAnnotationChp.setFieldLabel(i18nC.etiquetteAnnotationCollection());
|
|
|
181 |
etiquetteAnnotationChp.setToolTip(i18nC.etiquetteAnnotationCollectionInfo());
|
|
|
182 |
etiquetteFieldSet.add(etiquetteAnnotationChp, new FormData(550, 0));
|
|
|
183 |
|
|
|
184 |
add(etiquetteFieldSet);
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
private void creerFieldsetIntegration() {
|
|
|
188 |
FieldSet integrationFieldSet = new FieldSet();
|
|
|
189 |
integrationFieldSet.setHeading("Collections intégrées");
|
|
|
190 |
integrationFieldSet.setCollapsible(true);
|
|
|
191 |
integrationFieldSet.setLayout(Formulaire.creerFormLayout(350, alignementLabelDefaut));
|
|
|
192 |
|
|
|
193 |
integreCollectionCombo = new ChampComboBoxListeValeurs(i18nC.integreCollection(), "onpi", tabIndex++);
|
|
|
194 |
integrationFieldSet.add(integreCollectionCombo);
|
|
|
195 |
|
|
|
196 |
infoIntegreCollectionCombo = new ChampComboBoxListeValeurs(i18nC.infoIntegreCollection(), "onp", tabIndex++);
|
|
|
197 |
integrationFieldSet.add(infoIntegreCollectionCombo);
|
|
|
198 |
|
|
|
199 |
Text infoIntegration = new Text(i18nC.infoIntegrationCollection());
|
|
|
200 |
integrationFieldSet.add(infoIntegration);
|
|
|
201 |
|
|
|
202 |
add(integrationFieldSet);
|
|
|
203 |
}
|
|
|
204 |
|
|
|
205 |
public void rafraichir(Object nouvellesDonnees) {
|
|
|
206 |
if (nouvellesDonnees instanceof ValeurListe) {
|
|
|
207 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
|
|
208 |
rafraichirValeurListe(listeValeurs);
|
|
|
209 |
} else {
|
|
|
210 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
|
|
211 |
}
|
|
|
212 |
}
|
|
|
213 |
|
|
|
214 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
|
|
215 |
if (listeValeurs.getId().equals(config.getListeId(""))) {
|
|
|
216 |
|
|
|
217 |
} else {
|
|
|
218 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
|
|
219 |
}
|
|
|
220 |
}
|
|
|
221 |
}
|