Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1918 Rev 1920
1
package org.tela_botanica.client.vues.collection;
1
package org.tela_botanica.client.vues.collection;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.HashMap;
4
import java.util.HashMap;
5
import java.util.Iterator;
5
import java.util.Iterator;
6
import java.util.List;
6
import java.util.List;
7
 
7
 
8
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.Mediateur;
9
import org.tela_botanica.client.composants.ChampCaseACocher;
9
import org.tela_botanica.client.composants.ChampCaseACocher;
10
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
10
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
11
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
11
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
12
import org.tela_botanica.client.composants.ChampSliderPourcentage;
12
import org.tela_botanica.client.composants.ChampSliderPourcentage;
13
import org.tela_botanica.client.composants.InfoLogger;
-
 
14
import org.tela_botanica.client.composants.ChampNombre;
13
import org.tela_botanica.client.composants.ChampNombre;
15
import org.tela_botanica.client.images.Images;
-
 
16
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.interfaces.Rafraichissable;
17
import org.tela_botanica.client.modeles.InterneValeur;
15
import org.tela_botanica.client.modeles.InterneValeur;
18
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.Valeur;
19
import org.tela_botanica.client.modeles.ValeurListe;
17
import org.tela_botanica.client.modeles.ValeurListe;
20
import org.tela_botanica.client.modeles.aDonnee;
-
 
21
import org.tela_botanica.client.modeles.collection.Collection;
18
import org.tela_botanica.client.modeles.collection.Collection;
22
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
19
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
23
import org.tela_botanica.client.modeles.collection.UniteBase;
20
import org.tela_botanica.client.modeles.collection.UniteBase;
24
import org.tela_botanica.client.modeles.collection.UniteRangement;
21
import org.tela_botanica.client.modeles.collection.UniteRangement;
25
import org.tela_botanica.client.util.Debug;
22
import org.tela_botanica.client.util.Debug;
26
import org.tela_botanica.client.util.Pattern;
-
 
27
import org.tela_botanica.client.util.UtilNombre;
-
 
28
import org.tela_botanica.client.util.UtilString;
23
import org.tela_botanica.client.util.UtilString;
29
import org.tela_botanica.client.vues.Formulaire;
24
import org.tela_botanica.client.vues.Formulaire;
30
import org.tela_botanica.client.vues.FormulaireOnglet;
25
import org.tela_botanica.client.vues.FormulaireOnglet;
31
 
-
 
32
import com.extjs.gxt.ui.client.Style.Scroll;
-
 
33
import com.extjs.gxt.ui.client.event.BaseEvent;
-
 
34
import com.extjs.gxt.ui.client.event.ButtonEvent;
-
 
35
import com.extjs.gxt.ui.client.event.ComponentEvent;
-
 
36
import com.extjs.gxt.ui.client.event.Events;
26
import com.extjs.gxt.ui.client.event.Events;
37
import com.extjs.gxt.ui.client.event.FieldEvent;
27
import com.extjs.gxt.ui.client.event.FieldEvent;
38
import com.extjs.gxt.ui.client.event.Listener;
28
import com.extjs.gxt.ui.client.event.Listener;
39
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
-
 
40
import com.extjs.gxt.ui.client.event.SelectionListener;
-
 
41
import com.extjs.gxt.ui.client.store.ListStore;
29
import com.extjs.gxt.ui.client.store.ListStore;
42
import com.extjs.gxt.ui.client.widget.ContentPanel;
-
 
43
import com.extjs.gxt.ui.client.widget.Info;
30
import com.extjs.gxt.ui.client.widget.Label;
44
import com.extjs.gxt.ui.client.widget.MessageBox;
-
 
45
import com.extjs.gxt.ui.client.widget.Text;
31
import com.extjs.gxt.ui.client.widget.Text;
46
import com.extjs.gxt.ui.client.widget.button.Button;
-
 
47
import com.extjs.gxt.ui.client.widget.form.ComboBox;
-
 
48
import com.extjs.gxt.ui.client.widget.form.FieldSet;
32
import com.extjs.gxt.ui.client.widget.form.FieldSet;
49
import com.extjs.gxt.ui.client.widget.form.LabelField;
-
 
50
import com.extjs.gxt.ui.client.widget.form.NumberField;
33
import com.extjs.gxt.ui.client.widget.form.NumberField;
51
import com.extjs.gxt.ui.client.widget.form.TextArea;
34
import com.extjs.gxt.ui.client.widget.form.TextArea;
52
import com.extjs.gxt.ui.client.widget.form.TextField;
35
import com.extjs.gxt.ui.client.widget.form.TextField;
53
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
-
 
54
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
36
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
55
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
-
 
56
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
-
 
57
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
-
 
58
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
-
 
59
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
-
 
60
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
37
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
61
import com.extjs.gxt.ui.client.widget.grid.Grid;
-
 
62
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
-
 
63
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
-
 
64
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
-
 
65
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
-
 
66
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
-
 
67
import com.extjs.gxt.ui.client.widget.layout.FormData;
38
import com.extjs.gxt.ui.client.widget.layout.FormData;
68
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
39
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
69
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
-
 
70
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
-
 
71
import com.google.gwt.event.dom.client.KeyCodes;
-
 
72
import com.google.gwt.i18n.client.NumberFormat;
40
import com.google.gwt.i18n.client.NumberFormat;
-
 
41
import com.google.gwt.user.client.ui.HorizontalPanel;
73
 
42
 
74
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
43
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
75
	
44
	
76
	public static final String ID = "description";
45
	public static final String ID = "description";
77
	private Collection collection = null;
46
	private Collection collection = null;
78
	private CollectionBotanique collectionBotanique = null;
47
	private CollectionBotanique collectionBotanique = null;
79
	private Collection collectionCollectee = null;
48
	private Collection collectionCollectee = null;
80
	private CollectionBotanique collectionBotaniqueCollectee = null;
49
	private CollectionBotanique collectionBotaniqueCollectee = null;
81
	
50
	
82
	private static ListStore<InterneValeur> precisionStore = null;
51
	private static ListStore<InterneValeur> precisionStore = null;
83
	private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
52
	private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
84
	private NumberField nbreEchantillonChp = null;
53
	private NumberField nbreEchantillonChp = null;
85
	private EditorGrid<UniteRangement> uniteRangementGrille = null;
54
	private EditorGrid<UniteRangement> uniteRangementGrille = null;
86
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
55
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
87
	private EditorGrid<UniteBase> uniteBaseGrille = null;
56
	private EditorGrid<UniteBase> uniteBaseGrille = null;
88
	private ChampCaseACocher typePapierConservationChp = null;
57
	private ChampCaseACocher typePapierConservationChp = null;
89
	private ChampCaseACocher methodeConservationChp = null;
58
	private ChampCaseACocher methodeConservationChp = null;
90
	private ChampSliderPourcentage specimenFixationPourcentChp = null;
59
	private ChampSliderPourcentage specimenFixationPourcentChp = null;
91
	private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
60
	private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
92
	private ChampCaseACocher specimentMethodeFixationChp = null;
61
	private ChampCaseACocher specimentMethodeFixationChp = null;
93
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
62
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
94
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
63
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
95
	private ChampCaseACocher typeEcritureChp = null;
64
	private ChampCaseACocher typeEcritureChp = null;
96
	private ChampComboBoxListeValeurs traitementCombo = null;
65
	private ChampComboBoxListeValeurs traitementCombo = null;
97
	private ChampCaseACocher poisonTraitementChp = null;
66
	private ChampCaseACocher poisonTraitementChp = null;
98
	private ChampCaseACocher insecteTraitementChp = null;
67
	private ChampCaseACocher insecteTraitementChp = null;
99
	private ChampComboBoxListeValeurs etatGeneralCombo = null;
68
	private ChampComboBoxListeValeurs etatGeneralCombo = null;
100
	private ChampComboBoxListeValeurs determinationCombo = null;
69
	private ChampComboBoxListeValeurs determinationCombo = null;
101
	private ChampMultiValeursMultiTypes specimenDegradationChp = null;
70
	private ChampMultiValeursMultiTypes specimenDegradationChp = null;
102
	private ChampMultiValeursMultiTypes presentationDegradationChp = null;
71
	private ChampMultiValeursMultiTypes presentationDegradationChp = null;
103
	private Text labelPresentationDegradationChp = null;
72
	private Text labelPresentationDegradationChp = null;
104
	private ChampNombre planchesHerbier = null;
73
	private ChampNombre planchesHerbier = null;
105
	private ChampNombre nbEspeces = null;
74
	private ChampNombre nbEspeces = null;
-
 
75
	private ChampNombre nbCartonsHerbier = null;
-
 
76
	private TextField<String> cartonsHerbierFormat = null;
-
 
77
	private ChampNombre nbLiasses = null;
-
 
78
	private TextField<String> liassesFormat = null;
-
 
79
	private TextArea autresUnitesRangement = null;
106
		
80
		
107
	public CollectionFormDescription(Formulaire formulaireCourrant) {
81
	public CollectionFormDescription(Formulaire formulaireCourrant) {
108
		initialiserOnglet(formulaireCourrant);
82
		initialiserOnglet(formulaireCourrant);
109
		setId(ID);
83
		setId(ID);
110
		setText(Mediateur.i18nC.collectionDescription());
84
		setText(Mediateur.i18nC.collectionDescription());
111
 
85
 
112
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
86
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
113
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
87
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
114
		formulaireLayout.setLabelWidth(300);
88
		formulaireLayout.setLabelWidth(300);
115
		
89
		
116
		creerFieldsetTypesUniteEtat();
90
		creerFieldsetTypesUniteEtat();
117
		
91
		
118
		creerFieldsetConservation(); // Papier
92
		creerFieldsetConservation(); // Papier
119
		
93
		
120
		creerFieldsetEtiquette(); // RAS
94
		creerFieldsetEtiquette(); // RAS
121
		creerFieldsetTraitement(); // RAS
95
		creerFieldsetTraitement(); // RAS
122
		
96
		
123
		creerFieldsetPrecision(); // A supprimer ou déplacer plus tard
97
		creerFieldsetPrecision(); // A supprimer ou déplacer plus tard
124
		creerStorePrecision();
98
		creerStorePrecision();
125
		
99
		
126
		layout();
100
		layout();
127
	}
101
	}
128
	
102
	
129
	private void creerFieldsetPrecision() {
103
	private void creerFieldsetPrecision() {
130
		FieldSet precisionFieldSet = new FieldSet();
104
		FieldSet precisionFieldSet = new FieldSet();
131
		precisionFieldSet.setHeadingHtml(i18nC.collectionTitrePrecision());
105
		precisionFieldSet.setHeadingHtml(i18nC.collectionTitrePrecision());
132
		precisionFieldSet.setCollapsible(true);
106
		precisionFieldSet.setCollapsible(true);
133
		precisionFieldSet.collapse();
107
		precisionFieldSet.collapse();
134
		precisionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
108
		precisionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
135
		
109
		
136
		typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
110
		typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
137
		typesCollectionBotaCombo.setTabIndex(tabIndex++);
111
		typesCollectionBotaCombo.setTabIndex(tabIndex++);
138
		precisionFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
112
		precisionFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
139
		
113
		
140
		nbreEchantillonChp = new NumberField(); 
114
		nbreEchantillonChp = new NumberField(); 
141
		nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
115
		nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
142
		nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
116
		nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
143
		nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
117
		nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
144
		precisionFieldSet.add(nbreEchantillonChp);
118
		precisionFieldSet.add(nbreEchantillonChp);
145
		
119
		
146
		this.add(precisionFieldSet);
120
		this.add(precisionFieldSet);
147
	}
121
	}
148
	
122
	
149
	private static void creerStorePrecision() {
123
	private static void creerStorePrecision() {
150
		if (precisionStore == null) {
124
		if (precisionStore == null) {
151
			precisionStore = new ListStore<InterneValeur>();
125
			precisionStore = new ListStore<InterneValeur>();
152
			precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, Mediateur.i18nC.precisionApproximatif()));  
126
			precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, Mediateur.i18nC.precisionApproximatif()));  
153
			precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, Mediateur.i18nC.precisionExact()));
127
			precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, Mediateur.i18nC.precisionExact()));
154
		}
128
		}
155
	}
129
	}
156
	
-
 
157
	private static String getPrecisionNom(String precisionAbr) {
-
 
158
		String precision = "";
-
 
159
		if (!precisionAbr.equals("NULL")) {
-
 
160
			creerStorePrecision();
-
 
161
			InterneValeur precisionValeur = precisionStore.findModel("abr", precisionAbr);
-
 
162
			if (precisionValeur != null && !precisionValeur.getNom().equals("NULL")) {
-
 
163
				precision = precisionValeur.getNom();
-
 
164
			}
-
 
165
		}
-
 
166
		return precision;
-
 
167
	}
-
 
168
	
-
 
169
	private static String getPrecisionAbr(String precisionNom) {
-
 
170
		String precision = "";
-
 
171
		if (!precisionNom.equals("NULL")) {
-
 
172
			creerStorePrecision();
-
 
173
			InterneValeur precisionValeur = precisionStore.findModel("nom", precisionNom);
-
 
174
			if (precisionValeur != null) {
-
 
175
				precision = precisionValeur.getAbr();
-
 
176
			}
-
 
177
		}
-
 
178
		return precision;
-
 
179
	}
-
 
180
	
-
 
181
	private ComboBox<InterneValeur> getChampPrecision() {
-
 
182
		ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
-
 
183
		precisionCombo.setForceSelection(true);
-
 
184
		precisionCombo.setTriggerAction(TriggerAction.ALL);
-
 
185
		precisionCombo.setDisplayField("nom");
-
 
186
		precisionCombo.setStore(precisionStore);
-
 
187
		precisionCombo.setEditable(false);
-
 
188
		return precisionCombo;
-
 
189
	}
-
 
190
	
-
 
191
	/**
-
 
192
	* La classe NumberField est sujette à un bug qui empeche son 
-
 
193
	* édition dans firefox, il faut donc la surcharger
-
 
194
	**/
-
 
195
	private NumberField creerChampNombre() {
-
 
196
		ChampNombre champNombre = new ChampNombre();	
-
 
197
		return champNombre;
-
 
198
	}
-
 
199
		
-
 
200
	private ContentPanel creerUniteRangement() {
-
 
201
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
-
 
202
		
-
 
203
		uniteRangementGrille  = creerGrilleUniteRangement();
-
 
204
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement", null);
-
 
205
		panneauGrille.add(uniteRangementGrille);
-
 
206
		
-
 
207
		ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
-
 
208
		panneauGrille.setTopComponent(barreOutils);
-
 
209
		
-
 
210
		return panneauGrille;
-
 
211
	}
-
 
212
	
-
 
213
	private ContentPanel creerPanneauContenantGrille(String titre) {
-
 
214
		ContentPanel panneau = new ContentPanel();
-
 
215
		panneau.setHeadingHtml(titre);
-
 
216
		panneau.setIcon(Images.ICONES.table());
-
 
217
		panneau.setLayout(new FitLayout());
-
 
218
		panneau.setFrame(true);
-
 
219
		panneau.setSize(800, 200);
-
 
220
		panneau.setScrollMode(Scroll.NONE);
-
 
221
		panneau.setCollapsible(true);
-
 
222
		panneau.setStyleAttribute("margin", "5px 0");
-
 
223
		
-
 
224
		return panneau;
-
 
225
	}
-
 
226
	
-
 
227
	private EditorGrid<UniteRangement> creerGrilleUniteRangement() {
-
 
228
		ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
-
 
229
		
-
 
230
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
-
 
231
		colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
-
 
232
		
-
 
233
		NumberField champNombre = creerChampNombre();
-
 
234
		champNombre.setFormat(NumberFormat.getFormat("#"));
-
 
235
		ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
-
 
236
		nombreColonne.setEditor(new CellEditor(champNombre));
-
 
237
		nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
-
 
238
		colonnes.add(nombreColonne);
-
 
239
				
-
 
240
		CellEditor editeurPrecision = new CellEditor(getChampPrecision()) {  
-
 
241
			@Override  
-
 
242
			public Object preProcessValue(Object valeur) {  
-
 
243
				InterneValeur retour = null;
-
 
244
				if (valeur != null ) {
-
 
245
					if (precisionStore.findModel("nom", valeur.toString()) != null) {
-
 
246
						retour = precisionStore.findModel("nom", valeur.toString());
-
 
247
					} else if (precisionStore.findModel("abr", valeur.toString()) != null) {
-
 
248
						retour = precisionStore.findModel("abr", valeur.toString());
-
 
249
					}
-
 
250
				}
-
 
251
				return retour;
-
 
252
			}  
-
 
253
 
-
 
254
			@Override  
-
 
255
			public Object postProcessValue(Object valeur) {  
-
 
256
				String retour = null;
-
 
257
				if (valeur != null ) {
-
 
258
					if (valeur instanceof InterneValeur) {
-
 
259
						InterneValeur valeurInterne = (InterneValeur) valeur;
-
 
260
						retour = valeurInterne.getNom();
-
 
261
					}
-
 
262
				}
-
 
263
				return retour;  
-
 
264
			}
-
 
265
		};
-
 
266
		
-
 
267
		ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
-
 
268
		precisionColonne.setEditor(editeurPrecision);
-
 
269
		colonnes.add(precisionColonne);
-
 
270
		
-
 
271
		TextField<String> formatChp = new TextField<String>();
-
 
272
		ColumnConfig formatColonne =  new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
-
 
273
		formatColonne.setEditor(new CellEditor(formatChp));
-
 
274
		colonnes.add(formatColonne);
-
 
275
		
-
 
276
		GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
-
 
277
		ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
-
 
278
		
-
 
279
		AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
-
 
280
		total.setHtml("type", i18nC.total());
-
 
281
		total.setSummaryType("nombre", SummaryType.SUM);
-
 
282
		total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
-
 
283
		modeleDeColonnes.addAggregationRow(total);
-
 
284
		
-
 
285
		EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
-
 
286
		grilleUniteRangement.setHeight(300);
-
 
287
		grilleUniteRangement.setBorders(true);
-
 
288
		grilleUniteRangement.setSelectionModel(modeleDeSelection);
-
 
289
		grilleUniteRangement.getView().setForceFit(true);
-
 
290
		grilleUniteRangement.getView().setAutoFill(true);
-
 
291
		grilleUniteRangement.setAutoExpandColumn("type");
-
 
292
		grilleUniteRangement.setStripeRows(true);
-
 
293
		grilleUniteRangement.setTrackMouseOver(true);
-
 
294
		
-
 
295
		return grilleUniteRangement;
-
 
296
	}
-
 
297
	
-
 
298
	private String collecterGrilleUniteRangement() {
-
 
299
		String truk = "";
-
 
300
		int nbreUnite = uniteRangementGrille.getStore().getCount();
-
 
301
		for (int i = 0; i < nbreUnite; i++) {
-
 
302
			UniteRangement unite = uniteRangementGrille.getStore().getAt(i);
-
 
303
			if (unite.getTypeAutre()) {
-
 
304
				truk += unite.getType();
-
 
305
			} else {
-
 
306
				truk += unite.getId();
-
 
307
			}
-
 
308
			truk += aDonnee.SEPARATEUR_TYPE_VALEUR;
-
 
309
			truk += UtilNombre.formaterEnEntier(unite.getNombre())+aDonnee.SEPARATEUR_DONNEES;
-
 
310
			truk += getPrecisionAbr(unite.getPrecision())+aDonnee.SEPARATEUR_DONNEES;
-
 
311
			truk += unite.getFormat();
-
 
312
			truk += (i == (nbreUnite - 1)) ? "" : aDonnee.SEPARATEUR_VALEURS;
-
 
313
			
-
 
314
			if (truk.matches("^"+aDonnee.SEPARATEUR_DONNEES)) {
-
 
315
				truk = truk.replaceFirst("^"+aDonnee.SEPARATEUR_DONNEES, "");
-
 
316
			}
-
 
317
			
-
 
318
			if (truk.matches("^"+aDonnee.SEPARATEUR_TYPE_VALEUR)) {
-
 
319
				truk = truk.replaceFirst("^"+aDonnee.SEPARATEUR_TYPE_VALEUR, "");
-
 
320
			}
-
 
321
		}
-
 
322
		return truk;
-
 
323
	}
-
 
324
	
-
 
325
	private void peuplerGrilleUniteRangement(String valeurTruk) {
-
 
326
		if (!UtilString.isEmpty(valeurTruk)) {
-
 
327
			HashMap<String,UniteRangement> unitesEnregistrees = parserValeurUniteRangement(valeurTruk);
-
 
328
			
-
 
329
			ArrayList<UniteRangement> listeUniteMaj = new ArrayList<UniteRangement>();
-
 
330
			int nbreUnite = uniteRangementGrille.getStore().getCount();
-
 
331
			for (int i = 0; i < nbreUnite; i++) {
-
 
332
				UniteRangement uniteDansGrille = uniteRangementGrille.getStore().getAt(i);
-
 
333
				UniteRangement uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
-
 
334
				
-
 
335
				if (uniteEnregistree != null) {
-
 
336
					uniteEnregistree.setType(uniteDansGrille.getType());
-
 
337
					listeUniteMaj.add(uniteEnregistree);
-
 
338
				} else {
-
 
339
					listeUniteMaj.add(uniteDansGrille);
-
 
340
				}
-
 
341
			}
-
 
342
			
-
 
343
			Iterator<String> it = unitesEnregistrees.keySet().iterator();
-
 
344
			while (it.hasNext()) {
-
 
345
				String cle = it.next();
-
 
346
				if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+"[a-zA-Z0-9]+")) {
-
 
347
					UniteRangement uniteAutreEnregistree = unitesEnregistrees.get(cle);
-
 
348
					listeUniteMaj.add(uniteAutreEnregistree);
-
 
349
				}
-
 
350
			}
-
 
351
			
-
 
352
			uniteRangementGrille.getStore().removeAll();
-
 
353
			uniteRangementGrille.getStore().add(listeUniteMaj);
-
 
354
			layout();
-
 
355
		}
-
 
356
	}
-
 
357
	
-
 
358
	public static HashMap<String,UniteRangement> parserValeurUniteRangement(String valeurTruk) {
-
 
359
		HashMap<String,UniteRangement> unitesEnregistrees = new HashMap<String,UniteRangement>(); 
-
 
360
		if (!UtilString.isEmpty(valeurTruk)) {
-
 
361
			String[] unites = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
-
 
362
			for (int i = 0; i < unites.length; i++) {
-
 
363
				String[] uniteTypeIdDonnees = unites[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
-
 
364
				String uniteChaineDonnees = uniteTypeIdDonnees[1];
-
 
365
				String[] uniteDonnees = uniteChaineDonnees.split(Pattern.quote(aDonnee.SEPARATEUR_DONNEES));
-
 
366
				
-
 
367
				UniteRangement uniteRangement = new UniteRangement();
-
 
368
				if (uniteDonnees.length > 0) {
-
 
369
					uniteRangement.setNombre(UtilString.formaterEnEntier(uniteDonnees[0]));
-
 
370
				}
-
 
371
				if (uniteDonnees.length > 1) {
-
 
372
					uniteRangement.setPrecision(getPrecisionNom(uniteDonnees[1]));
-
 
373
				}
-
 
374
				if (uniteDonnees.length > 2) {
-
 
375
					uniteRangement.setFormat(uniteDonnees[2]);
-
 
376
				}
-
 
377
				
-
 
378
				if (uniteTypeIdDonnees[0].matches("[0-9]+")) {
-
 
379
					uniteRangement.setId(uniteTypeIdDonnees[0]);
-
 
380
					uniteRangement.setTypeAutre(false);
-
 
381
					unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteRangement);
-
 
382
				} else {					
-
 
383
					uniteRangement.setType(uniteTypeIdDonnees[0]);
-
 
384
					uniteRangement.setTypeAutre(true);
-
 
385
					String id = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0]+"-"+i;
-
 
386
					uniteRangement.setId(id);
-
 
387
					unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0], uniteRangement);
-
 
388
				}
-
 
389
			}
-
 
390
		}
-
 
391
		return unitesEnregistrees;
-
 
392
	}
-
 
393
	
-
 
394
	private ToolBar creerBarreOutilsGrilleUniteRangement() {
-
 
395
		ToolBar barreOutils = new ToolBar();  
-
 
396
		
-
 
397
		Button ajouterBouton = creerBoutonAjouterUniteRangement();
-
 
398
		barreOutils.add(ajouterBouton);
-
 
399
		
-
 
400
		barreOutils.add(new SeparatorToolItem());
-
 
401
		
-
 
402
		Button supprimerBouton = creerBoutonSupprimerUniteRangement();
-
 
403
		barreOutils.add(supprimerBouton);
-
 
404
 
-
 
405
		return barreOutils;
-
 
406
	}
-
 
407
	
-
 
408
	private Button creerBoutonAjouterUniteRangement() {
-
 
409
		Button bouton = new Button(i18nC.ajouter());
-
 
410
		bouton.setIcon(Images.ICONES.ajouter());
-
 
411
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
-
 
412
			@Override
-
 
413
			public void componentSelected(ButtonEvent ce) {
-
 
414
				final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
-
 
415
					box.addCallback(new Listener<MessageBoxEvent>() {
-
 
416
					public void handleEvent(MessageBoxEvent be) {
-
 
417
						if (!UtilString.isEmpty(be.getValue()) && !be.getValue().matches("[0-9]+")) {
-
 
418
							final UniteRangement unite = new UniteRangement();
-
 
419
							unite.setType(be.getValue());
-
 
420
							unite.setTypeAutre(true);
-
 
421
							uniteRangementGrille.getStore().add(unite);
-
 
422
						} else {
-
 
423
							InfoLogger.display("Information", "Vous ne pouvez pas saisir de valeur vide ou numérique");
-
 
424
						}
-
 
425
					}
-
 
426
				});
-
 
427
			}
-
 
428
		});
-
 
429
		return bouton;
-
 
430
	}
-
 
431
	
-
 
432
	private Button creerBoutonSupprimerUniteRangement() {
-
 
433
		Button bouton = new Button(i18nC.supprimer());
-
 
434
		bouton.setIcon(Images.ICONES.supprimer());
-
 
435
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {  
-
 
436
			@Override
-
 
437
			public void componentSelected(ButtonEvent ce) {
-
 
438
				UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
-
 
439
				if (uniteRangementSelectionnee == null) {
-
 
440
					InfoLogger.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
-
 
441
				} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
-
 
442
					InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
-
 
443
				} else {
-
 
444
					uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
-
 
445
				}
-
 
446
			}   
-
 
447
		});
-
 
448
		return bouton;
-
 
449
	}
-
 
450
	
130
		
451
	private void creerFieldsetConservation() {
131
	private void creerFieldsetConservation() {
452
		FieldSet conservationFieldSet = new FieldSet();
132
		FieldSet conservationFieldSet = new FieldSet();
453
		conservationFieldSet.setHeadingHtml(i18nC.collectionTitreConservation());
133
		conservationFieldSet.setHeadingHtml(i18nC.collectionTitreConservation());
454
		conservationFieldSet.setCollapsible(true);
134
		conservationFieldSet.setCollapsible(true);
455
		conservationFieldSet.collapse();
135
		conservationFieldSet.collapse();
456
		conservationFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
136
		conservationFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
457
		
137
		
458
		typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
138
		typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
459
		conservationFieldSet.add(typePapierConservationChp);
139
		conservationFieldSet.add(typePapierConservationChp);
460
		
140
		
461
		methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
141
		methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
462
		conservationFieldSet.add(methodeConservationChp);
142
		conservationFieldSet.add(methodeConservationChp);
463
		
143
		
464
		this.add(conservationFieldSet);
144
		this.add(conservationFieldSet);
465
	}
145
	}
466
	
146
	
467
	private void creerFieldsetEtiquette() {
147
	private void creerFieldsetEtiquette() {
468
		FieldSet etiquetteFieldSet = new FieldSet();
148
		FieldSet etiquetteFieldSet = new FieldSet();
469
		etiquetteFieldSet.setHeadingHtml(i18nC.collectionTitreEtiquette());
149
		etiquetteFieldSet.setHeadingHtml(i18nC.collectionTitreEtiquette());
470
		etiquetteFieldSet.setCollapsible(true);
150
		etiquetteFieldSet.setCollapsible(true);
471
		etiquetteFieldSet.collapse();
151
		etiquetteFieldSet.collapse();
472
		etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
152
		etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
473
		
153
		
474
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
154
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
475
		etiquetteFieldSet.add(fixationPoucentLabel);
155
		etiquetteFieldSet.add(fixationPoucentLabel);
476
		
156
		
477
		specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
157
		specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
478
		etiquetteFieldSet.add(specimenFixationPourcentChp, new FormData(200, 0));
158
		etiquetteFieldSet.add(specimenFixationPourcentChp, new FormData(200, 0));
479
		
159
		
480
		etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
160
		etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
481
		etiquetteFieldSet.add(etiquetteFixationPourcentChp, new FormData(200, 0));
161
		etiquetteFieldSet.add(etiquetteFixationPourcentChp, new FormData(200, 0));
482
		
162
		
483
		specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
163
		specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
484
		etiquetteFieldSet.add(specimentMethodeFixationChp);
164
		etiquetteFieldSet.add(specimentMethodeFixationChp);
485
		
165
		
486
		etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
166
		etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
487
		etiquetteFieldSet.add(etiquetteMethodeFixationSurSupportChp);
167
		etiquetteFieldSet.add(etiquetteMethodeFixationSurSupportChp);
488
		
168
		
489
		etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
169
		etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
490
		etiquetteFieldSet.add(etiquetteMethodeFixationSurSpecimenChp);
170
		etiquetteFieldSet.add(etiquetteMethodeFixationSurSpecimenChp);
491
		
171
		
492
		typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
172
		typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
493
		etiquetteFieldSet.add(typeEcritureChp);
173
		etiquetteFieldSet.add(typeEcritureChp);
494
		
174
		
495
		this.add(etiquetteFieldSet);
175
		this.add(etiquetteFieldSet);
496
	}
176
	}
497
	
177
	
498
	private void creerFieldsetTraitement() {
178
	private void creerFieldsetTraitement() {
499
		FieldSet traitementFieldSet = new FieldSet();
179
		FieldSet traitementFieldSet = new FieldSet();
500
		traitementFieldSet.setHeadingHtml(i18nC.collectionTitreTraitement());
180
		traitementFieldSet.setHeadingHtml(i18nC.collectionTitreTraitement());
501
		traitementFieldSet.setCollapsible(true);
181
		traitementFieldSet.setCollapsible(true);
502
		traitementFieldSet.collapse();
182
		traitementFieldSet.collapse();
503
		traitementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
183
		traitementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
504
		
184
		
505
		traitementCombo  = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
185
		traitementCombo  = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
506
		traitementCombo.setTrie("id_valeur");
186
		traitementCombo.setTrie("id_valeur");
507
		traitementFieldSet.add(traitementCombo, new FormData(300, 0));
187
		traitementFieldSet.add(traitementCombo, new FormData(300, 0));
508
		
188
		
509
		poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
189
		poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
510
		traitementFieldSet.add(poisonTraitementChp);
190
		traitementFieldSet.add(poisonTraitementChp);
511
		
191
		
512
		insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
192
		insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
513
		traitementFieldSet.add(insecteTraitementChp);
193
		traitementFieldSet.add(insecteTraitementChp);
514
 
194
 
515
		this.add(traitementFieldSet);
195
		this.add(traitementFieldSet);
516
	}
196
	}
517
	
197
	
518
	private void creerFieldsetTypesUniteEtat() {
198
	private void creerFieldsetTypesUniteEtat() {
519
		FieldSet etatTypesUniteFieldSet = new FieldSet();
199
		FieldSet etatTypesUniteFieldSet = new FieldSet();
520
		// Etat général et nombre d'échantillons (à changer dans l'i18n
200
		// Etat général et nombre d'échantillons (à changer dans l'i18n
521
		etatTypesUniteFieldSet.setHeadingHtml(i18nC.collectionEtatGeneralEtNombreEchantillons());
201
		etatTypesUniteFieldSet.setHeadingHtml(i18nC.collectionEtatGeneralEtNombreEchantillons());
522
		etatTypesUniteFieldSet.setCollapsible(true);
202
		etatTypesUniteFieldSet.setCollapsible(true);
523
		etatTypesUniteFieldSet.collapse();
203
		etatTypesUniteFieldSet.collapse();
524
		etatTypesUniteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
204
		etatTypesUniteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
525
		
205
		
526
		etatUniteRangementCombo = new ChampComboBoxListeValeurs(i18nC.collectionUniteRangementEtatGeneral(), "etat");
206
		etatUniteRangementCombo = new ChampComboBoxListeValeurs(i18nC.collectionUniteRangementEtatGeneral(), "etat");
527
		etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
207
		etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
528
		etatUniteRangementCombo.setTrie("id_valeur");
208
		etatUniteRangementCombo.setTrie("id_valeur");
529
		etatUniteRangementCombo.setWidth(300);
209
		etatUniteRangementCombo.setWidth(300);
530
		etatTypesUniteFieldSet.add(etatUniteRangementCombo);
210
		etatTypesUniteFieldSet.add(etatUniteRangementCombo);
-
 
211
		
-
 
212
		// Liasses et cartons d'herbier
-
 
213
		Label labelcartonsHerbiersFormat = new Label(i18nC.collectionCartonsHerbiers());
-
 
214
		labelcartonsHerbiersFormat.setStyleName("labelChampNombreFormat");
-
 
215
		
-
 
216
		nbCartonsHerbier = new ChampNombre();
-
 
217
		nbCartonsHerbier.setStyleName("champNombreFormat");
-
 
218
		nbCartonsHerbier.setWidth(55);
-
 
219
		nbCartonsHerbier.setEmptyText(i18nC.collectionUniteNbre());
-
 
220
		
-
 
221
		cartonsHerbierFormat = new TextField<String>();
-
 
222
		cartonsHerbierFormat.setStyleName("champNombreFormat");
-
 
223
		cartonsHerbierFormat.setEmptyText(i18nC.collectionUniteFormat());
-
 
224
		
-
 
225
		HorizontalPanel conteneurCartonsHerbiers = new HorizontalPanel();
-
 
226
		conteneurCartonsHerbiers.setBorderWidth(0);
-
 
227
		
-
 
228
		conteneurCartonsHerbiers.add(labelcartonsHerbiersFormat);
-
 
229
		conteneurCartonsHerbiers.add(nbCartonsHerbier);
-
 
230
		conteneurCartonsHerbiers.add(cartonsHerbierFormat);
-
 
231
		
-
 
232
		etatTypesUniteFieldSet.add(conteneurCartonsHerbiers);
-
 
233
		
-
 
234
		Label labelLiasses = new Label(i18nC.collectionLiasses());
-
 
235
		labelLiasses.setStyleName("labelChampNombreFormat");
-
 
236
		
-
 
237
		nbLiasses = new ChampNombre();
-
 
238
		nbLiasses.setStyleName("champNombreFormat");
-
 
239
		nbLiasses.setWidth(55);
-
 
240
		nbLiasses.setEmptyText(i18nC.collectionUniteNbre());
-
 
241
		
-
 
242
		liassesFormat = new TextField<String>();
-
 
243
		liassesFormat.setStyleName("champNombreFormat");
-
 
244
		liassesFormat.setEmptyText(i18nC.collectionUniteFormat());
-
 
245
		
-
 
246
		HorizontalPanel conteneurLiasses = new HorizontalPanel();
-
 
247
		conteneurLiasses.setBorderWidth(0);
-
 
248
		
-
 
249
		conteneurLiasses.add(labelLiasses);
-
 
250
		conteneurLiasses.add(nbLiasses);
-
 
251
		conteneurLiasses.add(liassesFormat);
-
 
252
		
-
 
253
		etatTypesUniteFieldSet.add(conteneurLiasses);
-
 
254
		
-
 
255
		autresUnitesRangement = new TextArea();
-
 
256
		autresUnitesRangement.setStyleName("textAreaAutreUniteRangement");
-
 
257
		autresUnitesRangement.setHeight(90);
-
 
258
		autresUnitesRangement.setFieldLabel(i18nC.collectionAutreUnitesRangement());
531
		
259
		
532
		etatTypesUniteFieldSet.add(creerUniteRangement());
260
		etatTypesUniteFieldSet.add(autresUnitesRangement);
533
				
261
		
534
		planchesHerbier = new ChampNombre();
262
		planchesHerbier = new ChampNombre();
535
		planchesHerbier.setFieldLabel(i18nC.collectionNbPlanchesHerbier());
263
		planchesHerbier.setFieldLabel(i18nC.collectionNbPlanchesHerbier());
536
		
264
		
537
		nbEspeces = new ChampNombre();
265
		nbEspeces = new ChampNombre();
538
		nbEspeces.setFieldLabel(i18nC.collectionNbEspeces());
266
		nbEspeces.setFieldLabel(i18nC.collectionNbEspeces());
539
		
267
		
540
		etatTypesUniteFieldSet.add(planchesHerbier);
268
		etatTypesUniteFieldSet.add(planchesHerbier);
541
		etatTypesUniteFieldSet.add(nbEspeces);
269
		etatTypesUniteFieldSet.add(nbEspeces);
542
		
270
		
543
		add(etatTypesUniteFieldSet);
271
		add(etatTypesUniteFieldSet);
544
		
272
		
545
		etatGeneralCombo = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
273
		etatGeneralCombo = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
546
		etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
274
		etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
547
		etatGeneralCombo.setTrie("id_valeur");
275
		etatGeneralCombo.setTrie("id_valeur");
548
		etatTypesUniteFieldSet.add(etatGeneralCombo, new FormData(300, 0));
276
		etatTypesUniteFieldSet.add(etatGeneralCombo, new FormData(300, 0));
549
		
277
		
550
		specimenDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationSpecimen(), 150, true);
278
		specimenDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationSpecimen(), 150, true);
551
		specimenDegradationChp.initialiserType("specimenDegradation");
279
		specimenDegradationChp.initialiserType("specimenDegradation");
552
		specimenDegradationChp.initialiserCombobox("niveauImportance");
280
		specimenDegradationChp.initialiserCombobox("niveauImportance");
553
		etatTypesUniteFieldSet.add(specimenDegradationChp);
281
		etatTypesUniteFieldSet.add(specimenDegradationChp);
554
		
282
		
555
		labelPresentationDegradationChp = new Text();
283
		labelPresentationDegradationChp = new Text();
556
		labelPresentationDegradationChp.setWidth("95%");
284
		labelPresentationDegradationChp.setWidth("95%");
557
		labelPresentationDegradationChp.setVisible(false);
285
		labelPresentationDegradationChp.setVisible(false);
558
		
286
		
559
		presentationDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationPresentation(), 150, 200, true);
287
		presentationDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationPresentation(), 150, 200, true);
560
		presentationDegradationChp.initialiserType("supportDegradation");
288
		presentationDegradationChp.initialiserType("supportDegradation");
561
		presentationDegradationChp.initialiserCombobox("niveauImportance");
289
		presentationDegradationChp.initialiserCombobox("niveauImportance");
562
		
290
		
563
		presentationDegradationChp.getTypes().addListener(Events.Select,
291
		presentationDegradationChp.getTypes().addListener(Events.Select,
564
			new Listener<FieldEvent>() {
292
			new Listener<FieldEvent>() {
565
				public void handleEvent(FieldEvent be) {
293
				public void handleEvent(FieldEvent be) {
566
					if (((Valeur)(be.getField().getValue())).get("id_valeur").equals("2310")) {
294
					if (((Valeur)(be.getField().getValue())).get("id_valeur").equals("2310")) {
567
						labelPresentationDegradationChp.setText(i18nC.degradationPresentationLabel());
295
						labelPresentationDegradationChp.setText(i18nC.degradationPresentationLabel());
568
						labelPresentationDegradationChp.setVisible(true);
296
						labelPresentationDegradationChp.setVisible(true);
569
					}
297
					}
570
					else {
298
					else {
571
						labelPresentationDegradationChp.setText("");
299
						labelPresentationDegradationChp.setText("");
572
						labelPresentationDegradationChp.setVisible(false);						
300
						labelPresentationDegradationChp.setVisible(false);						
573
					}
301
					}
574
				}		
302
				}		
575
			});
303
			});
576
		etatTypesUniteFieldSet.add(presentationDegradationChp);
304
		etatTypesUniteFieldSet.add(presentationDegradationChp);
577
		etatTypesUniteFieldSet.add(labelPresentationDegradationChp);
305
		etatTypesUniteFieldSet.add(labelPresentationDegradationChp);
578
		
306
		
579
		determinationCombo = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
307
		determinationCombo = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
580
		determinationCombo.setTrie("id_valeur");
308
		determinationCombo.setTrie("id_valeur");
581
		etatTypesUniteFieldSet.add(determinationCombo, new FormData(450, 0));
309
		etatTypesUniteFieldSet.add(determinationCombo, new FormData(450, 0));
582
		
310
		
583
		this.add(etatTypesUniteFieldSet);
311
		this.add(etatTypesUniteFieldSet);
584
	}
312
	}
585
	
313
	
586
	public void peupler() {
314
	public void peupler() {
587
		initialiserCollection();
315
		initialiserCollection();
588
		if (collectionBotanique != null) {
316
		if (collectionBotanique != null) {
589
			typesCollectionBotaCombo.peupler(collectionBotanique.getType());
317
			typesCollectionBotaCombo.peupler(collectionBotanique.getType());
590
			if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
318
			if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
591
				nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
319
				nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
592
			}
320
			}
-
 
321
			
-
 
322
			if(!collectionBotanique.getNbCartonsHerbiers().isEmpty()) {
-
 
323
				nbCartonsHerbier.setValue((Integer.parseInt(collectionBotanique.getNbCartonsHerbiers())));
-
 
324
			}
-
 
325
			cartonsHerbierFormat.setValue(collectionBotanique.getFormatCartonsHerbiers());
-
 
326
			
-
 
327
			if(!collectionBotanique.getNbLiasses().isEmpty()) {
-
 
328
				nbLiasses.setValue((Integer.parseInt(collectionBotanique.getNbLiasses())));
-
 
329
			}
-
 
330
			liassesFormat.setValue(collectionBotanique.getFormatLiasses());
593
			
331
			
-
 
332
			autresUnitesRangement.setValue(collectionBotanique.getAutresUnitesRangement());
594
			peuplerGrilleUniteRangement(collectionBotanique.getUniteRangement());
333
 
595
			etatUniteRangementCombo.peupler(collectionBotanique.getUniteRangementEtat());
334
			etatUniteRangementCombo.peupler(collectionBotanique.getUniteRangementEtat());
596
			
335
			
597
			
336
			
598
			if(!collectionBotanique.getNbPlanchesHerbiers().isEmpty()) {
337
			if(!collectionBotanique.getNbPlanchesHerbiers().isEmpty()) {
599
				planchesHerbier.setValue((Integer.parseInt(collectionBotanique.getNbPlanchesHerbiers())));
338
				planchesHerbier.setValue((Integer.parseInt(collectionBotanique.getNbPlanchesHerbiers())));
600
			}
339
			}
601
			
340
			
602
			if(!collectionBotanique.getNbEspeces().isEmpty()) {
341
			if(!collectionBotanique.getNbEspeces().isEmpty()) {
603
				nbEspeces.setValue((Integer.parseInt(collectionBotanique.getNbEspeces())));
342
				nbEspeces.setValue((Integer.parseInt(collectionBotanique.getNbEspeces())));
604
			}
343
			}
605
			
344
			
606
			typePapierConservationChp.peupler(collectionBotanique.getConservationPapierType());
345
			typePapierConservationChp.peupler(collectionBotanique.getConservationPapierType());
607
			methodeConservationChp.peupler(collectionBotanique.getConservationMethode());
346
			methodeConservationChp.peupler(collectionBotanique.getConservationMethode());
608
			
347
			
609
			specimenFixationPourcentChp.peupler(collectionBotanique.getSpecimenFixationPourcent());
348
			specimenFixationPourcentChp.peupler(collectionBotanique.getSpecimenFixationPourcent());
610
			etiquetteFixationPourcentChp.peupler(collectionBotanique.getEtiquetteFixationPourcent());
349
			etiquetteFixationPourcentChp.peupler(collectionBotanique.getEtiquetteFixationPourcent());
611
			specimentMethodeFixationChp.peupler(collectionBotanique.getSpecimenFixationMethode());
350
			specimentMethodeFixationChp.peupler(collectionBotanique.getSpecimenFixationMethode());
612
			etiquetteMethodeFixationSurSupportChp.peupler(collectionBotanique.getEtiquetteFixationSupport());
351
			etiquetteMethodeFixationSurSupportChp.peupler(collectionBotanique.getEtiquetteFixationSupport());
613
			etiquetteMethodeFixationSurSpecimenChp.peupler(collectionBotanique.getEtiquetteFixationSpecimen());
352
			etiquetteMethodeFixationSurSpecimenChp.peupler(collectionBotanique.getEtiquetteFixationSpecimen());
614
			typeEcritureChp.peupler(collectionBotanique.getEtiquetteEcriture());
353
			typeEcritureChp.peupler(collectionBotanique.getEtiquetteEcriture());
615
			
354
			
616
			traitementCombo.peupler(collectionBotanique.getTraitement());
355
			traitementCombo.peupler(collectionBotanique.getTraitement());
617
			poisonTraitementChp.peupler(collectionBotanique.getTraitementPoison());
356
			poisonTraitementChp.peupler(collectionBotanique.getTraitementPoison());
618
			insecteTraitementChp.peupler(collectionBotanique.getTraitementInsecte());
357
			insecteTraitementChp.peupler(collectionBotanique.getTraitementInsecte());
619
			
358
			
620
			etatGeneralCombo.peupler(collectionBotanique.getEtatGeneral());
359
			etatGeneralCombo.peupler(collectionBotanique.getEtatGeneral());
621
			specimenDegradationChp.peupler(collectionBotanique.getDegradationSpecimen());
360
			specimenDegradationChp.peupler(collectionBotanique.getDegradationSpecimen());
622
			presentationDegradationChp.peupler(collectionBotanique.getDegradationPresentation());
361
			presentationDegradationChp.peupler(collectionBotanique.getDegradationPresentation());
623
			determinationCombo.peupler(collectionBotanique.getDetermination());
362
			determinationCombo.peupler(collectionBotanique.getDetermination());
624
		}		
363
		}		
625
	}
364
	}
626
	
365
	
627
	public void collecter() {
366
	public void collecter() {
628
		initialiserCollection();
367
		initialiserCollection();
629
		if (etreAccede()) {
368
		if (etreAccede()) {
630
			collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
369
			collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
631
			if (nbreEchantillonChp.getValue() != null) {
370
			if (nbreEchantillonChp.getValue() != null) {
632
				collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
371
				collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
633
			}
372
			}
-
 
373
			
-
 
374
			collectionBotaniqueCollectee.setNbCartonsHerbiers(nbCartonsHerbier.getValue()+"");
-
 
375
			collectionBotaniqueCollectee.setFormatCartonsHerbiers(cartonsHerbierFormat.getValue());
-
 
376
			collectionBotaniqueCollectee.setNbLiasses(nbLiasses.getValue()+"");
634
			
377
			collectionBotaniqueCollectee.setFormatLiasses(liassesFormat.getValue());
-
 
378
			collectionBotaniqueCollectee.setAutresUnitesRangement(autresUnitesRangement.getValue());
635
			collectionBotaniqueCollectee.setUniteRangement(collecterGrilleUniteRangement());
379
			
636
			collectionBotaniqueCollectee.setUniteRangementEtat(etatUniteRangementCombo.getValeur());
380
			collectionBotaniqueCollectee.setUniteRangementEtat(etatUniteRangementCombo.getValeur());
637
			
381
			
638
			collectionBotaniqueCollectee.setNbPlanchesHerbiers(planchesHerbier.getValue()+"");
382
			collectionBotaniqueCollectee.setNbPlanchesHerbiers(planchesHerbier.getValue()+"");
639
			collectionBotaniqueCollectee.setNbEspeces(nbEspeces.getValue()+"");
383
			collectionBotaniqueCollectee.setNbEspeces(nbEspeces.getValue()+"");
640
			
384
			
641
			collectionBotaniqueCollectee.setConservationPapierType(typePapierConservationChp.getValeur());
385
			collectionBotaniqueCollectee.setConservationPapierType(typePapierConservationChp.getValeur());
642
			collectionBotaniqueCollectee.setConservationMethode(methodeConservationChp.getValeur());
386
			collectionBotaniqueCollectee.setConservationMethode(methodeConservationChp.getValeur());
643
			
387
			
644
			collectionBotaniqueCollectee.setSpecimenFixationPourcent(specimenFixationPourcentChp.getValeur());
388
			collectionBotaniqueCollectee.setSpecimenFixationPourcent(specimenFixationPourcentChp.getValeur());
645
			collectionBotaniqueCollectee.setEtiquetteFixationPourcent(etiquetteFixationPourcentChp.getValeur());
389
			collectionBotaniqueCollectee.setEtiquetteFixationPourcent(etiquetteFixationPourcentChp.getValeur());
646
			collectionBotaniqueCollectee.setSpecimenFixationMethode(specimentMethodeFixationChp.getValeur());
390
			collectionBotaniqueCollectee.setSpecimenFixationMethode(specimentMethodeFixationChp.getValeur());
647
			collectionBotaniqueCollectee.setEtiquetteFixationSupport(etiquetteMethodeFixationSurSupportChp.getValeur());
391
			collectionBotaniqueCollectee.setEtiquetteFixationSupport(etiquetteMethodeFixationSurSupportChp.getValeur());
648
			collectionBotaniqueCollectee.setEtiquetteFixationSpecimen(etiquetteMethodeFixationSurSpecimenChp.getValeur());
392
			collectionBotaniqueCollectee.setEtiquetteFixationSpecimen(etiquetteMethodeFixationSurSpecimenChp.getValeur());
649
			collectionBotaniqueCollectee.setEtiquetteEcriture(typeEcritureChp.getValeur());
393
			collectionBotaniqueCollectee.setEtiquetteEcriture(typeEcritureChp.getValeur());
650
			
394
			
651
			collectionBotaniqueCollectee.setTraitement(traitementCombo.getValeur());
395
			collectionBotaniqueCollectee.setTraitement(traitementCombo.getValeur());
652
			collectionBotaniqueCollectee.setTraitementPoison(poisonTraitementChp.getValeur());
396
			collectionBotaniqueCollectee.setTraitementPoison(poisonTraitementChp.getValeur());
653
			collectionBotaniqueCollectee.setTraitementInsecte(insecteTraitementChp.getValeur());
397
			collectionBotaniqueCollectee.setTraitementInsecte(insecteTraitementChp.getValeur());
654
			
398
			
655
			collectionBotaniqueCollectee.setEtatGeneral(etatGeneralCombo.getValeur());
399
			collectionBotaniqueCollectee.setEtatGeneral(etatGeneralCombo.getValeur());
656
			collectionBotaniqueCollectee.setDegradationSpecimen(specimenDegradationChp.getValeurs());
400
			collectionBotaniqueCollectee.setDegradationSpecimen(specimenDegradationChp.getValeurs());
657
			collectionBotaniqueCollectee.setDegradationPresentation(presentationDegradationChp.getValeurs());
401
			collectionBotaniqueCollectee.setDegradationPresentation(presentationDegradationChp.getValeurs());
658
			collectionBotaniqueCollectee.setDetermination(determinationCombo.getValeur());
402
			collectionBotaniqueCollectee.setDetermination(determinationCombo.getValeur());
659
		}
403
		}
660
	}
404
	}
661
 
405
 
662
	private void initialiserCollection() {
406
	private void initialiserCollection() {
663
		collection = ((CollectionForm) formulaire).collection;
407
		collection = ((CollectionForm) formulaire).collection;
664
		if (collection != null) {
408
		if (collection != null) {
665
			collectionBotanique = collection.getBotanique();
409
			collectionBotanique = collection.getBotanique();
666
		}
410
		}
667
		
411
		
668
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
412
		collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
669
		if (collectionCollectee != null) {
413
		if (collectionCollectee != null) {
670
			collectionBotaniqueCollectee = collectionCollectee.getBotanique();
414
			collectionBotaniqueCollectee = collectionCollectee.getBotanique();
671
		}
415
		}
672
	}
416
	}
673
	
417
	
674
	public void rafraichir(Object nouvellesDonnees) {
418
	public void rafraichir(Object nouvellesDonnees) {
675
		if (nouvellesDonnees instanceof ValeurListe) {
419
		if (nouvellesDonnees instanceof ValeurListe) {
676
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
420
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
677
			rafraichirValeurListe(listeValeurs);
421
			rafraichirValeurListe(listeValeurs);
678
		} else {
422
		} else {
679
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
423
			Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
680
		}
424
		}
681
	}
425
	}
682
	
426
	
683
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
427
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
684
		if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
428
		if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
685
			Iterator<String> it = listeValeurs.keySet().iterator();
429
			Iterator<String> it = listeValeurs.keySet().iterator();
686
			while (it.hasNext()) {
430
			while (it.hasNext()) {
687
				Valeur valeur = listeValeurs.get(it.next());
431
				Valeur valeur = listeValeurs.get(it.next());
688
				UniteRangement unite = new UniteRangement();
432
				UniteRangement unite = new UniteRangement();
689
				unite.setId(valeur.getId());
433
				unite.setId(valeur.getId());
690
				unite.setType(valeur.getNom());
434
				unite.setType(valeur.getNom());
691
				unite.setTypeAutre(false);
435
				unite.setTypeAutre(false);
692
				uniteRangementGrille.getStore().add(unite);
436
				uniteRangementGrille.getStore().add(unite);
693
			}
437
			}
694
		} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
438
		} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
695
			Iterator<String> it = listeValeurs.keySet().iterator();
439
			Iterator<String> it = listeValeurs.keySet().iterator();
696
			while (it.hasNext()) {
440
			while (it.hasNext()) {
697
				Valeur valeur = listeValeurs.get(it.next());
441
				Valeur valeur = listeValeurs.get(it.next());
698
				UniteBase unite = new UniteBase();
442
				UniteBase unite = new UniteBase();
699
				unite.setId(valeur.getId());
443
				unite.setId(valeur.getId());
700
				unite.setType(valeur.getNom());
444
				unite.setType(valeur.getNom());
701
				unite.setTypeAutre(false);
445
				unite.setTypeAutre(false);
702
				uniteBaseGrille.getStore().add(unite);
446
				uniteBaseGrille.getStore().add(unite);
703
			}
447
			}
704
		} else {
448
		} else {
705
			Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
449
			Debug.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!");
706
		}
450
		}
707
	}
451
	}
708
}
452
}