Subversion Repositories eFlore/Applications.coel

Rev

Rev 859 | Rev 954 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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