Subversion Repositories eFlore/Applications.coel

Rev

Rev 648 | Rev 703 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 648 Rev 687
Line 1... Line 1...
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
Line -... Line 2...
-
 
2
 
2
 
3
import java.util.ArrayList;
-
 
4
import java.util.HashMap;
3
import java.util.HashMap;
5
import java.util.Iterator;
Line 4... Line 6...
4
import java.util.List;
6
import java.util.List;
-
 
7
 
-
 
8
import org.tela_botanica.client.Mediateur;
-
 
9
import org.tela_botanica.client.RegistreId;
5
 
10
import org.tela_botanica.client.composants.ChampMultiValeurs;
6
import org.tela_botanica.client.Mediateur;
11
import org.tela_botanica.client.images.Images;
-
 
12
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
13
import org.tela_botanica.client.modeles.Collection;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.modeles.CollectionListe;
8
import org.tela_botanica.client.modeles.Collection;
15
import org.tela_botanica.client.modeles.Configuration;
-
 
16
import org.tela_botanica.client.modeles.Information;
-
 
17
import org.tela_botanica.client.modeles.MenuApplicationId;
9
import org.tela_botanica.client.modeles.Information;
18
import org.tela_botanica.client.modeles.Projet;
10
import org.tela_botanica.client.modeles.MenuApplicationId;
-
 
11
import org.tela_botanica.client.modeles.Structure;
19
import org.tela_botanica.client.modeles.ProjetListe;
12
import org.tela_botanica.client.modeles.StructureConservation;
20
import org.tela_botanica.client.modeles.Structure;
13
import org.tela_botanica.client.modeles.StructureValorisation;
21
import org.tela_botanica.client.modeles.StructureListe;
Line -... Line 22...
-
 
22
import org.tela_botanica.client.modeles.Valeur;
-
 
23
import org.tela_botanica.client.modeles.ValeurListe;
-
 
24
 
14
import org.tela_botanica.client.modeles.Valeur;
25
import com.extjs.gxt.ui.client.Registry;
15
import org.tela_botanica.client.modeles.ValeurListe;
26
import com.extjs.gxt.ui.client.Style.SortDir;
-
 
27
import com.extjs.gxt.ui.client.event.BaseEvent;
16
 
28
import com.extjs.gxt.ui.client.event.ButtonEvent;
17
import com.extjs.gxt.ui.client.event.ButtonEvent;
29
import com.extjs.gxt.ui.client.event.ComponentEvent;
-
 
30
import com.extjs.gxt.ui.client.event.EventType;
-
 
31
import com.extjs.gxt.ui.client.event.Events;
18
import com.extjs.gxt.ui.client.event.ComponentEvent;
32
import com.extjs.gxt.ui.client.event.Listener;
-
 
33
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
-
 
34
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
-
 
35
import com.extjs.gxt.ui.client.event.SelectionListener;
-
 
36
import com.extjs.gxt.ui.client.event.WidgetListener;
-
 
37
import com.extjs.gxt.ui.client.store.ListStore;
-
 
38
import com.extjs.gxt.ui.client.store.Store;
19
import com.extjs.gxt.ui.client.event.Events;
39
import com.extjs.gxt.ui.client.store.StoreEvent;
-
 
40
import com.extjs.gxt.ui.client.store.StoreListener;
-
 
41
import com.extjs.gxt.ui.client.widget.Component;
20
import com.extjs.gxt.ui.client.event.Listener;
42
import com.extjs.gxt.ui.client.widget.Info;
21
import com.extjs.gxt.ui.client.event.SelectionListener;
43
import com.extjs.gxt.ui.client.widget.LayoutContainer;
-
 
44
import com.extjs.gxt.ui.client.widget.MessageBox;
-
 
45
import com.extjs.gxt.ui.client.widget.TabItem;
-
 
46
import com.extjs.gxt.ui.client.widget.TabPanel;
-
 
47
import com.extjs.gxt.ui.client.widget.Text;
22
import com.extjs.gxt.ui.client.widget.Info;
48
import com.extjs.gxt.ui.client.widget.button.Button;
23
import com.extjs.gxt.ui.client.widget.TabItem;
49
import com.extjs.gxt.ui.client.widget.form.ComboBox;
-
 
50
import com.extjs.gxt.ui.client.widget.form.Field;
-
 
51
import com.extjs.gxt.ui.client.widget.form.FieldSet;
24
import com.extjs.gxt.ui.client.widget.TabPanel;
52
import com.extjs.gxt.ui.client.widget.form.HiddenField;
-
 
53
import com.extjs.gxt.ui.client.widget.form.LabelField;
25
import com.extjs.gxt.ui.client.widget.form.FieldSet;
54
import com.extjs.gxt.ui.client.widget.form.NumberField;
-
 
55
import com.extjs.gxt.ui.client.widget.form.Radio;
-
 
56
import com.extjs.gxt.ui.client.widget.form.TextArea;
26
import com.extjs.gxt.ui.client.widget.form.HiddenField;
57
import com.extjs.gxt.ui.client.widget.form.TextField;
-
 
58
import com.extjs.gxt.ui.client.widget.form.Validator;
-
 
59
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
27
import com.extjs.gxt.ui.client.widget.form.Radio;
60
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
-
 
61
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
28
import com.extjs.gxt.ui.client.widget.form.TextField;
62
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
-
 
63
import com.extjs.gxt.ui.client.widget.layout.FormData;
29
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
64
import com.extjs.gxt.ui.client.widget.layout.RowLayout;
Line 30... Line 65...
30
import com.extjs.gxt.ui.client.widget.layout.FormData;
65
import com.google.gwt.core.client.GWT;
Line 31... Line 66...
31
import com.google.gwt.core.client.GWT;
66
import com.google.gwt.i18n.client.NumberFormat;
32
import com.google.gwt.user.client.ui.Widget;
67
import com.google.gwt.user.client.ui.Widget;
Line 33... Line 68...
33
 
68
 
-
 
69
public class CollectionForm extends Formulaire implements Rafraichissable {
-
 
70
 
-
 
71
	private Collection collection = null;
-
 
72
	private Collection collectionCollectee = null;
-
 
73
 
-
 
74
	private HashMap<String,FieldSet> champsFs = new HashMap<String,FieldSet>();
-
 
75
	private HashMap<String,LayoutContainer> champsLc = new HashMap<String,LayoutContainer>();
-
 
76
	private HashMap<String,HiddenField<String>> champsHfs = new HashMap<String,HiddenField<String>>();
Line 34... Line 77...
34
public class CollectionForm extends Formulaire implements Rafraichissable {
77
	private HashMap<String,TextField<String>> champsTfs = new HashMap<String,TextField<String>>();
35
 
78
	private HashMap<String,TextArea> champsTa = new HashMap<String,TextArea>();
-
 
79
	private HashMap<String,ChampMultiValeurs> champsCmv = new HashMap<String,ChampMultiValeurs>();
36
	private Collection collection = null;
80
	private HashMap<String,Text> champsT = new HashMap<String,Text>();
37
	private Collection collectionCollectee = null;
81
	private HashMap<String,ComboBox<Valeur>> champsCbv = new HashMap<String,ComboBox<Valeur>>();
38
 
82
	private HashMap<String,ListStore<Valeur>> champsLsv = new HashMap<String,ListStore<Valeur>>();
39
	private HashMap<String, Widget>champs = new HashMap<String, Widget>();
83
	
-
 
84
	private TabItem generalOnglet = null;
-
 
85
	private TabItem auteurOnglet = null;
-
 
86
	private TabItem publicationOnglet = null;
-
 
87
	private TabItem descriptionOnglet = null;
-
 
88
	private TabItem contenuOnglet = null;
-
 
89
	private TabItem documentOnglet = null;
-
 
90
	private TabItem inventaireOnglet = null;
-
 
91
	
Line 40... Line 92...
40
	
92
	private ListStore<Projet> projetsStore;
41
	private TabItem generalOnglet = null;
93
	private ComboBox<Projet> projetsCombo;
42
	private TabItem auteurOnglet = null;
94
	private ListStore<Structure> structuresStore;
Line 58... Line 110...
58
		onglets.add(creerOngletGeneral());
110
		onglets.add(creerOngletGeneral());
Line 59... Line 111...
59
		
111
		
60
		// Onlget formulaire AUTEUR
112
		// Onlget formulaire AUTEUR
Line -... Line 113...
-
 
113
		onglets.add(creerOngletAuteur());
-
 
114
		
-
 
115
		// Onlget formulaire PUBLICATION
61
		onglets.add(creerOngletAuteur());
116
		onglets.add(creerOngletPublication());
62
		
117
		
Line 63... Line 118...
63
		// Onlget formulaire DESCRIPTION
118
		// Onlget formulaire DESCRIPTION
64
		onglets.add(creerOngletDescription());
119
		onglets.add(creerOngletDescription());
Line 78... Line 133...
78
		// Ajout des onglets au formulaire général
133
		// Ajout des onglets au formulaire général
79
		panneauFormulaire.add(onglets);
134
		panneauFormulaire.add(onglets);
80
	}
135
	}
Line 81... Line 136...
81
	
136
	
82
	private TabItem creerOngletGeneral() {
137
	private TabItem creerOngletGeneral() {
83
		generalOnglet = creerOnglet(i18nC.collectionGeneral(), "general");
-
 
84
		generalOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
-
 
85
			public void handleEvent(ComponentEvent be) {  
-
 
86
				//peuplerOngletGeneral();
-
 
87
				generalOnglet.layout();
-
 
88
			}  
-
 
89
		});
-
 
90
		
-
 
91
		//+-----------------------------------------------------------------------------------------------------------+
-
 
92
		// Champs cachés
-
 
93
		HiddenField<String> idCollectionChp = new HiddenField<String>();
-
 
94
		champs.put("idCollectionChp", idCollectionChp);
-
 
95
		
-
 
96
		//+-----------------------------------------------------------------------------------------------------------+
-
 
97
		// Fieldset ADMINISTRATIF
-
 
98
		FieldSet administratifFieldSet = new FieldSet();
-
 
99
		administratifFieldSet.setHeading(i18nC.collectionGeneralTitre());
-
 
100
		administratifFieldSet.setCollapsible(true);
-
 
101
		administratifFieldSet.setLayout(creerFormLayout(120, LabelAlign.LEFT));
-
 
102
 
-
 
103
		TextField<String> nomChp = new TextField<String>();
-
 
104
		nomChp.setTabIndex(tabIndex++);
-
 
105
		nomChp.setFieldLabel(i18nC.nomCollection());
-
 
106
		nomChp.setAllowBlank(false);
-
 
107
		nomChp.getMessages().setBlankText(i18nC.champObligatoire());
-
 
108
		administratifFieldSet.add(nomChp, new FormData(450, 0));
-
 
109
		
-
 
110
		generalOnglet.add(administratifFieldSet);
-
 
111
		
-
 
112
		//+-----------------------------------------------------------------------------------------------------------+
-
 
113
		// Fieldset DESCRIPTION
-
 
114
		FieldSet descriptionFieldSet = new FieldSet();
-
 
115
		descriptionFieldSet.setHeading(i18nC.collectionDescriptionTitre());
-
 
116
		descriptionFieldSet.setCollapsible(true);
-
 
117
		descriptionFieldSet.setLayout(creerFormLayout(120, LabelAlign.LEFT));
-
 
118
		
-
 
119
		generalOnglet.add(descriptionFieldSet);
-
 
120
 
-
 
121
		//+-----------------------------------------------------------------------------------------------------------+
-
 
122
		// Retour
138
		generalOnglet = new CollectionFormGeneral(this);
123
		return generalOnglet;
139
		return generalOnglet;
Line 124... Line 140...
124
	}
140
	}
125
	
141
	
Line 133... Line 149...
133
		});
149
		});
Line 134... Line 150...
134
		
150
		
135
		return auteurOnglet;
151
		return auteurOnglet;
Line -... Line 152...
-
 
152
	}
-
 
153
	
-
 
154
	private TabItem creerOngletPublication() {
-
 
155
		publicationOnglet = creerOnglet(i18nC.collectionPublication(), "publication");
-
 
156
		publicationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
-
 
157
			public void handleEvent(ComponentEvent be) {  
-
 
158
				//peuplerOngletAuteur();
-
 
159
				publicationOnglet.layout();
-
 
160
			}  
-
 
161
		});
-
 
162
		
-
 
163
		return publicationOnglet;
136
	}
164
	}
137
	
165
	
138
	private TabItem creerOngletDescription() {
166
	private TabItem creerOngletDescription() {
139
		descriptionOnglet = creerOnglet(i18nC.collectionDescription(), "description");
167
		descriptionOnglet = creerOnglet(i18nC.collectionDescription(), "description");
140
		descriptionOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
168
		descriptionOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
Line 146... Line 174...
146
		
174
		
147
		return descriptionOnglet;
175
		return descriptionOnglet;
Line 148... Line 176...
148
	}
176
	}
149
	
177
	
150
	private TabItem creerOngletContenu() {
178
	private TabItem creerOngletContenu() {
151
		contenuOnglet = creerOnglet(i18nC.collectionDescription(), "contenu");
179
		contenuOnglet = creerOnglet(i18nC.collectionContenu(), "contenu");
152
		contenuOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
180
		contenuOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
153
			public void handleEvent(ComponentEvent be) {  
181
			public void handleEvent(ComponentEvent be) {  
154
				//peuplerOngletContenu();
182
				//peuplerOngletContenu();
Line 158... Line 186...
158
		
186
		
159
		return contenuOnglet;
187
		return contenuOnglet;
Line 160... Line 188...
160
	}
188
	}
161
	
189
	
162
	private TabItem creerOngletDocument() {
190
	private TabItem creerOngletDocument() {
163
		documentOnglet = creerOnglet(i18nC.collectionDescription(), "document");
191
		documentOnglet = creerOnglet(i18nC.collectionDocument(), "document");
164
		documentOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
192
		documentOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
165
			public void handleEvent(ComponentEvent be) {  
193
			public void handleEvent(ComponentEvent be) {  
166
				//peuplerOngletDocument();
194
				//peuplerOngletDocument();
Line 170... Line 198...
170
		
198
		
171
		return documentOnglet;
199
		return documentOnglet;
Line 172... Line 200...
172
	}
200
	}
173
	
201
	
174
	private TabItem creerOngletInventaire() {
202
	private TabItem creerOngletInventaire() {
175
		inventaireOnglet = creerOnglet(i18nC.collectionDescription(), "inventaire");
203
		inventaireOnglet = creerOnglet(i18nC.collectionInventaire(), "inventaire");
176
		inventaireOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
204
		inventaireOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {  
177
			public void handleEvent(ComponentEvent be) {  
205
			public void handleEvent(ComponentEvent be) {  
178
				//peuplerOngletInventaire();
206
				//peuplerOngletInventaire();
Line 198... Line 226...
198
			GWT.log("rafraichir()", e);
226
			GWT.log("rafraichir()", e);
199
		}
227
		}
200
		verifierApresRafraichissement();
228
		verifierApresRafraichissement();
201
	}
229
	}
Line 202... Line 230...
202
 
230
 
203
	public void rafraichirInformation(Information info) {
231
	private void rafraichirInformation(Information info) {
204
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
232
		if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
205
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
233
			GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
Line 206... Line 234...
206
		}
234
		}
Line 215... Line 243...
215
			actualiserPeuplementOnglet();
243
			actualiserPeuplementOnglet();
216
			actualiserTitrePanneau();
244
			actualiserTitrePanneau();
217
		}
245
		}
218
	}
246
	}
Line 219... Line 247...
219
	
247
	
220
	public void rafraichirValeurListe(ValeurListe listeValeurs) {
248
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
Line 221... Line 249...
221
		List<Valeur> liste = listeValeurs.toList();
249
		List<Valeur> liste = listeValeurs.toList();
222
 
250
 
-
 
251
		// Test pour savoir si la liste contient des éléments
Line -... Line 252...
-
 
252
		if (liste.size() > 0) {
-
 
253
			String[] listesTraitables = {};
-
 
254
			
-
 
255
			Boolean implemente = false;
-
 
256
			for (int i = 0; i < listesTraitables.length;  i++) {
-
 
257
				String id = listesTraitables[i];
-
 
258
				GWT.log(id, null);
-
 
259
				if (listeValeurs.getId().equals(config.getListeId(id))) {
-
 
260
					champsLsv.get(id).removeAll();
-
 
261
					champsLsv.get(id).add(liste);
-
 
262
					champsCbv.get(id).setStore(champsLsv.get(id));
-
 
263
					implemente = true;
-
 
264
					break;
-
 
265
				}
-
 
266
			}
223
		// Test pour savoir si la liste contient des éléments
267
			if (implemente == false) {
224
		if (liste.size() > 0) {
268
				GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
Line 225... Line 269...
225
			
269
			}
226
		}
270
		}