Subversion Repositories eFlore/Applications.coel

Rev

Rev 858 | Rev 934 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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