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