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