Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 854 Rev 857
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Iterator;
4
import java.util.Iterator;
5
import java.util.List;
5
import java.util.List;
6
 
6
 
7
import org.tela_botanica.client.Mediateur;
7
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.composants.ChampCaseACocher;
8
import org.tela_botanica.client.composants.ChampCaseACocher;
9
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
9
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
-
 
10
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
10
import org.tela_botanica.client.images.Images;
11
import org.tela_botanica.client.images.Images;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.modeles.InterneValeur;
13
import org.tela_botanica.client.modeles.InterneValeur;
13
import org.tela_botanica.client.modeles.UniteBase;
14
import org.tela_botanica.client.modeles.UniteBase;
14
import org.tela_botanica.client.modeles.UniteRangement;
15
import org.tela_botanica.client.modeles.UniteRangement;
15
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.Valeur;
16
import org.tela_botanica.client.modeles.ValeurListe;
17
import org.tela_botanica.client.modeles.ValeurListe;
17
 
18
 
18
import com.extjs.gxt.ui.client.event.ButtonEvent;
19
import com.extjs.gxt.ui.client.event.ButtonEvent;
19
import com.extjs.gxt.ui.client.event.Events;
20
import com.extjs.gxt.ui.client.event.Events;
20
import com.extjs.gxt.ui.client.event.Listener;
21
import com.extjs.gxt.ui.client.event.Listener;
21
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
22
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
22
import com.extjs.gxt.ui.client.event.SelectionListener;
23
import com.extjs.gxt.ui.client.event.SelectionListener;
23
import com.extjs.gxt.ui.client.event.SliderEvent;
24
import com.extjs.gxt.ui.client.event.SliderEvent;
24
import com.extjs.gxt.ui.client.store.ListStore;
25
import com.extjs.gxt.ui.client.store.ListStore;
25
import com.extjs.gxt.ui.client.widget.ContentPanel;
26
import com.extjs.gxt.ui.client.widget.ContentPanel;
26
import com.extjs.gxt.ui.client.widget.Info;
27
import com.extjs.gxt.ui.client.widget.Info;
27
import com.extjs.gxt.ui.client.widget.MessageBox;
28
import com.extjs.gxt.ui.client.widget.MessageBox;
28
import com.extjs.gxt.ui.client.widget.Slider;
29
import com.extjs.gxt.ui.client.widget.Slider;
29
import com.extjs.gxt.ui.client.widget.Text;
30
import com.extjs.gxt.ui.client.widget.Text;
30
import com.extjs.gxt.ui.client.widget.button.Button;
31
import com.extjs.gxt.ui.client.widget.button.Button;
31
import com.extjs.gxt.ui.client.widget.form.ComboBox;
32
import com.extjs.gxt.ui.client.widget.form.ComboBox;
32
import com.extjs.gxt.ui.client.widget.form.NumberField;
33
import com.extjs.gxt.ui.client.widget.form.NumberField;
33
import com.extjs.gxt.ui.client.widget.form.SliderField;
34
import com.extjs.gxt.ui.client.widget.form.SliderField;
34
import com.extjs.gxt.ui.client.widget.form.TextField;
35
import com.extjs.gxt.ui.client.widget.form.TextField;
35
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
36
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
36
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
37
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
37
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
38
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
38
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
39
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
39
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
40
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
40
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
41
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
41
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
42
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
42
import com.extjs.gxt.ui.client.widget.grid.Grid;
43
import com.extjs.gxt.ui.client.widget.grid.Grid;
43
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
44
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
44
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
45
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
45
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
46
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
46
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
47
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
47
import com.extjs.gxt.ui.client.widget.layout.FormData;
48
import com.extjs.gxt.ui.client.widget.layout.FormData;
48
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
49
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
49
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
50
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
50
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
51
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
51
import com.google.gwt.core.client.GWT;
52
import com.google.gwt.core.client.GWT;
52
import com.google.gwt.i18n.client.NumberFormat;
53
import com.google.gwt.i18n.client.NumberFormat;
53
 
54
 
54
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
55
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
55
	
56
	
56
	private Grid<UniteRangement> uniteRangementGrille = null;
57
	private Grid<UniteRangement> uniteRangementGrille = null;
57
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
58
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
58
	private Grid<UniteBase> uniteBaseGrille = null;
59
	private Grid<UniteBase> uniteBaseGrille = null;
59
	private ChampCaseACocher typePapierConservationChp = null;
60
	private ChampCaseACocher typePapierConservationChp = null;
60
	private ChampCaseACocher methodeConservationChp = null;
61
	private ChampCaseACocher methodeConservationChp = null;
61
	private SliderField specimenFixationPourcentChp = null;
62
	private SliderField specimenFixationPourcentChp = null;
62
	private SliderField etiquetteFixationPourcentChp = null;
63
	private SliderField etiquetteFixationPourcentChp = null;
63
	private ChampCaseACocher specimentMethodeFixationChp = null;
64
	private ChampCaseACocher specimentMethodeFixationChp = null;
64
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
65
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
65
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
66
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
66
	private ChampCaseACocher typeEcritureChp = null;
67
	private ChampCaseACocher typeEcritureChp = null;
67
	private ChampComboBoxListeValeurs traitementCombo = null;
68
	private ChampComboBoxListeValeurs traitementCombo = null;
68
	private ChampCaseACocher poisonTraitementChp = null;
69
	private ChampCaseACocher poisonTraitementChp = null;
69
	private ChampCaseACocher insecteTraitementChp = null;
70
	private ChampCaseACocher insecteTraitementChp = null;
70
	private ChampComboBoxListeValeurs etatGeneralCombo = null;
71
	private ChampComboBoxListeValeurs etatGeneralCombo = null;
71
	private ChampComboBoxListeValeurs determinationCombo = null;
72
	private ChampComboBoxListeValeurs determinationCombo = null;
-
 
73
	private ChampMultiValeursMultiTypes specimenDegradationChp = null;
-
 
74
	private ChampMultiValeursMultiTypes presentationDegradationChp = null;
72
	
75
	
73
	public CollectionFormDescription(Formulaire formulaireCourrant) {
76
	public CollectionFormDescription(Formulaire formulaireCourrant) {
74
		initialiserOnglet(formulaireCourrant);
77
		initialiserOnglet(formulaireCourrant);
75
		setId("description");
78
		setId("description");
76
		setText(Mediateur.i18nC.collectionDescription());
79
		setText(Mediateur.i18nC.collectionDescription());
77
 
80
 
78
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
81
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
79
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
82
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
80
		formulaireLayout.setLabelWidth(300);
83
		formulaireLayout.setLabelWidth(300);
81
		
84
		
82
		creerUniteRangement();
85
		creerUniteRangement();
83
		creerUniteBase();
86
		creerUniteBase();
84
		
87
		
85
		typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
88
		typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
86
		add(typePapierConservationChp);
89
		add(typePapierConservationChp);
87
		
90
		
88
		methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
91
		methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
89
		add(methodeConservationChp);
92
		add(methodeConservationChp);
90
		
93
		
91
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
94
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
92
		add(fixationPoucentLabel);
95
		add(fixationPoucentLabel);
93
		
96
		
94
		Slider specimenFixationPourcentSlider = creerSliderPoucentage(i18nC.specimenFixationPourcent(), specimenFixationPourcentChp);
97
		Slider specimenFixationPourcentSlider = creerSliderPoucentage(i18nC.specimenFixationPourcent(), specimenFixationPourcentChp);
95
		specimenFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
98
		specimenFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
96
			public void handleEvent(SliderEvent be) {
99
			public void handleEvent(SliderEvent be) {
97
				int pourcent = ((Slider) be.getComponent()).getValue();
100
				int pourcent = ((Slider) be.getComponent()).getValue();
98
				specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent()+" ("+pourcent+"%) ");
101
				specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent()+" ("+pourcent+"%) ");
99
			}
102
			}
100
		});
103
		});
101
		specimenFixationPourcentChp = new SliderField(specimenFixationPourcentSlider);
104
		specimenFixationPourcentChp = new SliderField(specimenFixationPourcentSlider);
102
		specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent());
105
		specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent());
103
		add(specimenFixationPourcentChp, new FormData(200, 0));
106
		add(specimenFixationPourcentChp, new FormData(200, 0));
104
		
107
		
105
		Slider etiquetteFixationPourcentSlider = creerSliderPoucentage(i18nC.etiquetteFixationPourcent(), etiquetteFixationPourcentChp);
108
		Slider etiquetteFixationPourcentSlider = creerSliderPoucentage(i18nC.etiquetteFixationPourcent(), etiquetteFixationPourcentChp);
106
		etiquetteFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
109
		etiquetteFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
107
			public void handleEvent(SliderEvent be) {
110
			public void handleEvent(SliderEvent be) {
108
				int pourcent = ((Slider) be.getComponent()).getValue();
111
				int pourcent = ((Slider) be.getComponent()).getValue();
109
				etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent()+" ("+pourcent+"%) ");
112
				etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent()+" ("+pourcent+"%) ");
110
			}
113
			}
111
		});
114
		});
112
		etiquetteFixationPourcentChp = new SliderField(etiquetteFixationPourcentSlider);
115
		etiquetteFixationPourcentChp = new SliderField(etiquetteFixationPourcentSlider);
113
		etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent());
116
		etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent());
114
		add(etiquetteFixationPourcentChp, new FormData(200, 0));
117
		add(etiquetteFixationPourcentChp, new FormData(200, 0));
115
		
118
		
116
		specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
119
		specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
117
		add(specimentMethodeFixationChp);
120
		add(specimentMethodeFixationChp);
118
		
121
		
119
		etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
122
		etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
120
		add(etiquetteMethodeFixationSurSupportChp);
123
		add(etiquetteMethodeFixationSurSupportChp);
121
		
124
		
122
		etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
125
		etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
123
		add(etiquetteMethodeFixationSurSpecimenChp);
126
		add(etiquetteMethodeFixationSurSpecimenChp);
124
		
127
		
125
		typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
128
		typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
126
		add(typeEcritureChp);
129
		add(typeEcritureChp);
127
		
130
		
128
		traitementCombo  = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
131
		traitementCombo  = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
129
		traitementCombo.setTrie("id_valeur");
132
		traitementCombo.setTrie("id_valeur");
130
		add(traitementCombo, new FormData(300, 0));
133
		add(traitementCombo, new FormData(300, 0));
131
		
134
		
132
		poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
135
		poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
133
		add(poisonTraitementChp);
136
		add(poisonTraitementChp);
134
		
137
		
135
		insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
138
		insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
136
		add(insecteTraitementChp);
139
		add(insecteTraitementChp);
137
		
140
		
138
		etatGeneralCombo   = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
141
		etatGeneralCombo = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
139
		etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
142
		etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
140
		etatGeneralCombo.setTrie("id_valeur");
143
		etatGeneralCombo.setTrie("id_valeur");
141
		add(etatGeneralCombo, new FormData(300, 0));
144
		add(etatGeneralCombo, new FormData(300, 0));
-
 
145
		
-
 
146
		specimenDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationSpecimen(), 600, true);
-
 
147
		specimenDegradationChp.initialiserType("specimenDegradation");
-
 
148
		specimenDegradationChp.initialiserCombobox("etat");
-
 
149
		add(specimenDegradationChp);
-
 
150
		
-
 
151
		presentationDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationPresentation(), 600, true);
-
 
152
		presentationDegradationChp.initialiserType("supportDegradation");
-
 
153
		presentationDegradationChp.initialiserCombobox("etat");
-
 
154
		add(presentationDegradationChp);
142
		
155
		
143
		determinationCombo   = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
156
		determinationCombo = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
144
		determinationCombo.setTrie("id_valeur");
157
		determinationCombo.setTrie("id_valeur");
145
		add(determinationCombo, new FormData(450, 0));
158
		add(determinationCombo, new FormData(450, 0));
146
		
159
		
147
		layout();
160
		layout();
148
	}
161
	}
149
	
162
	
150
	
163
	
151
	private void creerUniteRangement() {
164
	private void creerUniteRangement() {
152
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
165
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
153
		uniteRangementGrille  = creerGrilleUniteRangement();
166
		uniteRangementGrille  = creerGrilleUniteRangement();
154
		panneauGrille.add(uniteRangementGrille);
167
		panneauGrille.add(uniteRangementGrille);
155
		ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
168
		ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
156
		panneauGrille.setTopComponent(barreOutils);
169
		panneauGrille.setTopComponent(barreOutils);
157
		add(panneauGrille);
170
		add(panneauGrille);
158
		
171
		
159
		etatUniteRangementCombo = new ChampComboBoxListeValeurs(i18nC.collectionUniteRangementEtatGeneral(), "etat");
172
		etatUniteRangementCombo = new ChampComboBoxListeValeurs(i18nC.collectionUniteRangementEtatGeneral(), "etat");
160
		etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
173
		etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
161
		etatUniteRangementCombo.setTrie("id_valeur");
174
		etatUniteRangementCombo.setTrie("id_valeur");
162
		add(etatUniteRangementCombo, new FormData(300, 0));
175
		add(etatUniteRangementCombo, new FormData(300, 0));
163
	}
176
	}
164
	
177
	
165
	private ContentPanel creerPanneauContenantGrille(String titre) {
178
	private ContentPanel creerPanneauContenantGrille(String titre) {
166
		ContentPanel panneau = new ContentPanel();
179
		ContentPanel panneau = new ContentPanel();
167
		panneau.setHeading(titre);
180
		panneau.setHeading(titre);
168
		panneau.setIcon(Images.ICONES.table());
181
		panneau.setIcon(Images.ICONES.table());
169
		panneau.setLayout(new FitLayout());
182
		panneau.setLayout(new FitLayout());
170
		panneau.setFrame(true);
183
		panneau.setFrame(true);
171
		
184
		
172
		return panneau;
185
		return panneau;
173
	}
186
	}
174
	
187
	
175
	private Grid<UniteRangement> creerGrilleUniteRangement() {
188
	private Grid<UniteRangement> creerGrilleUniteRangement() {
176
		ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
189
		ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
177
		
190
		
178
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
191
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
179
		colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
192
		colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
180
		
193
		
181
		NumberField champNombre = new NumberField();
194
		NumberField champNombre = new NumberField();
182
		champNombre.setFormat(NumberFormat.getFormat("#"));
195
		champNombre.setFormat(NumberFormat.getFormat("#"));
183
		CellEditor editeurNombre = new CellEditor(champNombre);
196
		CellEditor editeurNombre = new CellEditor(champNombre);
184
		
197
		
185
		ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
198
		ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
186
		nombreColonne.setEditor(editeurNombre);
199
		nombreColonne.setEditor(editeurNombre);
187
		colonnes.add(nombreColonne);
200
		colonnes.add(nombreColonne);
188
		
201
		
189
		ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
202
		ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
190
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));  
203
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));  
191
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
204
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
192
		
205
		
193
		final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
206
		final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
194
		precisionCombo.setForceSelection(true);
207
		precisionCombo.setForceSelection(true);
195
		precisionCombo.setTriggerAction(TriggerAction.ALL);
208
		precisionCombo.setTriggerAction(TriggerAction.ALL);
196
		precisionCombo.setDisplayField("nom");
209
		precisionCombo.setDisplayField("nom");
197
		precisionCombo.setStore(precisionStore);
210
		precisionCombo.setStore(precisionStore);
198
		precisionCombo.setEditable(false);
211
		precisionCombo.setEditable(false);
199
		
212
		
200
		CellEditor editeurPrecision = new CellEditor(precisionCombo) {  
213
		CellEditor editeurPrecision = new CellEditor(precisionCombo) {  
201
			@Override  
214
			@Override  
202
			public Object preProcessValue(Object valeur) {  
215
			public Object preProcessValue(Object valeur) {  
203
				InterneValeur retour = null;
216
				InterneValeur retour = null;
204
				if (valeur != null ) {
217
				if (valeur != null ) {
205
					if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
218
					if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
206
						retour = precisionCombo.getStore().findModel("nom", valeur.toString());
219
						retour = precisionCombo.getStore().findModel("nom", valeur.toString());
207
					} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
220
					} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
208
						retour = precisionCombo.getStore().findModel("abr", valeur.toString());
221
						retour = precisionCombo.getStore().findModel("abr", valeur.toString());
209
					}
222
					}
210
				}
223
				}
211
				return retour;
224
				return retour;
212
			}  
225
			}  
213
 
226
 
214
			@Override  
227
			@Override  
215
			public Object postProcessValue(Object valeur) {  
228
			public Object postProcessValue(Object valeur) {  
216
				String retour = null;
229
				String retour = null;
217
				if (valeur != null ) {
230
				if (valeur != null ) {
218
					if (valeur instanceof InterneValeur) {
231
					if (valeur instanceof InterneValeur) {
219
						InterneValeur valeurInterne = (InterneValeur) valeur;
232
						InterneValeur valeurInterne = (InterneValeur) valeur;
220
						retour = valeurInterne.getNom();
233
						retour = valeurInterne.getNom();
221
					}
234
					}
222
				}
235
				}
223
				return retour;  
236
				return retour;  
224
			}  
237
			}  
225
		};
238
		};
226
		
239
		
227
		ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
240
		ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
228
		precisionColonne.setEditor(editeurPrecision);
241
		precisionColonne.setEditor(editeurPrecision);
229
		colonnes.add(precisionColonne);
242
		colonnes.add(precisionColonne);
230
		
243
		
231
		TextField<String> formatChp = new TextField<String>();
244
		TextField<String> formatChp = new TextField<String>();
232
		formatChp.setAllowBlank(false);
245
		formatChp.setAllowBlank(false);
233
 
246
 
234
		ColumnConfig formatColonne =  new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
247
		ColumnConfig formatColonne =  new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
235
		formatColonne.setEditor(new CellEditor(formatChp));
248
		formatColonne.setEditor(new CellEditor(formatChp));
236
		colonnes.add(formatColonne);
249
		colonnes.add(formatColonne);
237
		
250
		
238
		GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
251
		GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
239
		ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
252
		ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
240
		
253
		
241
		EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
254
		EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
242
		grilleUniteRangement.setHeight(300);
255
		grilleUniteRangement.setHeight(300);
243
		grilleUniteRangement.setBorders(true);
256
		grilleUniteRangement.setBorders(true);
244
		grilleUniteRangement.setSelectionModel(modeleDeSelection);
257
		grilleUniteRangement.setSelectionModel(modeleDeSelection);
245
		grilleUniteRangement.getView().setForceFit(true);
258
		grilleUniteRangement.getView().setForceFit(true);
246
		grilleUniteRangement.getView().setAutoFill(true);
259
		grilleUniteRangement.getView().setAutoFill(true);
247
		grilleUniteRangement.setAutoExpandColumn("type");
260
		grilleUniteRangement.setAutoExpandColumn("type");
248
		grilleUniteRangement.setStripeRows(true);
261
		grilleUniteRangement.setStripeRows(true);
249
		grilleUniteRangement.setTrackMouseOver(true);
262
		grilleUniteRangement.setTrackMouseOver(true);
250
		
263
		
251
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
264
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
252
		
265
		
253
		return grilleUniteRangement;
266
		return grilleUniteRangement;
254
	}
267
	}
255
	
268
	
256
	private ToolBar creerBarreOutilsGrilleUniteRangement() {
269
	private ToolBar creerBarreOutilsGrilleUniteRangement() {
257
		ToolBar barreOutils = new ToolBar();  
270
		ToolBar barreOutils = new ToolBar();  
258
		
271
		
259
		Button ajouterBouton = creerBoutonAjouterUniteRangement();
272
		Button ajouterBouton = creerBoutonAjouterUniteRangement();
260
		barreOutils.add(ajouterBouton);
273
		barreOutils.add(ajouterBouton);
261
		
274
		
262
		barreOutils.add(new SeparatorToolItem());
275
		barreOutils.add(new SeparatorToolItem());
263
		
276
		
264
		Button supprimerBouton = creerBoutonSupprimerUniteRangement();
277
		Button supprimerBouton = creerBoutonSupprimerUniteRangement();
265
		barreOutils.add(supprimerBouton);		
278
		barreOutils.add(supprimerBouton);		
266
		
279
		
267
		return barreOutils;
280
		return barreOutils;
268
	}
281
	}
269
	
282
	
270
	private Button creerBoutonAjouterUniteRangement() {
283
	private Button creerBoutonAjouterUniteRangement() {
271
		Button bouton = new Button(i18nC.ajouter());
284
		Button bouton = new Button(i18nC.ajouter());
272
		bouton.setIcon(Images.ICONES.ajouter());
285
		bouton.setIcon(Images.ICONES.ajouter());
273
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
286
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
274
			@Override
287
			@Override
275
			public void componentSelected(ButtonEvent ce) {
288
			public void componentSelected(ButtonEvent ce) {
276
				final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
289
				final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
277
					box.addCallback(new Listener<MessageBoxEvent>() {
290
					box.addCallback(new Listener<MessageBoxEvent>() {
278
					public void handleEvent(MessageBoxEvent be) {
291
					public void handleEvent(MessageBoxEvent be) {
279
						final UniteRangement unite = new UniteRangement();
292
						final UniteRangement unite = new UniteRangement();
280
						unite.setType(be.getValue());
293
						unite.setType(be.getValue());
281
						unite.setTypeAutre(true);
294
						unite.setTypeAutre(true);
282
						uniteRangementGrille.getStore().add(unite);
295
						uniteRangementGrille.getStore().add(unite);
283
					}
296
					}
284
				});
297
				});
285
			}
298
			}
286
		});
299
		});
287
		return bouton;
300
		return bouton;
288
	}
301
	}
289
	
302
	
290
	private Button creerBoutonSupprimerUniteRangement() {
303
	private Button creerBoutonSupprimerUniteRangement() {
291
		Button bouton = new Button(i18nC.supprimer());
304
		Button bouton = new Button(i18nC.supprimer());
292
		bouton.setIcon(Images.ICONES.supprimer());
305
		bouton.setIcon(Images.ICONES.supprimer());
293
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {  
306
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {  
294
			@Override
307
			@Override
295
			public void componentSelected(ButtonEvent ce) {
308
			public void componentSelected(ButtonEvent ce) {
296
				UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
309
				UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
297
				if (uniteRangementSelectionnee == null) {
310
				if (uniteRangementSelectionnee == null) {
298
					Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
311
					Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
299
				} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
312
				} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
300
					Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
313
					Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
301
				} else {
314
				} else {
302
					uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
315
					uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
303
				}
316
				}
304
			}   
317
			}   
305
		});
318
		});
306
		return bouton;
319
		return bouton;
307
	}
320
	}
308
	
321
	
309
	private void creerUniteBase() {
322
	private void creerUniteBase() {
310
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
323
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
311
		uniteBaseGrille  = creerGrilleUniteBase();
324
		uniteBaseGrille  = creerGrilleUniteBase();
312
		panneauGrille.add(uniteBaseGrille);
325
		panneauGrille.add(uniteBaseGrille);
313
		ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
326
		ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
314
		panneauGrille.setTopComponent(barreOutils);
327
		panneauGrille.setTopComponent(barreOutils);
315
		add(panneauGrille);		
328
		add(panneauGrille);		
316
	}
329
	}
317
		
330
		
318
	private Grid<UniteBase> creerGrilleUniteBase() {
331
	private Grid<UniteBase> creerGrilleUniteBase() {
319
		ListStore<UniteBase> storeGrille = new ListStore<UniteBase>();
332
		ListStore<UniteBase> storeGrille = new ListStore<UniteBase>();
320
		
333
		
321
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
334
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
322
		colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
335
		colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
323
		
336
		
324
		NumberField champNombre = new NumberField();
337
		NumberField champNombre = new NumberField();
325
		champNombre.setFormat(NumberFormat.getFormat("#"));
338
		champNombre.setFormat(NumberFormat.getFormat("#"));
326
		CellEditor editeurNombre = new CellEditor(champNombre);
339
		CellEditor editeurNombre = new CellEditor(champNombre);
327
		
340
		
328
		ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
341
		ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
329
		nombreColonne.setEditor(editeurNombre);
342
		nombreColonne.setEditor(editeurNombre);
330
		colonnes.add(nombreColonne);
343
		colonnes.add(nombreColonne);
331
		
344
		
332
		ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
345
		ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
333
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));  
346
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));  
334
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
347
		precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
335
		
348
		
336
		final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
349
		final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
337
		precisionCombo.setForceSelection(true);
350
		precisionCombo.setForceSelection(true);
338
		precisionCombo.setTriggerAction(TriggerAction.ALL);
351
		precisionCombo.setTriggerAction(TriggerAction.ALL);
339
		precisionCombo.setDisplayField("nom");
352
		precisionCombo.setDisplayField("nom");
340
		precisionCombo.setStore(precisionStore);
353
		precisionCombo.setStore(precisionStore);
341
		precisionCombo.setEditable(false);
354
		precisionCombo.setEditable(false);
342
		
355
		
343
		CellEditor editeurPrecision = new CellEditor(precisionCombo) {  
356
		CellEditor editeurPrecision = new CellEditor(precisionCombo) {  
344
			@Override  
357
			@Override  
345
			public Object preProcessValue(Object valeur) {  
358
			public Object preProcessValue(Object valeur) {  
346
				InterneValeur retour = null;
359
				InterneValeur retour = null;
347
				if (valeur != null ) {
360
				if (valeur != null ) {
348
					if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
361
					if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
349
						retour = precisionCombo.getStore().findModel("nom", valeur.toString());
362
						retour = precisionCombo.getStore().findModel("nom", valeur.toString());
350
					} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
363
					} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
351
						retour = precisionCombo.getStore().findModel("abr", valeur.toString());
364
						retour = precisionCombo.getStore().findModel("abr", valeur.toString());
352
					}
365
					}
353
				}
366
				}
354
				return retour;
367
				return retour;
355
			}  
368
			}  
356
 
369
 
357
			@Override  
370
			@Override  
358
			public Object postProcessValue(Object valeur) {  
371
			public Object postProcessValue(Object valeur) {  
359
				String retour = null;
372
				String retour = null;
360
				if (valeur != null ) {
373
				if (valeur != null ) {
361
					if (valeur instanceof InterneValeur) {
374
					if (valeur instanceof InterneValeur) {
362
						InterneValeur valeurInterne = (InterneValeur) valeur;
375
						InterneValeur valeurInterne = (InterneValeur) valeur;
363
						retour = valeurInterne.getNom();
376
						retour = valeurInterne.getNom();
364
					}
377
					}
365
				}
378
				}
366
				return retour;
379
				return retour;
367
			}  
380
			}  
368
		};
381
		};
369
		
382
		
370
		ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
383
		ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
371
		precisionColonne.setEditor(editeurPrecision);
384
		precisionColonne.setEditor(editeurPrecision);
372
		colonnes.add(precisionColonne);
385
		colonnes.add(precisionColonne);
373
		
386
		
374
		TextField<String> formatChp = new TextField<String>();
387
		TextField<String> formatChp = new TextField<String>();
375
		formatChp.setAllowBlank(false);
388
		formatChp.setAllowBlank(false);
376
 
389
 
377
		ColumnConfig formatColonne =  new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
390
		ColumnConfig formatColonne =  new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
378
		formatColonne.setEditor(new CellEditor(formatChp));
391
		formatColonne.setEditor(new CellEditor(formatChp));
379
		colonnes.add(formatColonne);
392
		colonnes.add(formatColonne);
380
		
393
		
381
		ColumnConfig partNombreColonne = new ColumnConfig("nombre_part", i18nC.collectionUniteNbre(), 50);
394
		ColumnConfig partNombreColonne = new ColumnConfig("nombre_part", i18nC.collectionUniteNbre(), 50);
382
		partNombreColonne.setEditor(editeurNombre);
395
		partNombreColonne.setEditor(editeurNombre);
383
		colonnes.add(partNombreColonne);
396
		colonnes.add(partNombreColonne);
384
		
397
		
385
		ColumnConfig partPrecisionColonne = new ColumnConfig("precision_part", i18nC.collectionUnitePrecision(), 50);
398
		ColumnConfig partPrecisionColonne = new ColumnConfig("precision_part", i18nC.collectionUnitePrecision(), 50);
386
		partPrecisionColonne.setEditor(editeurPrecision);
399
		partPrecisionColonne.setEditor(editeurPrecision);
387
		colonnes.add(partPrecisionColonne);
400
		colonnes.add(partPrecisionColonne);
388
		
401
		
389
		ColumnConfig spNombreColonne = new ColumnConfig("nombre_sp", i18nC.collectionUniteNbre(), 50);
402
		ColumnConfig spNombreColonne = new ColumnConfig("nombre_sp", i18nC.collectionUniteNbre(), 50);
390
		spNombreColonne.setEditor(editeurNombre);
403
		spNombreColonne.setEditor(editeurNombre);
391
		colonnes.add(spNombreColonne);
404
		colonnes.add(spNombreColonne);
392
		
405
		
393
		ColumnConfig spPrecisionColonne = new ColumnConfig("precision_sp", i18nC.collectionUnitePrecision(), 50);
406
		ColumnConfig spPrecisionColonne = new ColumnConfig("precision_sp", i18nC.collectionUnitePrecision(), 50);
394
		spPrecisionColonne.setEditor(editeurPrecision);
407
		spPrecisionColonne.setEditor(editeurPrecision);
395
		colonnes.add(spPrecisionColonne);
408
		colonnes.add(spPrecisionColonne);
396
		
409
		
397
		GridSelectionModel<UniteBase> modeleDeSelection = new GridSelectionModel<UniteBase>();
410
		GridSelectionModel<UniteBase> modeleDeSelection = new GridSelectionModel<UniteBase>();
398
		ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
411
		ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
399
		modeleDeColonnes.addHeaderGroup(0, 0, new HeaderGroupConfig(i18nC.collectionUniteBase(), 1, 4));
412
		modeleDeColonnes.addHeaderGroup(0, 0, new HeaderGroupConfig(i18nC.collectionUniteBase(), 1, 4));
400
		modeleDeColonnes.addHeaderGroup(0, 4, new HeaderGroupConfig(i18nC.collectionUniteBasePart(), 1, 2));
413
		modeleDeColonnes.addHeaderGroup(0, 4, new HeaderGroupConfig(i18nC.collectionUniteBasePart(), 1, 2));
401
		modeleDeColonnes.addHeaderGroup(0, 6, new HeaderGroupConfig(i18nC.collectionUniteBaseSp(), 1, 2));
414
		modeleDeColonnes.addHeaderGroup(0, 6, new HeaderGroupConfig(i18nC.collectionUniteBaseSp(), 1, 2));
402
		
415
		
403
		AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
416
		AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
404
		total.setHtml("type", "TOTAL");
417
		total.setHtml("type", "TOTAL");
405
		total.setSummaryType("nombre", SummaryType.SUM);
418
		total.setSummaryType("nombre", SummaryType.SUM);
406
		total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
419
		total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
407
		total.setSummaryType("nombre_part", SummaryType.SUM);
420
		total.setSummaryType("nombre_part", SummaryType.SUM);
408
		total.setSummaryFormat("nombre_part", NumberFormat.getFormat("#"));
421
		total.setSummaryFormat("nombre_part", NumberFormat.getFormat("#"));
409
		total.setSummaryType("nombre_sp", SummaryType.SUM);
422
		total.setSummaryType("nombre_sp", SummaryType.SUM);
410
		total.setSummaryFormat("nombre_sp", NumberFormat.getFormat("#"));
423
		total.setSummaryFormat("nombre_sp", NumberFormat.getFormat("#"));
411
		modeleDeColonnes.addAggregationRow(total);
424
		modeleDeColonnes.addAggregationRow(total);
412
		
425
		
413
		EditorGrid<UniteBase> grilleUniteBase = new EditorGrid<UniteBase>(storeGrille, modeleDeColonnes);
426
		EditorGrid<UniteBase> grilleUniteBase = new EditorGrid<UniteBase>(storeGrille, modeleDeColonnes);
414
		grilleUniteBase.setHeight(200);
427
		grilleUniteBase.setHeight(200);
415
		grilleUniteBase.setBorders(true);
428
		grilleUniteBase.setBorders(true);
416
		grilleUniteBase.setSelectionModel(modeleDeSelection);
429
		grilleUniteBase.setSelectionModel(modeleDeSelection);
417
		grilleUniteBase.getView().setForceFit(true);
430
		grilleUniteBase.getView().setForceFit(true);
418
		grilleUniteBase.getView().setAutoFill(true);
431
		grilleUniteBase.getView().setAutoFill(true);
419
		grilleUniteBase.setAutoExpandColumn("type");
432
		grilleUniteBase.setAutoExpandColumn("type");
420
		grilleUniteBase.setStripeRows(true);
433
		grilleUniteBase.setStripeRows(true);
421
		grilleUniteBase.setTrackMouseOver(true);
434
		grilleUniteBase.setTrackMouseOver(true);
422
		
435
		
423
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
436
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
424
		
437
		
425
		return grilleUniteBase;
438
		return grilleUniteBase;
426
	}
439
	}
427
	
440
	
428
	private ToolBar creerBarreOutilsGrilleUniteBase() {
441
	private ToolBar creerBarreOutilsGrilleUniteBase() {
429
		ToolBar barreOutils = new ToolBar();  
442
		ToolBar barreOutils = new ToolBar();  
430
		
443
		
431
		Button ajouterBouton = creerBoutonAjouterUniteBase();
444
		Button ajouterBouton = creerBoutonAjouterUniteBase();
432
		barreOutils.add(ajouterBouton);
445
		barreOutils.add(ajouterBouton);
433
		
446
		
434
		barreOutils.add(new SeparatorToolItem());
447
		barreOutils.add(new SeparatorToolItem());
435
		
448
		
436
		Button supprimerBouton = creerBoutonSupprimerUniteBase();
449
		Button supprimerBouton = creerBoutonSupprimerUniteBase();
437
		barreOutils.add(supprimerBouton);		
450
		barreOutils.add(supprimerBouton);		
438
		
451
		
439
		return barreOutils;
452
		return barreOutils;
440
	}
453
	}
441
	
454
	
442
	private Button creerBoutonAjouterUniteBase() {
455
	private Button creerBoutonAjouterUniteBase() {
443
		Button bouton = new Button(i18nC.ajouter());
456
		Button bouton = new Button(i18nC.ajouter());
444
		bouton.setIcon(Images.ICONES.ajouter());
457
		bouton.setIcon(Images.ICONES.ajouter());
445
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
458
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
446
			@Override
459
			@Override
447
			public void componentSelected(ButtonEvent ce) {
460
			public void componentSelected(ButtonEvent ce) {
448
				final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteBaseSaisirType());
461
				final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteBaseSaisirType());
449
					box.addCallback(new Listener<MessageBoxEvent>() {
462
					box.addCallback(new Listener<MessageBoxEvent>() {
450
					public void handleEvent(MessageBoxEvent be) {
463
					public void handleEvent(MessageBoxEvent be) {
451
						final UniteBase unite = new UniteBase();
464
						final UniteBase unite = new UniteBase();
452
						unite.setType(be.getValue());
465
						unite.setType(be.getValue());
453
						unite.setTypeAutre(true);
466
						unite.setTypeAutre(true);
454
						uniteBaseGrille.getStore().add(unite);
467
						uniteBaseGrille.getStore().add(unite);
455
					}
468
					}
456
				});
469
				});
457
			}
470
			}
458
		});
471
		});
459
		return bouton;
472
		return bouton;
460
	}
473
	}
461
	
474
	
462
	private Button creerBoutonSupprimerUniteBase() {
475
	private Button creerBoutonSupprimerUniteBase() {
463
		Button bouton = new Button(i18nC.supprimer());
476
		Button bouton = new Button(i18nC.supprimer());
464
		bouton.setIcon(Images.ICONES.supprimer());
477
		bouton.setIcon(Images.ICONES.supprimer());
465
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {  
478
		bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {  
466
			@Override
479
			@Override
467
			public void componentSelected(ButtonEvent ce) {
480
			public void componentSelected(ButtonEvent ce) {
468
				UniteBase uniteBaseSelectionnee = uniteBaseGrille.getSelectionModel().getSelectedItem();
481
				UniteBase uniteBaseSelectionnee = uniteBaseGrille.getSelectionModel().getSelectedItem();
469
				if (uniteBaseSelectionnee == null) {
482
				if (uniteBaseSelectionnee == null) {
470
					Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteBase()));
483
					Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteBase()));
471
				} else if (uniteBaseSelectionnee.getTypeAutre() == false) {
484
				} else if (uniteBaseSelectionnee.getTypeAutre() == false) {
472
					Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteBaseAjoute());
485
					Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteBaseAjoute());
473
				} else {
486
				} else {
474
					uniteBaseGrille.getStore().remove(uniteBaseSelectionnee);
487
					uniteBaseGrille.getStore().remove(uniteBaseSelectionnee);
475
				}
488
				}
476
			}   
489
			}   
477
		});
490
		});
478
		return bouton;
491
		return bouton;
479
	}
492
	}
480
	
493
	
481
	private Slider creerSliderPoucentage(final String message, final SliderField champSlider) {
494
	private Slider creerSliderPoucentage(final String message, final SliderField champSlider) {
482
		Slider slider = new Slider();
495
		Slider slider = new Slider();
483
		slider.setMinValue(0);  
496
		slider.setMinValue(0);  
484
		slider.setMaxValue(100);  
497
		slider.setMaxValue(100);  
485
		slider.setValue(0);  
498
		slider.setValue(0);  
486
		slider.setIncrement(1);
499
		slider.setIncrement(1);
487
		slider.setMessage("{0} "+message);
500
		slider.setMessage("{0} "+message);
488
		return slider;
501
		return slider;
489
	}
502
	}
490
	
503
	
491
	public void rafraichir(Object nouvellesDonnees) {
504
	public void rafraichir(Object nouvellesDonnees) {
492
		if (nouvellesDonnees instanceof ValeurListe) {
505
		if (nouvellesDonnees instanceof ValeurListe) {
493
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
506
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
494
			rafraichirValeurListe(listeValeurs);
507
			rafraichirValeurListe(listeValeurs);
495
		} else {
508
		} else {
496
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
509
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
497
		}
510
		}
498
	}
511
	}
499
	
512
	
500
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
513
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
501
		if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
514
		if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
502
			Iterator<String> it = listeValeurs.keySet().iterator();
515
			Iterator<String> it = listeValeurs.keySet().iterator();
503
			while (it.hasNext()) {
516
			while (it.hasNext()) {
504
				Valeur valeur = listeValeurs.get(it.next());
517
				Valeur valeur = listeValeurs.get(it.next());
505
				UniteRangement unite = new UniteRangement();
518
				UniteRangement unite = new UniteRangement();
506
				unite.setType(valeur.getNom());
519
				unite.setType(valeur.getNom());
507
				unite.setTypeAutre(false);
520
				unite.setTypeAutre(false);
508
				uniteRangementGrille.getStore().add(unite);
521
				uniteRangementGrille.getStore().add(unite);
509
			}
522
			}
510
		} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
523
		} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
511
			Iterator<String> it = listeValeurs.keySet().iterator();
524
			Iterator<String> it = listeValeurs.keySet().iterator();
512
			while (it.hasNext()) {
525
			while (it.hasNext()) {
513
				Valeur valeur = listeValeurs.get(it.next());
526
				Valeur valeur = listeValeurs.get(it.next());
514
				UniteBase unite = new UniteBase();
527
				UniteBase unite = new UniteBase();
515
				unite.setType(valeur.getNom());
528
				unite.setType(valeur.getNom());
516
				unite.setTypeAutre(false);
529
				unite.setTypeAutre(false);
517
				uniteBaseGrille.getStore().add(unite);
530
				uniteBaseGrille.getStore().add(unite);
518
			}
531
			}
519
		} else {
532
		} else {
520
			GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
533
			GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
521
		}
534
		}
522
	}
535
	}
523
}
536
}