Line 3... |
Line 3... |
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;
|
Line 6... |
Line 6... |
6 |
|
6 |
|
- |
|
7 |
import org.tela_botanica.client.Mediateur;
|
7 |
import org.tela_botanica.client.Mediateur;
|
8 |
import org.tela_botanica.client.composants.ChampSlider;
|
8 |
import org.tela_botanica.client.images.Images;
|
9 |
import org.tela_botanica.client.images.Images;
|
- |
|
10 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
- |
|
11 |
import org.tela_botanica.client.modeles.InterneValeur;
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
12 |
import org.tela_botanica.client.modeles.UniteBase;
|
10 |
import org.tela_botanica.client.modeles.UniteRangement;
|
13 |
import org.tela_botanica.client.modeles.UniteRangement;
|
11 |
import org.tela_botanica.client.modeles.Valeur;
|
14 |
import org.tela_botanica.client.modeles.Valeur;
|
Line -... |
Line 15... |
- |
|
15 |
import org.tela_botanica.client.modeles.ValeurListe;
|
- |
|
16 |
|
12 |
import org.tela_botanica.client.modeles.ValeurListe;
|
17 |
import com.extjs.gxt.charts.client.model.axis.Label;
|
- |
|
18 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
- |
|
19 |
import com.extjs.gxt.ui.client.event.Listener;
|
13 |
|
20 |
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
14 |
import com.extjs.gxt.ui.client.event.Listener;
|
21 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
15 |
import com.extjs.gxt.ui.client.store.ListStore;
|
22 |
import com.extjs.gxt.ui.client.store.ListStore;
|
16 |
import com.extjs.gxt.ui.client.store.Store;
|
23 |
import com.extjs.gxt.ui.client.store.Store;
|
- |
|
24 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
- |
|
25 |
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.LayoutContainer;
|
- |
|
28 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
- |
|
29 |
import com.extjs.gxt.ui.client.widget.Slider;
|
- |
|
30 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
- |
|
31 |
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
|
- |
|
32 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
33 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
- |
|
34 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
- |
|
35 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
- |
|
36 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
37 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
17 |
import com.extjs.gxt.ui.client.store.StoreEvent;
|
38 |
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
|
18 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
39 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
- |
|
40 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
19 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
41 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
20 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
42 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
- |
|
43 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
- |
|
44 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
- |
|
45 |
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
|
21 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
46 |
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
|
- |
|
47 |
import com.extjs.gxt.ui.client.widget.layout.FillData;
|
- |
|
48 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
- |
|
49 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
|
- |
|
50 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
- |
|
51 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
22 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
52 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
- |
|
53 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
- |
|
54 |
import com.google.gwt.core.client.GWT;
|
Line 23... |
Line 55... |
23 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
55 |
import com.google.gwt.i18n.client.NumberFormat;
|
Line 24... |
Line 56... |
24 |
import com.google.gwt.core.client.GWT;
|
56 |
import com.google.gwt.json.client.JSONObject;
|
- |
|
57 |
|
- |
|
58 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
- |
|
59 |
|
- |
|
60 |
private Grid<UniteRangement> uniteRangementGrille = null;
|
- |
|
61 |
private ComboBox<Valeur> etatUniteRangementCombo = null;
|
25 |
|
62 |
private Grid<UniteBase> uniteBaseGrille = null;
|
26 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
63 |
private CheckBoxGroup typePapierConservationCacGrpChp = null;
|
27 |
|
64 |
private LayoutContainer typePapierConservationCp;
|
28 |
private Grid<UniteRangement> uniteRangementGrille = null;
|
65 |
private TextField<String> typePapierConservationAutreChp;
|
29 |
|
66 |
|
- |
|
67 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
- |
|
68 |
initialiserOnglet(formulaireCourrant);
|
- |
|
69 |
setId("description");
|
- |
|
70 |
setText(Mediateur.i18nC.collectionDescription());
|
- |
|
71 |
|
Line 30... |
Line 72... |
30 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
72 |
FormLayout formulaireLayout = (FormLayout) this.getLayout();
|
- |
|
73 |
formulaireLayout.setLabelAlign(LabelAlign.LEFT);
|
- |
|
74 |
formulaireLayout.setLabelWidth(300);
|
- |
|
75 |
layout();
|
- |
|
76 |
|
- |
|
77 |
creerUniteRangement();
|
- |
|
78 |
creerUniteBase();
|
- |
|
79 |
|
31 |
initialiserOnglet(formulaireCourrant);
|
80 |
typePapierConservationCacGrpChp = new CheckBoxGroup();
|
Line 32... |
Line 81... |
32 |
setId("description");
|
81 |
typePapierConservationCacGrpChp.setFieldLabel("Quel est le type du papier de conservation ?");
|
33 |
setText(Mediateur.i18nC.collectionDescription());
|
82 |
typePapierConservationCp = Formulaire.creerChoixMultipleCp();
|
34 |
|
83 |
add(typePapierConservationCp);
|
35 |
creerRangement();
|
84 |
mediateur.obtenirListeValeurEtRafraichir(this, "typePapier");
|
- |
|
85 |
}
|
- |
|
86 |
|
36 |
}
|
87 |
|
- |
|
88 |
private void creerUniteRangement() {
|
- |
|
89 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
|
- |
|
90 |
uniteRangementGrille = creerGrilleUniteRangement();
|
- |
|
91 |
panneauGrille.add(uniteRangementGrille);
|
- |
|
92 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
|
- |
|
93 |
panneauGrille.setTopComponent(barreOutils);
|
- |
|
94 |
add(panneauGrille);
|
- |
|
95 |
|
- |
|
96 |
ListStore<Valeur> etatUniteRangementStore = new ListStore<Valeur>();
|
- |
|
97 |
etatUniteRangementCombo = new ComboBox<Valeur>();
|
- |
|
98 |
etatUniteRangementCombo.setFieldLabel(i18nC.collectionUniteRangementEtatGeneral());
|
- |
|
99 |
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
|
- |
|
100 |
etatUniteRangementCombo.setForceSelection(true);
|
37 |
|
101 |
etatUniteRangementCombo.setTriggerAction(TriggerAction.ALL);
|
38 |
|
102 |
etatUniteRangementCombo.setDisplayField("nom");
|
39 |
private void creerRangement() {
|
103 |
|
40 |
ContentPanel panneauGrille = creerPanneauContenantGrilleRangement();
|
104 |
etatUniteRangementCombo.setStore(etatUniteRangementStore);
|
41 |
uniteRangementGrille = creerGrilleRangement();
|
- |
|
42 |
panneauGrille.add(uniteRangementGrille);
|
105 |
etatUniteRangementCombo.setEditable(false);
|
43 |
add(panneauGrille);
|
106 |
add(etatUniteRangementCombo, new FormData(300, 0));
|
44 |
}
|
107 |
mediateur.obtenirListeValeurEtRafraichir(this, "etatUniteRangement");
|
45 |
|
108 |
}
|
Line 46... |
Line 109... |
46 |
private ContentPanel creerPanneauContenantGrilleRangement() {
|
109 |
|
47 |
ContentPanel panneau = new ContentPanel();
|
110 |
private ContentPanel creerPanneauContenantGrille(String titre) {
|
Line 48... |
Line 111... |
48 |
|
111 |
ContentPanel panneau = new ContentPanel();
|
49 |
panneau.setHeading(i18nC.collectionUniteRangementTitre());
|
112 |
panneau.setHeading(titre);
|
50 |
panneau.setIcon(Images.ICONES.table());
|
- |
|
51 |
panneau.setLayout(new FitLayout());
|
- |
|
52 |
panneau.setFrame(true);
|
- |
|
53 |
|
- |
|
54 |
return panneau;
|
- |
|
55 |
}
|
- |
|
56 |
|
- |
|
57 |
private Grid<UniteRangement> creerGrilleRangement() {
|
- |
|
58 |
ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
|
- |
|
59 |
storeGrille.addListener(Store.Add, new Listener<StoreEvent<UniteRangement>>() {
|
- |
|
Line 60... |
Line 113... |
60 |
public void handleEvent(StoreEvent<UniteRangement> ce) {
|
113 |
panneau.setIcon(Images.ICONES.table());
|
61 |
//actualiserEtatBoutonsBarreOutilsRangement();
|
114 |
panneau.setLayout(new FitLayout());
|
62 |
}
|
- |
|
63 |
});
|
- |
|
64 |
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<UniteRangement>>() {
|
- |
|
Line -... |
Line 115... |
- |
|
115 |
panneau.setFrame(true);
|
- |
|
116 |
|
- |
|
117 |
return panneau;
|
- |
|
118 |
}
|
- |
|
119 |
|
- |
|
120 |
private Grid<UniteRangement> creerGrilleUniteRangement() {
|
- |
|
121 |
ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
|
- |
|
122 |
|
65 |
public void handleEvent(StoreEvent<UniteRangement> ce) {
|
123 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
- |
|
124 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
- |
|
125 |
|
- |
|
126 |
NumberField champNombre = new NumberField();
|
- |
|
127 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
- |
|
128 |
CellEditor editeurNombre = new CellEditor(champNombre);
|
- |
|
129 |
|
- |
|
130 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
- |
|
131 |
nombreColonne.setEditor(editeurNombre);
|
- |
|
132 |
colonnes.add(nombreColonne);
|
- |
|
133 |
|
- |
|
134 |
ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
|
- |
|
135 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));
|
- |
|
136 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
|
- |
|
137 |
|
- |
|
138 |
final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
139 |
precisionCombo.setForceSelection(true);
|
- |
|
140 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
141 |
precisionCombo.setDisplayField("nom");
|
- |
|
142 |
precisionCombo.setStore(precisionStore);
|
- |
|
143 |
precisionCombo.setEditable(false);
|
- |
|
144 |
|
- |
|
145 |
CellEditor editeurPrecision = new CellEditor(precisionCombo) {
|
- |
|
146 |
@Override
|
- |
|
147 |
public Object preProcessValue(Object valeur) {
|
- |
|
148 |
InterneValeur retour = null;
|
- |
|
149 |
if (valeur != null ) {
|
- |
|
150 |
if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
|
- |
|
151 |
retour = precisionCombo.getStore().findModel("nom", valeur.toString());
|
- |
|
152 |
} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
|
- |
|
153 |
retour = precisionCombo.getStore().findModel("abr", valeur.toString());
|
- |
|
154 |
}
|
- |
|
155 |
}
|
- |
|
156 |
return retour;
|
- |
|
157 |
}
|
- |
|
158 |
|
- |
|
159 |
@Override
|
- |
|
160 |
public Object postProcessValue(Object valeur) {
|
- |
|
161 |
String retour = null;
|
- |
|
162 |
if (valeur != null ) {
|
- |
|
163 |
if (valeur instanceof InterneValeur) {
|
Line -... |
Line 164... |
- |
|
164 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
- |
|
165 |
retour = valeurInterne.getNom();
|
- |
|
166 |
}
|
- |
|
167 |
}
|
- |
|
168 |
return retour;
|
- |
|
169 |
}
|
- |
|
170 |
};
|
- |
|
171 |
|
66 |
//actualiserEtatBoutonsBarreOutilsRangement();
|
172 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
Line 67... |
Line 173... |
67 |
}
|
173 |
precisionColonne.setEditor(editeurPrecision);
|
68 |
});
|
174 |
colonnes.add(precisionColonne);
|
69 |
|
175 |
|
70 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
176 |
TextField<String> formatChp = new TextField<String>();
|
71 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteRangementType(), 150));
|
177 |
formatChp.setAllowBlank(false);
|
72 |
colonnes.add(new ColumnConfig("nombre", i18nC.collectionUniteRangementNbre(), 50));
|
178 |
|
Line 90... |
Line 196... |
90 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
|
196 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
|
Line 91... |
Line 197... |
91 |
|
197 |
|
92 |
return grilleUniteRangement;
|
198 |
return grilleUniteRangement;
|
Line -... |
Line 199... |
- |
|
199 |
}
|
- |
|
200 |
|
- |
|
201 |
private ToolBar creerBarreOutilsGrilleUniteRangement() {
|
- |
|
202 |
ToolBar barreOutils = new ToolBar();
|
- |
|
203 |
|
- |
|
204 |
Button ajouterBouton = creerBoutonAjouterUniteRangement();
|
- |
|
205 |
barreOutils.add(ajouterBouton);
|
- |
|
206 |
|
- |
|
207 |
barreOutils.add(new SeparatorToolItem());
|
- |
|
208 |
|
- |
|
209 |
Button supprimerBouton = creerBoutonSupprimerUniteRangement();
|
- |
|
210 |
barreOutils.add(supprimerBouton);
|
- |
|
211 |
|
- |
|
212 |
return barreOutils;
|
- |
|
213 |
}
|
- |
|
214 |
|
- |
|
215 |
private Button creerBoutonAjouterUniteRangement() {
|
- |
|
216 |
Button bouton = new Button(i18nC.ajouter());
|
- |
|
217 |
bouton.setIcon(Images.ICONES.ajouter());
|
- |
|
218 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
219 |
@Override
|
- |
|
220 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
221 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
|
- |
|
222 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
- |
|
223 |
public void handleEvent(MessageBoxEvent be) {
|
- |
|
224 |
final UniteRangement unite = new UniteRangement();
|
- |
|
225 |
unite.setType(be.getValue());
|
- |
|
226 |
unite.setTypeAutre(true);
|
- |
|
227 |
uniteRangementGrille.getStore().add(unite);
|
- |
|
228 |
}
|
- |
|
229 |
});
|
- |
|
230 |
}
|
- |
|
231 |
});
|
- |
|
232 |
return bouton;
|
- |
|
233 |
}
|
- |
|
234 |
|
- |
|
235 |
private Button creerBoutonSupprimerUniteRangement() {
|
- |
|
236 |
Button bouton = new Button(i18nC.supprimer());
|
- |
|
237 |
bouton.setIcon(Images.ICONES.supprimer());
|
- |
|
238 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
239 |
@Override
|
- |
|
240 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
241 |
UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
|
- |
|
242 |
if (uniteRangementSelectionnee == null) {
|
- |
|
243 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
|
- |
|
244 |
} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
|
- |
|
245 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
|
- |
|
246 |
} else {
|
- |
|
247 |
uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
|
- |
|
248 |
}
|
- |
|
249 |
}
|
- |
|
250 |
});
|
- |
|
251 |
return bouton;
|
- |
|
252 |
}
|
- |
|
253 |
|
- |
|
254 |
private void creerUniteBase() {
|
- |
|
255 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
|
- |
|
256 |
uniteBaseGrille = creerGrilleUniteBase();
|
- |
|
257 |
panneauGrille.add(uniteBaseGrille);
|
- |
|
258 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
|
- |
|
259 |
panneauGrille.setTopComponent(barreOutils);
|
- |
|
260 |
add(panneauGrille);
|
- |
|
261 |
}
|
- |
|
262 |
|
- |
|
263 |
private Grid<UniteBase> creerGrilleUniteBase() {
|
- |
|
264 |
ListStore<UniteBase> storeGrille = new ListStore<UniteBase>();
|
- |
|
265 |
|
- |
|
266 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
- |
|
267 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
- |
|
268 |
|
- |
|
269 |
NumberField champNombre = new NumberField();
|
- |
|
270 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
- |
|
271 |
CellEditor editeurNombre = new CellEditor(champNombre);
|
- |
|
272 |
|
- |
|
273 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
- |
|
274 |
nombreColonne.setEditor(editeurNombre);
|
- |
|
275 |
colonnes.add(nombreColonne);
|
- |
|
276 |
|
- |
|
277 |
ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
|
- |
|
278 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));
|
- |
|
279 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
|
- |
|
280 |
|
- |
|
281 |
final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
282 |
precisionCombo.setForceSelection(true);
|
- |
|
283 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
284 |
precisionCombo.setDisplayField("nom");
|
- |
|
285 |
precisionCombo.setStore(precisionStore);
|
- |
|
286 |
precisionCombo.setEditable(false);
|
- |
|
287 |
|
- |
|
288 |
CellEditor editeurPrecision = new CellEditor(precisionCombo) {
|
- |
|
289 |
@Override
|
- |
|
290 |
public Object preProcessValue(Object valeur) {
|
- |
|
291 |
InterneValeur retour = null;
|
- |
|
292 |
if (valeur != null ) {
|
- |
|
293 |
if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
|
- |
|
294 |
retour = precisionCombo.getStore().findModel("nom", valeur.toString());
|
- |
|
295 |
} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
|
- |
|
296 |
retour = precisionCombo.getStore().findModel("abr", valeur.toString());
|
- |
|
297 |
}
|
- |
|
298 |
}
|
- |
|
299 |
return retour;
|
- |
|
300 |
}
|
- |
|
301 |
|
- |
|
302 |
@Override
|
- |
|
303 |
public Object postProcessValue(Object valeur) {
|
- |
|
304 |
String retour = null;
|
- |
|
305 |
if (valeur != null ) {
|
- |
|
306 |
if (valeur instanceof InterneValeur) {
|
- |
|
307 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
- |
|
308 |
retour = valeurInterne.getNom();
|
- |
|
309 |
}
|
- |
|
310 |
}
|
- |
|
311 |
return retour;
|
- |
|
312 |
}
|
- |
|
313 |
};
|
- |
|
314 |
|
- |
|
315 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
- |
|
316 |
precisionColonne.setEditor(editeurPrecision);
|
- |
|
317 |
colonnes.add(precisionColonne);
|
- |
|
318 |
|
- |
|
319 |
TextField<String> formatChp = new TextField<String>();
|
- |
|
320 |
formatChp.setAllowBlank(false);
|
- |
|
321 |
|
- |
|
322 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
- |
|
323 |
formatColonne.setEditor(new CellEditor(formatChp));
|
- |
|
324 |
colonnes.add(formatColonne);
|
- |
|
325 |
|
- |
|
326 |
ColumnConfig partNombreColonne = new ColumnConfig("nombre_part", i18nC.collectionUniteNbre(), 50);
|
- |
|
327 |
partNombreColonne.setEditor(editeurNombre);
|
- |
|
328 |
colonnes.add(partNombreColonne);
|
- |
|
329 |
|
- |
|
330 |
ColumnConfig partPrecisionColonne = new ColumnConfig("precision_part", i18nC.collectionUnitePrecision(), 50);
|
- |
|
331 |
partPrecisionColonne.setEditor(editeurPrecision);
|
- |
|
332 |
colonnes.add(partPrecisionColonne);
|
- |
|
333 |
|
- |
|
334 |
ColumnConfig spNombreColonne = new ColumnConfig("nombre_sp", i18nC.collectionUniteNbre(), 50);
|
- |
|
335 |
spNombreColonne.setEditor(editeurNombre);
|
- |
|
336 |
colonnes.add(spNombreColonne);
|
- |
|
337 |
|
- |
|
338 |
ColumnConfig spPrecisionColonne = new ColumnConfig("precision_sp", i18nC.collectionUnitePrecision(), 50);
|
- |
|
339 |
spPrecisionColonne.setEditor(editeurPrecision);
|
- |
|
340 |
colonnes.add(spPrecisionColonne);
|
- |
|
341 |
|
- |
|
342 |
GridSelectionModel<UniteBase> modeleDeSelection = new GridSelectionModel<UniteBase>();
|
- |
|
343 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
- |
|
344 |
modeleDeColonnes.addHeaderGroup(0, 0, new HeaderGroupConfig(i18nC.collectionUniteBase(), 1, 4));
|
- |
|
345 |
modeleDeColonnes.addHeaderGroup(0, 4, new HeaderGroupConfig(i18nC.collectionUniteBasePart(), 1, 2));
|
- |
|
346 |
modeleDeColonnes.addHeaderGroup(0, 6, new HeaderGroupConfig(i18nC.collectionUniteBaseSp(), 1, 2));
|
- |
|
347 |
|
- |
|
348 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
- |
|
349 |
total.setHtml("type", "TOTAL");
|
- |
|
350 |
total.setSummaryType("nombre", SummaryType.SUM);
|
- |
|
351 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
- |
|
352 |
total.setSummaryType("nombre_part", SummaryType.SUM);
|
- |
|
353 |
total.setSummaryFormat("nombre_part", NumberFormat.getFormat("#"));
|
- |
|
354 |
total.setSummaryType("nombre_sp", SummaryType.SUM);
|
- |
|
355 |
total.setSummaryFormat("nombre_sp", NumberFormat.getFormat("#"));
|
- |
|
356 |
modeleDeColonnes.addAggregationRow(total);
|
- |
|
357 |
|
- |
|
358 |
EditorGrid<UniteBase> grilleUniteBase = new EditorGrid<UniteBase>(storeGrille, modeleDeColonnes);
|
- |
|
359 |
grilleUniteBase.setHeight(200);
|
- |
|
360 |
grilleUniteBase.setBorders(true);
|
- |
|
361 |
grilleUniteBase.setSelectionModel(modeleDeSelection);
|
- |
|
362 |
grilleUniteBase.getView().setForceFit(true);
|
- |
|
363 |
grilleUniteBase.getView().setAutoFill(true);
|
- |
|
364 |
grilleUniteBase.setAutoExpandColumn("type");
|
- |
|
365 |
grilleUniteBase.setStripeRows(true);
|
- |
|
366 |
grilleUniteBase.setTrackMouseOver(true);
|
- |
|
367 |
|
- |
|
368 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
|
- |
|
369 |
|
- |
|
370 |
return grilleUniteBase;
|
- |
|
371 |
}
|
- |
|
372 |
|
- |
|
373 |
private ToolBar creerBarreOutilsGrilleUniteBase() {
|
- |
|
374 |
ToolBar barreOutils = new ToolBar();
|
- |
|
375 |
|
- |
|
376 |
Button ajouterBouton = creerBoutonAjouterUniteBase();
|
- |
|
377 |
barreOutils.add(ajouterBouton);
|
- |
|
378 |
|
- |
|
379 |
barreOutils.add(new SeparatorToolItem());
|
- |
|
380 |
|
- |
|
381 |
Button supprimerBouton = creerBoutonSupprimerUniteBase();
|
- |
|
382 |
barreOutils.add(supprimerBouton);
|
- |
|
383 |
|
- |
|
384 |
return barreOutils;
|
- |
|
385 |
}
|
- |
|
386 |
|
- |
|
387 |
private Button creerBoutonAjouterUniteBase() {
|
- |
|
388 |
Button bouton = new Button(i18nC.ajouter());
|
- |
|
389 |
bouton.setIcon(Images.ICONES.ajouter());
|
- |
|
390 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
391 |
@Override
|
- |
|
392 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
393 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteBaseSaisirType());
|
- |
|
394 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
- |
|
395 |
public void handleEvent(MessageBoxEvent be) {
|
- |
|
396 |
final UniteBase unite = new UniteBase();
|
- |
|
397 |
unite.setType(be.getValue());
|
- |
|
398 |
unite.setTypeAutre(true);
|
- |
|
399 |
uniteBaseGrille.getStore().add(unite);
|
- |
|
400 |
}
|
- |
|
401 |
});
|
- |
|
402 |
}
|
- |
|
403 |
});
|
- |
|
404 |
return bouton;
|
- |
|
405 |
}
|
- |
|
406 |
|
- |
|
407 |
private Button creerBoutonSupprimerUniteBase() {
|
- |
|
408 |
Button bouton = new Button(i18nC.supprimer());
|
- |
|
409 |
bouton.setIcon(Images.ICONES.supprimer());
|
- |
|
410 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
411 |
@Override
|
- |
|
412 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
413 |
UniteBase uniteBaseSelectionnee = uniteBaseGrille.getSelectionModel().getSelectedItem();
|
- |
|
414 |
if (uniteBaseSelectionnee == null) {
|
- |
|
415 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteBase()));
|
- |
|
416 |
} else if (uniteBaseSelectionnee.getTypeAutre() == false) {
|
- |
|
417 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteBaseAjoute());
|
- |
|
418 |
} else {
|
- |
|
419 |
uniteBaseGrille.getStore().remove(uniteBaseSelectionnee);
|
- |
|
420 |
}
|
- |
|
421 |
}
|
- |
|
422 |
});
|
- |
|
423 |
return bouton;
|
93 |
}
|
424 |
}
|
94 |
|
425 |
|
95 |
public void rafraichir(Object nouvellesDonnees) {
|
426 |
public void rafraichir(Object nouvellesDonnees) {
|
96 |
if (nouvellesDonnees instanceof ValeurListe) {
|
427 |
if (nouvellesDonnees instanceof ValeurListe) {
|
97 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
428 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
Line 106... |
Line 437... |
106 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
437 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
107 |
while (it.hasNext()) {
|
438 |
while (it.hasNext()) {
|
108 |
Valeur valeur = listeValeurs.get(it.next());
|
439 |
Valeur valeur = listeValeurs.get(it.next());
|
109 |
UniteRangement unite = new UniteRangement();
|
440 |
UniteRangement unite = new UniteRangement();
|
110 |
unite.setType(valeur.getNom());
|
441 |
unite.setType(valeur.getNom());
|
- |
|
442 |
unite.setTypeAutre(false);
|
111 |
uniteRangementGrille.getStore().add(unite);
|
443 |
uniteRangementGrille.getStore().add(unite);
|
112 |
}
|
444 |
}
|
- |
|
445 |
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
|
- |
|
446 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
- |
|
447 |
while (it.hasNext()) {
|
- |
|
448 |
Valeur valeur = listeValeurs.get(it.next());
|
- |
|
449 |
UniteBase unite = new UniteBase();
|
- |
|
450 |
unite.setType(valeur.getNom());
|
- |
|
451 |
unite.setTypeAutre(false);
|
- |
|
452 |
uniteBaseGrille.getStore().add(unite);
|
- |
|
453 |
}
|
- |
|
454 |
} else if (listeValeurs.getId().equals(config.getListeId("etatUniteRangement"))) {
|
- |
|
455 |
Formulaire.rafraichirComboBox(listeValeurs, etatUniteRangementCombo, "id_valeur");
|
- |
|
456 |
} else if (listeValeurs.getId().equals(config.getListeId("typePapier"))) {
|
- |
|
457 |
typePapierConservationAutreChp = new TextField<String>();
|
- |
|
458 |
Formulaire.creerChoixMultipleCac(typePapierConservationCp, typePapierConservationCacGrpChp, listeValeurs, typePapierConservationAutreChp);
|
113 |
} else {
|
459 |
} else {
|
114 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
460 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
115 |
}
|
461 |
}
|
116 |
}
|
462 |
}
|
117 |
}
|
463 |
}
|