Subversion Repositories eFlore/Applications.coel

Rev

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

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