Subversion Repositories eFlore/Applications.coel

Rev

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

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