1 |
package org.tela_botanica.client.vues.collection;
|
1 |
package org.tela_botanica.client.vues.collection;
|
2 |
|
2 |
|
3 |
import java.util.ArrayList;
|
3 |
import java.util.ArrayList;
|
4 |
import java.util.HashMap;
|
4 |
import java.util.HashMap;
|
5 |
import java.util.Iterator;
|
5 |
import java.util.Iterator;
|
6 |
import java.util.List;
|
6 |
import java.util.List;
|
7 |
|
7 |
|
8 |
import org.tela_botanica.client.Mediateur;
|
8 |
import org.tela_botanica.client.Mediateur;
|
9 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
9 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
10 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
10 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
11 |
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
|
11 |
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
|
12 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
12 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
13 |
import org.tela_botanica.client.images.Images;
|
13 |
import org.tela_botanica.client.images.Images;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
15 |
import org.tela_botanica.client.modeles.InterneValeur;
|
15 |
import org.tela_botanica.client.modeles.InterneValeur;
|
16 |
import org.tela_botanica.client.modeles.UniteBase;
|
- |
|
17 |
import org.tela_botanica.client.modeles.UniteRangement;
|
- |
|
18 |
import org.tela_botanica.client.modeles.Valeur;
|
16 |
import org.tela_botanica.client.modeles.Valeur;
|
19 |
import org.tela_botanica.client.modeles.ValeurListe;
|
17 |
import org.tela_botanica.client.modeles.ValeurListe;
|
20 |
import org.tela_botanica.client.modeles.aDonnee;
|
18 |
import org.tela_botanica.client.modeles.aDonnee;
|
21 |
import org.tela_botanica.client.modeles.collection.Collection;
|
19 |
import org.tela_botanica.client.modeles.collection.Collection;
|
22 |
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
|
- |
|
23 |
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
|
20 |
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
|
- |
|
21 |
import org.tela_botanica.client.modeles.collection.UniteBase;
|
- |
|
22 |
import org.tela_botanica.client.modeles.collection.UniteRangement;
|
24 |
import org.tela_botanica.client.util.Debug;
|
23 |
import org.tela_botanica.client.util.Debug;
|
25 |
import org.tela_botanica.client.util.Pattern;
|
24 |
import org.tela_botanica.client.util.Pattern;
|
26 |
import org.tela_botanica.client.util.UtilNombre;
|
25 |
import org.tela_botanica.client.util.UtilNombre;
|
27 |
import org.tela_botanica.client.util.UtilString;
|
26 |
import org.tela_botanica.client.util.UtilString;
|
28 |
import org.tela_botanica.client.vues.Formulaire;
|
27 |
import org.tela_botanica.client.vues.Formulaire;
|
29 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
28 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
30 |
|
29 |
|
31 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
30 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
32 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
31 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
33 |
import com.extjs.gxt.ui.client.event.Listener;
|
32 |
import com.extjs.gxt.ui.client.event.Listener;
|
34 |
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
33 |
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
35 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
34 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
36 |
import com.extjs.gxt.ui.client.store.ListStore;
|
35 |
import com.extjs.gxt.ui.client.store.ListStore;
|
37 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
36 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
38 |
import com.extjs.gxt.ui.client.widget.Info;
|
37 |
import com.extjs.gxt.ui.client.widget.Info;
|
39 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
38 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
40 |
import com.extjs.gxt.ui.client.widget.Text;
|
39 |
import com.extjs.gxt.ui.client.widget.Text;
|
41 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
40 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
42 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
41 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
43 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
42 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
44 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
43 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
45 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
44 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
46 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
45 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
47 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
46 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
48 |
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
|
47 |
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
|
49 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
48 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
50 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
49 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
51 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
- |
|
52 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
50 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
53 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
51 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
54 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
- |
|
55 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
- |
|
56 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
52 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
57 |
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
|
53 |
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
|
58 |
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
|
54 |
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
|
59 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
55 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
60 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
56 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
61 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
57 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
62 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
58 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
63 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
59 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
64 |
import com.google.gwt.core.client.GWT;
|
60 |
import com.google.gwt.core.client.GWT;
|
65 |
import com.google.gwt.i18n.client.NumberFormat;
|
61 |
import com.google.gwt.i18n.client.NumberFormat;
|
66 |
|
62 |
|
67 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
63 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
68 |
|
64 |
|
69 |
private Collection collection = null;
|
65 |
private Collection collection = null;
|
70 |
private CollectionBotanique collectionBotanique = null;
|
66 |
private CollectionBotanique collectionBotanique = null;
|
71 |
private Collection collectionCollectee = null;
|
67 |
private Collection collectionCollectee = null;
|
72 |
private CollectionBotanique collectionBotaniqueCollectee = null;
|
68 |
private CollectionBotanique collectionBotaniqueCollectee = null;
|
- |
|
69 |
|
73 |
|
70 |
private ListStore<InterneValeur> precisionStore = null;
|
74 |
private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
|
71 |
private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
|
75 |
private NumberField nbreEchantillonChp = null;
|
72 |
private NumberField nbreEchantillonChp = null;
|
76 |
private EditorGrid<UniteRangement> uniteRangementGrille = null;
|
73 |
private EditorGrid<UniteRangement> uniteRangementGrille = null;
|
77 |
private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
|
74 |
private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
|
78 |
private EditorGrid<UniteBase> uniteBaseGrille = null;
|
75 |
private EditorGrid<UniteBase> uniteBaseGrille = null;
|
79 |
private ChampCaseACocher typePapierConservationChp = null;
|
76 |
private ChampCaseACocher typePapierConservationChp = null;
|
80 |
private ChampCaseACocher methodeConservationChp = null;
|
77 |
private ChampCaseACocher methodeConservationChp = null;
|
81 |
private ChampSliderPourcentage specimenFixationPourcentChp = null;
|
78 |
private ChampSliderPourcentage specimenFixationPourcentChp = null;
|
82 |
private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
|
79 |
private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
|
83 |
private ChampCaseACocher specimentMethodeFixationChp = null;
|
80 |
private ChampCaseACocher specimentMethodeFixationChp = null;
|
84 |
private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
|
81 |
private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
|
85 |
private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
|
82 |
private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
|
86 |
private ChampCaseACocher typeEcritureChp = null;
|
83 |
private ChampCaseACocher typeEcritureChp = null;
|
87 |
private ChampComboBoxListeValeurs traitementCombo = null;
|
84 |
private ChampComboBoxListeValeurs traitementCombo = null;
|
88 |
private ChampCaseACocher poisonTraitementChp = null;
|
85 |
private ChampCaseACocher poisonTraitementChp = null;
|
89 |
private ChampCaseACocher insecteTraitementChp = null;
|
86 |
private ChampCaseACocher insecteTraitementChp = null;
|
90 |
private ChampComboBoxListeValeurs etatGeneralCombo = null;
|
87 |
private ChampComboBoxListeValeurs etatGeneralCombo = null;
|
91 |
private ChampComboBoxListeValeurs determinationCombo = null;
|
88 |
private ChampComboBoxListeValeurs determinationCombo = null;
|
92 |
private ChampMultiValeursMultiTypes specimenDegradationChp = null;
|
89 |
private ChampMultiValeursMultiTypes specimenDegradationChp = null;
|
93 |
private ChampMultiValeursMultiTypes presentationDegradationChp = null;
|
90 |
private ChampMultiValeursMultiTypes presentationDegradationChp = null;
|
94 |
private ComboBox<InterneValeur> precisionCombo;
|
- |
|
- |
|
91 |
|
95 |
|
92 |
|
96 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
93 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
97 |
initialiserOnglet(formulaireCourrant);
|
94 |
initialiserOnglet(formulaireCourrant);
|
98 |
setId("description");
|
95 |
setId("description");
|
99 |
setText(Mediateur.i18nC.collectionDescription());
|
96 |
setText(Mediateur.i18nC.collectionDescription());
|
100 |
|
97 |
|
101 |
FormLayout formulaireLayout = (FormLayout) this.getLayout();
|
98 |
FormLayout formulaireLayout = (FormLayout) this.getLayout();
|
102 |
formulaireLayout.setLabelAlign(LabelAlign.LEFT);
|
99 |
formulaireLayout.setLabelAlign(LabelAlign.LEFT);
|
103 |
formulaireLayout.setLabelWidth(300);
|
100 |
formulaireLayout.setLabelWidth(300);
|
104 |
|
101 |
|
105 |
creerFieldsetPrecision();
|
102 |
creerFieldsetPrecision();
|
- |
|
103 |
creerStorePrecision();
|
106 |
creerUniteRangement();
|
104 |
creerUniteRangement();
|
107 |
creerUniteBase();
|
105 |
creerUniteBase();
|
108 |
creerFieldsetConservation();
|
106 |
creerFieldsetConservation();
|
109 |
creerFieldsetEtiquette();
|
107 |
creerFieldsetEtiquette();
|
110 |
creerFieldsetTraitement();
|
108 |
creerFieldsetTraitement();
|
111 |
creerFieldsetEtat();
|
109 |
creerFieldsetEtat();
|
112 |
|
110 |
|
113 |
layout();
|
111 |
layout();
|
114 |
}
|
112 |
}
|
115 |
|
113 |
|
116 |
private void creerFieldsetPrecision() {
|
114 |
private void creerFieldsetPrecision() {
|
117 |
FieldSet precisionFieldSet = new FieldSet();
|
115 |
FieldSet precisionFieldSet = new FieldSet();
|
118 |
precisionFieldSet.setHeading("Précision");
|
116 |
precisionFieldSet.setHeading("Précision");
|
119 |
precisionFieldSet.setCollapsible(true);
|
117 |
precisionFieldSet.setCollapsible(true);
|
120 |
precisionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
118 |
precisionFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
121 |
|
119 |
|
122 |
typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
|
120 |
typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
|
123 |
typesCollectionBotaCombo.setTabIndex(tabIndex++);
|
121 |
typesCollectionBotaCombo.setTabIndex(tabIndex++);
|
124 |
precisionFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
|
122 |
precisionFieldSet.add(typesCollectionBotaCombo, new FormData(250, 0));
|
125 |
|
123 |
|
126 |
nbreEchantillonChp = new NumberField();
|
124 |
nbreEchantillonChp = new NumberField();
|
127 |
nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
|
125 |
nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
|
128 |
nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
|
126 |
nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
|
129 |
nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
|
127 |
nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
|
130 |
precisionFieldSet.add(nbreEchantillonChp);
|
128 |
precisionFieldSet.add(nbreEchantillonChp);
|
131 |
|
129 |
|
132 |
this.add(precisionFieldSet);
|
130 |
this.add(precisionFieldSet);
|
133 |
}
|
131 |
}
|
- |
|
132 |
|
- |
|
133 |
private void creerStorePrecision() {
|
- |
|
134 |
precisionStore = new ListStore<InterneValeur>();
|
- |
|
135 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));
|
- |
|
136 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
|
- |
|
137 |
}
|
- |
|
138 |
|
- |
|
139 |
private String getPrecisionNom(String precisionAbr) {
|
- |
|
140 |
String precision = "";
|
- |
|
141 |
InterneValeur precisionValeur = precisionStore.findModel("abr", precisionAbr);
|
- |
|
142 |
if (precisionValeur != null) {
|
- |
|
143 |
precision = precisionValeur.getNom();
|
- |
|
144 |
}
|
- |
|
145 |
return precision;
|
- |
|
146 |
}
|
- |
|
147 |
|
- |
|
148 |
private String getPrecisionAbr(String precisionNom) {
|
- |
|
149 |
String precision = "";
|
- |
|
150 |
InterneValeur precisionValeur = precisionStore.findModel("nom", precisionNom);
|
- |
|
151 |
if (precisionValeur != null) {
|
- |
|
152 |
precision = precisionValeur.getAbr();
|
- |
|
153 |
}
|
- |
|
154 |
return precision;
|
- |
|
155 |
}
|
- |
|
156 |
|
- |
|
157 |
private ComboBox<InterneValeur> getChampPrecision() {
|
- |
|
158 |
ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
159 |
precisionCombo.setForceSelection(true);
|
- |
|
160 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
161 |
precisionCombo.setDisplayField("nom");
|
- |
|
162 |
precisionCombo.setStore(precisionStore);
|
- |
|
163 |
precisionCombo.setEditable(false);
|
- |
|
164 |
return precisionCombo;
|
- |
|
165 |
}
|
134 |
|
166 |
|
135 |
private void creerUniteRangement() {
|
167 |
private void creerUniteRangement() {
|
136 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
|
168 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
|
137 |
|
169 |
|
138 |
uniteRangementGrille = creerGrilleUniteRangement();
|
170 |
uniteRangementGrille = creerGrilleUniteRangement();
|
139 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
|
171 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
|
140 |
panneauGrille.add(uniteRangementGrille);
|
172 |
panneauGrille.add(uniteRangementGrille);
|
141 |
|
173 |
|
142 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
|
174 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
|
143 |
panneauGrille.setTopComponent(barreOutils);
|
175 |
panneauGrille.setTopComponent(barreOutils);
|
144 |
|
176 |
|
145 |
add(panneauGrille);
|
177 |
add(panneauGrille);
|
146 |
}
|
178 |
}
|
147 |
|
179 |
|
148 |
private ContentPanel creerPanneauContenantGrille(String titre) {
|
180 |
private ContentPanel creerPanneauContenantGrille(String titre) {
|
149 |
ContentPanel panneau = new ContentPanel();
|
181 |
ContentPanel panneau = new ContentPanel();
|
150 |
panneau.setHeading(titre);
|
182 |
panneau.setHeading(titre);
|
151 |
panneau.setIcon(Images.ICONES.table());
|
183 |
panneau.setIcon(Images.ICONES.table());
|
152 |
panneau.setLayout(new FitLayout());
|
184 |
panneau.setLayout(new FitLayout());
|
153 |
panneau.setFrame(true);
|
185 |
panneau.setFrame(true);
|
154 |
panneau.setScrollMode(Scroll.AUTO);
|
186 |
panneau.setScrollMode(Scroll.AUTO);
|
155 |
panneau.setCollapsible(true);
|
187 |
panneau.setCollapsible(true);
|
156 |
panneau.setStyleAttribute("margin", "5px 0");
|
188 |
panneau.setStyleAttribute("margin", "5px 0");
|
157 |
|
189 |
|
158 |
return panneau;
|
190 |
return panneau;
|
159 |
}
|
191 |
}
|
160 |
|
192 |
|
161 |
private EditorGrid<UniteRangement> creerGrilleUniteRangement() {
|
193 |
private EditorGrid<UniteRangement> creerGrilleUniteRangement() {
|
162 |
ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
|
194 |
ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
|
163 |
|
195 |
|
164 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
196 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
165 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
197 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
166 |
|
198 |
|
167 |
NumberField champNombre = new NumberField();
|
199 |
NumberField champNombre = new NumberField();
|
168 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
200 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
169 |
|
201 |
|
170 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
202 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
171 |
nombreColonne.setEditor(new CellEditor(champNombre));
|
203 |
nombreColonne.setEditor(new CellEditor(champNombre));
|
172 |
nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
204 |
nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
173 |
colonnes.add(nombreColonne);
|
205 |
colonnes.add(nombreColonne);
|
174 |
|
206 |
|
175 |
ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
|
- |
|
176 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));
|
- |
|
177 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
|
- |
|
178 |
|
- |
|
179 |
precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
180 |
precisionCombo.setForceSelection(true);
|
- |
|
181 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
182 |
precisionCombo.setDisplayField("nom");
|
- |
|
183 |
precisionCombo.setStore(precisionStore);
|
- |
|
184 |
precisionCombo.setEditable(false);
|
- |
|
185 |
|
- |
|
186 |
CellEditor editeurPrecision = new CellEditor(precisionCombo) {
|
207 |
CellEditor editeurPrecision = new CellEditor(getChampPrecision()) {
|
187 |
@Override
|
208 |
@Override
|
188 |
public Object preProcessValue(Object valeur) {
|
209 |
public Object preProcessValue(Object valeur) {
|
189 |
InterneValeur retour = null;
|
210 |
InterneValeur retour = null;
|
190 |
if (valeur != null ) {
|
211 |
if (valeur != null ) {
|
191 |
if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
|
212 |
if (precisionStore.findModel("nom", valeur.toString()) != null) {
|
192 |
retour = precisionCombo.getStore().findModel("nom", valeur.toString());
|
213 |
retour = precisionStore.findModel("nom", valeur.toString());
|
193 |
} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
|
214 |
} else if (precisionStore.findModel("abr", valeur.toString()) != null) {
|
194 |
retour = precisionCombo.getStore().findModel("abr", valeur.toString());
|
215 |
retour = precisionStore.findModel("abr", valeur.toString());
|
195 |
}
|
216 |
}
|
196 |
}
|
217 |
}
|
197 |
return retour;
|
218 |
return retour;
|
198 |
}
|
219 |
}
|
199 |
|
220 |
|
200 |
@Override
|
221 |
@Override
|
201 |
public Object postProcessValue(Object valeur) {
|
222 |
public Object postProcessValue(Object valeur) {
|
202 |
String retour = null;
|
223 |
String retour = null;
|
203 |
if (valeur != null ) {
|
224 |
if (valeur != null ) {
|
204 |
if (valeur instanceof InterneValeur) {
|
225 |
if (valeur instanceof InterneValeur) {
|
205 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
226 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
206 |
retour = valeurInterne.getNom();
|
227 |
retour = valeurInterne.getNom();
|
207 |
}
|
228 |
}
|
208 |
}
|
229 |
}
|
209 |
return retour;
|
230 |
return retour;
|
210 |
}
|
231 |
}
|
211 |
};
|
232 |
};
|
212 |
|
233 |
|
213 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
234 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
214 |
precisionColonne.setEditor(editeurPrecision);
|
235 |
precisionColonne.setEditor(editeurPrecision);
|
215 |
colonnes.add(precisionColonne);
|
236 |
colonnes.add(precisionColonne);
|
216 |
|
237 |
|
217 |
TextField<String> formatChp = new TextField<String>();
|
238 |
TextField<String> formatChp = new TextField<String>();
|
218 |
formatChp.setAllowBlank(false);
|
239 |
formatChp.setAllowBlank(false);
|
219 |
|
240 |
|
220 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
241 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
221 |
formatColonne.setEditor(new CellEditor(formatChp));
|
242 |
formatColonne.setEditor(new CellEditor(formatChp));
|
222 |
colonnes.add(formatColonne);
|
243 |
colonnes.add(formatColonne);
|
223 |
|
244 |
|
224 |
GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
|
245 |
GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
|
225 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
246 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
226 |
|
247 |
|
227 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
248 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
228 |
total.setHtml("type", "TOTAL");
|
249 |
total.setHtml("type", "TOTAL");
|
229 |
total.setSummaryType("nombre", SummaryType.SUM);
|
250 |
total.setSummaryType("nombre", SummaryType.SUM);
|
230 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
251 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
231 |
modeleDeColonnes.addAggregationRow(total);
|
252 |
modeleDeColonnes.addAggregationRow(total);
|
232 |
|
253 |
|
233 |
EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
|
254 |
EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
|
234 |
grilleUniteRangement.setHeight(300);
|
255 |
grilleUniteRangement.setHeight(300);
|
235 |
grilleUniteRangement.setBorders(true);
|
256 |
grilleUniteRangement.setBorders(true);
|
236 |
grilleUniteRangement.setSelectionModel(modeleDeSelection);
|
257 |
grilleUniteRangement.setSelectionModel(modeleDeSelection);
|
237 |
grilleUniteRangement.getView().setForceFit(true);
|
258 |
grilleUniteRangement.getView().setForceFit(true);
|
238 |
grilleUniteRangement.getView().setAutoFill(true);
|
259 |
grilleUniteRangement.getView().setAutoFill(true);
|
239 |
grilleUniteRangement.setAutoExpandColumn("type");
|
260 |
grilleUniteRangement.setAutoExpandColumn("type");
|
240 |
grilleUniteRangement.setStripeRows(true);
|
261 |
grilleUniteRangement.setStripeRows(true);
|
241 |
grilleUniteRangement.setTrackMouseOver(true);
|
262 |
grilleUniteRangement.setTrackMouseOver(true);
|
242 |
|
263 |
|
243 |
return grilleUniteRangement;
|
264 |
return grilleUniteRangement;
|
244 |
}
|
265 |
}
|
245 |
|
266 |
|
246 |
private String collecterGrilleUniteRangement() {
|
267 |
private String collecterGrilleUniteRangement() {
|
247 |
String truk = "";
|
268 |
String truk = "";
|
248 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
269 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
249 |
for (int i = 0; i < nbreUnite; i++) {
|
270 |
for (int i = 0; i < nbreUnite; i++) {
|
250 |
UniteRangement unite = uniteRangementGrille.getStore().getAt(i);
|
271 |
UniteRangement unite = uniteRangementGrille.getStore().getAt(i);
|
251 |
truk += unite.getId()+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
272 |
truk += unite.getId()+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
252 |
truk += UtilNombre.formaterEnEntier(unite.getNombre())+aDonnee.SEPARATEUR_DONNEES;
|
273 |
truk += UtilNombre.formaterEnEntier(unite.getNombre())+aDonnee.SEPARATEUR_DONNEES;
|
253 |
String precision = "";
|
- |
|
254 |
InterneValeur precisionValeur = precisionCombo.getStore().findModel("nom", unite.getPrecision());
|
- |
|
255 |
if (precisionValeur != null) {
|
- |
|
256 |
precision = precisionValeur.getAbr();
|
- |
|
257 |
}
|
- |
|
258 |
truk += precision+aDonnee.SEPARATEUR_DONNEES;
|
274 |
truk += getPrecisionAbr(unite.getPrecision())+aDonnee.SEPARATEUR_DONNEES;
|
259 |
truk += unite.getFormat();
|
275 |
truk += unite.getFormat();
|
260 |
truk += (i == (nbreUnite - 1)) ? "" : aDonnee.SEPARATEUR_VALEURS;
|
276 |
truk += (i == (nbreUnite - 1)) ? "" : aDonnee.SEPARATEUR_VALEURS;
|
261 |
}
|
277 |
}
|
262 |
return truk;
|
278 |
return truk;
|
263 |
}
|
279 |
}
|
264 |
|
280 |
|
265 |
private void peuplerGrilleUniteRangement(String valeurTruk) {
|
281 |
private void peuplerGrilleUniteRangement(String valeurTruk) {
|
266 |
if (!UtilString.isEmpty(valeurTruk)) {
|
282 |
if (!UtilString.isEmpty(valeurTruk)) {
|
267 |
HashMap<String,UniteRangement> unitesEnregistrees = new HashMap<String,UniteRangement>();
|
283 |
HashMap<String,UniteRangement> unitesEnregistrees = new HashMap<String,UniteRangement>();
|
268 |
String[] unites = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
|
284 |
String[] unites = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
|
269 |
for (int i = 0; i < unites.length; i++) {
|
285 |
for (int i = 0; i < unites.length; i++) {
|
270 |
String[] uniteTypeIdDonnees = unites[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
286 |
String[] uniteTypeIdDonnees = unites[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
271 |
String uniteChaineDonnees = uniteTypeIdDonnees[1];
|
287 |
String uniteChaineDonnees = uniteTypeIdDonnees[1];
|
272 |
String[] uniteDonnees = uniteChaineDonnees.split(Pattern.quote(aDonnee.SEPARATEUR_DONNEES));
|
288 |
String[] uniteDonnees = uniteChaineDonnees.split(Pattern.quote(aDonnee.SEPARATEUR_DONNEES));
|
273 |
|
289 |
|
274 |
UniteRangement uniteRangement = new UniteRangement();
|
290 |
UniteRangement uniteRangement = new UniteRangement();
|
275 |
uniteRangement.setId(uniteTypeIdDonnees[0]);
|
291 |
uniteRangement.setId(uniteTypeIdDonnees[0]);
|
276 |
if (uniteDonnees.length > 0) {
|
292 |
if (uniteDonnees.length > 0) {
|
277 |
uniteRangement.setNombre(UtilString.formaterEnDouble(uniteDonnees[0]));
|
293 |
uniteRangement.setNombre(UtilString.formaterEnEntier(uniteDonnees[0]));
|
278 |
}
|
294 |
}
|
279 |
if (uniteDonnees.length > 1) {
|
295 |
if (uniteDonnees.length > 1) {
|
280 |
uniteRangement.setPrecision(uniteDonnees[1]);
|
296 |
uniteRangement.setPrecision(getPrecisionNom(uniteDonnees[1]));
|
281 |
}
|
297 |
}
|
282 |
if (uniteDonnees.length > 2) {
|
298 |
if (uniteDonnees.length > 2) {
|
283 |
uniteRangement.setFormat(uniteDonnees[2]);
|
299 |
uniteRangement.setFormat(uniteDonnees[2]);
|
284 |
Debug.log(uniteTypeIdDonnees[0]+"/"+uniteTypeIdDonnees[1]+"/"+uniteDonnees[0]+"-"+uniteDonnees[1]+"-"+uniteDonnees[2]);
|
300 |
Debug.log(uniteTypeIdDonnees[0]+"/"+uniteTypeIdDonnees[1]+"/"+uniteDonnees[0]+"-"+uniteDonnees[1]+"-"+uniteDonnees[2]);
|
285 |
}
|
301 |
}
|
286 |
unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteRangement);
|
302 |
unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteRangement);
|
287 |
}
|
303 |
}
|
288 |
|
304 |
|
289 |
ArrayList<UniteRangement> listeUniteMaj = new ArrayList<UniteRangement>();
|
305 |
ArrayList<UniteRangement> listeUniteMaj = new ArrayList<UniteRangement>();
|
290 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
306 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
291 |
for (int i = 0; i < nbreUnite; i++) {
|
307 |
for (int i = 0; i < nbreUnite; i++) {
|
292 |
UniteRangement uniteDansGrille = uniteRangementGrille.getStore().getAt(i);
|
308 |
UniteRangement uniteDansGrille = uniteRangementGrille.getStore().getAt(i);
|
293 |
UniteRangement uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
|
309 |
UniteRangement uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
|
294 |
if (uniteEnregistree != null) {
|
310 |
if (uniteEnregistree != null) {
|
- |
|
311 |
uniteEnregistree.setType(uniteDansGrille.getType());
|
295 |
listeUniteMaj.add(uniteEnregistree);
|
312 |
listeUniteMaj.add(uniteEnregistree);
|
296 |
} else {
|
313 |
} else {
|
297 |
listeUniteMaj.add(uniteDansGrille);
|
314 |
listeUniteMaj.add(uniteDansGrille);
|
298 |
}
|
315 |
}
|
299 |
}
|
316 |
}
|
300 |
uniteRangementGrille.getStore().removeAll();
|
317 |
uniteRangementGrille.getStore().removeAll();
|
301 |
uniteRangementGrille.getStore().add(listeUniteMaj);
|
318 |
uniteRangementGrille.getStore().add(listeUniteMaj);
|
302 |
layout();
|
319 |
layout();
|
303 |
}
|
320 |
}
|
304 |
}
|
321 |
}
|
305 |
|
322 |
|
306 |
private ToolBar creerBarreOutilsGrilleUniteRangement() {
|
323 |
private ToolBar creerBarreOutilsGrilleUniteRangement() {
|
307 |
ToolBar barreOutils = new ToolBar();
|
324 |
ToolBar barreOutils = new ToolBar();
|
308 |
|
325 |
|
309 |
Button ajouterBouton = creerBoutonAjouterUniteRangement();
|
326 |
Button ajouterBouton = creerBoutonAjouterUniteRangement();
|
310 |
barreOutils.add(ajouterBouton);
|
327 |
barreOutils.add(ajouterBouton);
|
311 |
|
328 |
|
312 |
barreOutils.add(new SeparatorToolItem());
|
329 |
barreOutils.add(new SeparatorToolItem());
|
313 |
|
330 |
|
314 |
Button supprimerBouton = creerBoutonSupprimerUniteRangement();
|
331 |
Button supprimerBouton = creerBoutonSupprimerUniteRangement();
|
315 |
barreOutils.add(supprimerBouton);
|
332 |
barreOutils.add(supprimerBouton);
|
316 |
|
333 |
|
317 |
barreOutils.add(new SeparatorToolItem());
|
334 |
barreOutils.add(new SeparatorToolItem());
|
318 |
barreOutils.add(new Text(i18nC.collectionUniteRangementEtatGeneralLabel()));
|
335 |
barreOutils.add(new Text(i18nC.collectionUniteRangementEtatGeneralLabel()));
|
319 |
etatUniteRangementCombo = new ChampComboBoxListeValeurs("", "etat");
|
336 |
etatUniteRangementCombo = new ChampComboBoxListeValeurs("", "etat");
|
320 |
etatUniteRangementCombo.setEmptyText(i18nC.collectionUniteRangementEtatGeneral());
|
337 |
etatUniteRangementCombo.setEmptyText(i18nC.collectionUniteRangementEtatGeneral());
|
321 |
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
|
338 |
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
|
322 |
etatUniteRangementCombo.setTrie("id_valeur");
|
339 |
etatUniteRangementCombo.setTrie("id_valeur");
|
323 |
etatUniteRangementCombo.setWidth(300);
|
340 |
etatUniteRangementCombo.setWidth(300);
|
324 |
barreOutils.add(etatUniteRangementCombo);
|
341 |
barreOutils.add(etatUniteRangementCombo);
|
325 |
|
342 |
|
326 |
return barreOutils;
|
343 |
return barreOutils;
|
327 |
}
|
344 |
}
|
328 |
|
345 |
|
329 |
private Button creerBoutonAjouterUniteRangement() {
|
346 |
private Button creerBoutonAjouterUniteRangement() {
|
330 |
Button bouton = new Button(i18nC.ajouter());
|
347 |
Button bouton = new Button(i18nC.ajouter());
|
331 |
bouton.setIcon(Images.ICONES.ajouter());
|
348 |
bouton.setIcon(Images.ICONES.ajouter());
|
332 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
349 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
333 |
@Override
|
350 |
@Override
|
334 |
public void componentSelected(ButtonEvent ce) {
|
351 |
public void componentSelected(ButtonEvent ce) {
|
335 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
|
352 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
|
336 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
353 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
337 |
public void handleEvent(MessageBoxEvent be) {
|
354 |
public void handleEvent(MessageBoxEvent be) {
|
338 |
final UniteRangement unite = new UniteRangement();
|
355 |
final UniteRangement unite = new UniteRangement();
|
339 |
unite.setType(be.getValue());
|
356 |
unite.setType(be.getValue());
|
340 |
unite.setTypeAutre(true);
|
357 |
unite.setTypeAutre(true);
|
341 |
uniteRangementGrille.getStore().add(unite);
|
358 |
uniteRangementGrille.getStore().add(unite);
|
342 |
}
|
359 |
}
|
343 |
});
|
360 |
});
|
344 |
}
|
361 |
}
|
345 |
});
|
362 |
});
|
346 |
return bouton;
|
363 |
return bouton;
|
347 |
}
|
364 |
}
|
348 |
|
365 |
|
349 |
private Button creerBoutonSupprimerUniteRangement() {
|
366 |
private Button creerBoutonSupprimerUniteRangement() {
|
350 |
Button bouton = new Button(i18nC.supprimer());
|
367 |
Button bouton = new Button(i18nC.supprimer());
|
351 |
bouton.setIcon(Images.ICONES.supprimer());
|
368 |
bouton.setIcon(Images.ICONES.supprimer());
|
352 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
369 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
353 |
@Override
|
370 |
@Override
|
354 |
public void componentSelected(ButtonEvent ce) {
|
371 |
public void componentSelected(ButtonEvent ce) {
|
355 |
UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
|
372 |
UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
|
356 |
if (uniteRangementSelectionnee == null) {
|
373 |
if (uniteRangementSelectionnee == null) {
|
357 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
|
374 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
|
358 |
} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
|
375 |
} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
|
359 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
|
376 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
|
360 |
} else {
|
377 |
} else {
|
361 |
uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
|
378 |
uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
|
362 |
}
|
379 |
}
|
363 |
}
|
380 |
}
|
364 |
});
|
381 |
});
|
365 |
return bouton;
|
382 |
return bouton;
|
366 |
}
|
383 |
}
|
367 |
|
384 |
|
368 |
private void creerUniteBase() {
|
385 |
private void creerUniteBase() {
|
369 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
|
386 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
|
370 |
|
387 |
|
371 |
uniteBaseGrille = creerGrilleUniteBase();
|
388 |
uniteBaseGrille = creerGrilleUniteBase();
|
372 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
|
389 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
|
373 |
panneauGrille.add(uniteBaseGrille);
|
390 |
panneauGrille.add(uniteBaseGrille);
|
374 |
|
391 |
|
375 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
|
392 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
|
376 |
panneauGrille.setTopComponent(barreOutils);
|
393 |
panneauGrille.setTopComponent(barreOutils);
|
377 |
|
394 |
|
378 |
add(panneauGrille);
|
395 |
add(panneauGrille);
|
379 |
}
|
396 |
}
|
380 |
|
397 |
|
381 |
private EditorGrid<UniteBase> creerGrilleUniteBase() {
|
398 |
private EditorGrid<UniteBase> creerGrilleUniteBase() {
|
382 |
ListStore<UniteBase> storeGrille = new ListStore<UniteBase>();
|
399 |
ListStore<UniteBase> storeGrille = new ListStore<UniteBase>();
|
383 |
|
400 |
|
384 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
401 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
385 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
402 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
386 |
|
403 |
|
387 |
NumberField champNombre = new NumberField();
|
404 |
NumberField champNombre = new NumberField();
|
388 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
405 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
389 |
CellEditor editeurNombre = new CellEditor(champNombre);
|
406 |
CellEditor editeurNombre = new CellEditor(champNombre);
|
390 |
|
407 |
|
391 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
408 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
392 |
nombreColonne.setEditor(editeurNombre);
|
409 |
nombreColonne.setEditor(editeurNombre);
|
393 |
nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
410 |
nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
394 |
colonnes.add(nombreColonne);
|
411 |
colonnes.add(nombreColonne);
|
395 |
|
- |
|
396 |
ListStore<InterneValeur> precisionStore = new ListStore<InterneValeur>();
|
- |
|
397 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, i18nC.precisionApproximatif()));
|
- |
|
398 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, i18nC.precisionExact()));
|
- |
|
399 |
|
- |
|
400 |
final ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
401 |
precisionCombo.setForceSelection(true);
|
- |
|
402 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
403 |
precisionCombo.setDisplayField("nom");
|
- |
|
404 |
precisionCombo.setStore(precisionStore);
|
- |
|
405 |
precisionCombo.setEditable(false);
|
- |
|
406 |
|
412 |
|
407 |
CellEditor editeurPrecision = new CellEditor(precisionCombo) {
|
413 |
CellEditor editeurPrecision = new CellEditor(getChampPrecision()) {
|
408 |
@Override
|
414 |
@Override
|
409 |
public Object preProcessValue(Object valeur) {
|
415 |
public Object preProcessValue(Object valeur) {
|
410 |
InterneValeur retour = null;
|
416 |
InterneValeur retour = null;
|
411 |
if (valeur != null ) {
|
417 |
if (valeur != null ) {
|
412 |
if (precisionCombo.getStore().findModel("nom", valeur.toString()) != null) {
|
418 |
if (precisionStore.findModel("nom", valeur.toString()) != null) {
|
413 |
retour = precisionCombo.getStore().findModel("nom", valeur.toString());
|
419 |
retour = precisionStore.findModel("nom", valeur.toString());
|
414 |
} else if (precisionCombo.getStore().findModel("abr", valeur.toString()) != null) {
|
420 |
} else if (precisionStore.findModel("abr", valeur.toString()) != null) {
|
415 |
retour = precisionCombo.getStore().findModel("abr", valeur.toString());
|
421 |
retour = precisionStore.findModel("abr", valeur.toString());
|
416 |
}
|
422 |
}
|
417 |
}
|
423 |
}
|
418 |
return retour;
|
424 |
return retour;
|
419 |
}
|
425 |
}
|
420 |
|
426 |
|
421 |
@Override
|
427 |
@Override
|
422 |
public Object postProcessValue(Object valeur) {
|
428 |
public Object postProcessValue(Object valeur) {
|
423 |
String retour = null;
|
429 |
String retour = null;
|
424 |
if (valeur != null ) {
|
430 |
if (valeur != null ) {
|
425 |
if (valeur instanceof InterneValeur) {
|
431 |
if (valeur instanceof InterneValeur) {
|
426 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
432 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
427 |
retour = valeurInterne.getNom();
|
433 |
retour = valeurInterne.getNom();
|
428 |
}
|
434 |
}
|
429 |
}
|
435 |
}
|
430 |
return retour;
|
436 |
return retour;
|
431 |
}
|
437 |
}
|
432 |
};
|
438 |
};
|
433 |
|
439 |
|
434 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
440 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
435 |
precisionColonne.setEditor(editeurPrecision);
|
441 |
precisionColonne.setEditor(editeurPrecision);
|
436 |
colonnes.add(precisionColonne);
|
442 |
colonnes.add(precisionColonne);
|
437 |
|
443 |
|
438 |
TextField<String> formatChp = new TextField<String>();
|
444 |
TextField<String> formatChp = new TextField<String>();
|
439 |
formatChp.setAllowBlank(false);
|
445 |
formatChp.setAllowBlank(false);
|
440 |
|
446 |
|
441 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
447 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
442 |
formatColonne.setEditor(new CellEditor(formatChp));
|
448 |
formatColonne.setEditor(new CellEditor(formatChp));
|
443 |
colonnes.add(formatColonne);
|
449 |
colonnes.add(formatColonne);
|
444 |
|
450 |
|
445 |
ColumnConfig partNombreColonne = new ColumnConfig("nombre_part", i18nC.collectionUniteNbre(), 50);
|
451 |
ColumnConfig partNombreColonne = new ColumnConfig("nombre_part", i18nC.collectionUniteNbre(), 50);
|
446 |
partNombreColonne.setEditor(editeurNombre);
|
452 |
partNombreColonne.setEditor(editeurNombre);
|
447 |
partNombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
453 |
partNombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
448 |
colonnes.add(partNombreColonne);
|
454 |
colonnes.add(partNombreColonne);
|
449 |
|
455 |
|
450 |
ColumnConfig partPrecisionColonne = new ColumnConfig("precision_part", i18nC.collectionUnitePrecision(), 50);
|
456 |
ColumnConfig partPrecisionColonne = new ColumnConfig("precision_part", i18nC.collectionUnitePrecision(), 50);
|
451 |
partPrecisionColonne.setEditor(editeurPrecision);
|
457 |
partPrecisionColonne.setEditor(editeurPrecision);
|
452 |
colonnes.add(partPrecisionColonne);
|
458 |
colonnes.add(partPrecisionColonne);
|
453 |
|
459 |
|
454 |
ColumnConfig spNombreColonne = new ColumnConfig("nombre_sp", i18nC.collectionUniteNbre(), 50);
|
460 |
ColumnConfig spNombreColonne = new ColumnConfig("nombre_sp", i18nC.collectionUniteNbre(), 50);
|
455 |
spNombreColonne.setEditor(editeurNombre);
|
461 |
spNombreColonne.setEditor(editeurNombre);
|
456 |
spNombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
462 |
spNombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
457 |
colonnes.add(spNombreColonne);
|
463 |
colonnes.add(spNombreColonne);
|
458 |
|
464 |
|
459 |
ColumnConfig spPrecisionColonne = new ColumnConfig("precision_sp", i18nC.collectionUnitePrecision(), 50);
|
465 |
ColumnConfig spPrecisionColonne = new ColumnConfig("precision_sp", i18nC.collectionUnitePrecision(), 50);
|
460 |
spPrecisionColonne.setEditor(editeurPrecision);
|
466 |
spPrecisionColonne.setEditor(editeurPrecision);
|
461 |
colonnes.add(spPrecisionColonne);
|
467 |
colonnes.add(spPrecisionColonne);
|
462 |
|
468 |
|
463 |
GridSelectionModel<UniteBase> modeleDeSelection = new GridSelectionModel<UniteBase>();
|
469 |
GridSelectionModel<UniteBase> modeleDeSelection = new GridSelectionModel<UniteBase>();
|
464 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
470 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
465 |
modeleDeColonnes.addHeaderGroup(0, 0, new HeaderGroupConfig(i18nC.collectionUniteBase(), 1, 4));
|
471 |
modeleDeColonnes.addHeaderGroup(0, 0, new HeaderGroupConfig(i18nC.collectionUniteBase(), 1, 4));
|
466 |
modeleDeColonnes.addHeaderGroup(0, 4, new HeaderGroupConfig(i18nC.collectionUniteBasePart(), 1, 2));
|
472 |
modeleDeColonnes.addHeaderGroup(0, 4, new HeaderGroupConfig(i18nC.collectionUniteBasePart(), 1, 2));
|
467 |
modeleDeColonnes.addHeaderGroup(0, 6, new HeaderGroupConfig(i18nC.collectionUniteBaseSp(), 1, 2));
|
473 |
modeleDeColonnes.addHeaderGroup(0, 6, new HeaderGroupConfig(i18nC.collectionUniteBaseSp(), 1, 2));
|
468 |
|
474 |
|
469 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
475 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
470 |
total.setHtml("type", "TOTAL");
|
476 |
total.setHtml("type", "TOTAL");
|
471 |
total.setSummaryType("nombre", SummaryType.SUM);
|
477 |
total.setSummaryType("nombre", SummaryType.SUM);
|
472 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
478 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
473 |
total.setSummaryType("nombre_part", SummaryType.SUM);
|
479 |
total.setSummaryType("nombre_part", SummaryType.SUM);
|
474 |
total.setSummaryFormat("nombre_part", NumberFormat.getFormat("#"));
|
480 |
total.setSummaryFormat("nombre_part", NumberFormat.getFormat("#"));
|
475 |
total.setSummaryType("nombre_sp", SummaryType.SUM);
|
481 |
total.setSummaryType("nombre_sp", SummaryType.SUM);
|
476 |
total.setSummaryFormat("nombre_sp", NumberFormat.getFormat("#"));
|
482 |
total.setSummaryFormat("nombre_sp", NumberFormat.getFormat("#"));
|
477 |
modeleDeColonnes.addAggregationRow(total);
|
483 |
modeleDeColonnes.addAggregationRow(total);
|
478 |
|
484 |
|
479 |
EditorGrid<UniteBase> grilleUniteBase = new EditorGrid<UniteBase>(storeGrille, modeleDeColonnes);
|
485 |
EditorGrid<UniteBase> grilleUniteBase = new EditorGrid<UniteBase>(storeGrille, modeleDeColonnes);
|
480 |
grilleUniteBase.setHeight(200);
|
486 |
grilleUniteBase.setHeight(200);
|
481 |
grilleUniteBase.setBorders(true);
|
487 |
grilleUniteBase.setBorders(true);
|
482 |
grilleUniteBase.setSelectionModel(modeleDeSelection);
|
488 |
grilleUniteBase.setSelectionModel(modeleDeSelection);
|
483 |
grilleUniteBase.getView().setForceFit(true);
|
489 |
grilleUniteBase.getView().setForceFit(true);
|
484 |
grilleUniteBase.getView().setAutoFill(true);
|
490 |
grilleUniteBase.getView().setAutoFill(true);
|
485 |
grilleUniteBase.setAutoExpandColumn("type");
|
491 |
grilleUniteBase.setAutoExpandColumn("type");
|
486 |
grilleUniteBase.setStripeRows(true);
|
492 |
grilleUniteBase.setStripeRows(true);
|
487 |
grilleUniteBase.setTrackMouseOver(true);
|
493 |
grilleUniteBase.setTrackMouseOver(true);
|
488 |
|
494 |
|
489 |
return grilleUniteBase;
|
495 |
return grilleUniteBase;
|
490 |
}
|
496 |
}
|
- |
|
497 |
|
- |
|
498 |
private String collecterGrilleUniteBase() {
|
- |
|
499 |
String truk = "";
|
- |
|
500 |
int nbreUnite = uniteBaseGrille.getStore().getCount();
|
- |
|
501 |
for (int i = 0; i < nbreUnite; i++) {
|
- |
|
502 |
UniteBase unite = uniteBaseGrille.getStore().getAt(i);
|
- |
|
503 |
truk += unite.getId()+aDonnee.SEPARATEUR_TYPE_VALEUR;
|
- |
|
504 |
truk += UtilNombre.formaterEnEntier(unite.getNombre())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
505 |
truk += getPrecisionAbr(unite.getPrecision())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
506 |
truk += unite.getFormat()+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
507 |
truk += UtilNombre.formaterEnEntier(unite.getNombrePart())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
508 |
truk += getPrecisionAbr(unite.getPrecisionPart())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
509 |
truk += UtilNombre.formaterEnEntier(unite.getNombreSp())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
510 |
truk += getPrecisionAbr(unite.getPrecisionSp());
|
- |
|
511 |
truk += (i == (nbreUnite - 1)) ? "" : aDonnee.SEPARATEUR_VALEURS;
|
- |
|
512 |
}
|
- |
|
513 |
return truk;
|
- |
|
514 |
}
|
- |
|
515 |
|
- |
|
516 |
private void peuplerGrilleUniteBase(String valeurTruk) {
|
- |
|
517 |
if (!UtilString.isEmpty(valeurTruk)) {
|
- |
|
518 |
HashMap<String,UniteBase> unitesEnregistrees = new HashMap<String,UniteBase>();
|
- |
|
519 |
String[] unites = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
|
- |
|
520 |
for (int i = 0; i < unites.length; i++) {
|
- |
|
521 |
String[] uniteTypeIdDonnees = unites[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
- |
|
522 |
String uniteChaineDonnees = uniteTypeIdDonnees[1];
|
- |
|
523 |
String[] uniteDonnees = uniteChaineDonnees.split(Pattern.quote(aDonnee.SEPARATEUR_DONNEES));
|
- |
|
524 |
|
- |
|
525 |
UniteBase uniteBase = new UniteBase();
|
- |
|
526 |
uniteBase.setId(uniteTypeIdDonnees[0]);
|
- |
|
527 |
if (uniteDonnees.length > 0) {
|
- |
|
528 |
uniteBase.setNombre(UtilString.formaterEnEntier(uniteDonnees[0]));
|
- |
|
529 |
}
|
- |
|
530 |
if (uniteDonnees.length > 1) {
|
- |
|
531 |
uniteBase.setPrecision(getPrecisionNom(uniteDonnees[1]));
|
- |
|
532 |
}
|
- |
|
533 |
if (uniteDonnees.length > 2) {
|
- |
|
534 |
uniteBase.setFormat(uniteDonnees[2]);
|
- |
|
535 |
}
|
- |
|
536 |
if (uniteDonnees.length > 3) {
|
- |
|
537 |
uniteBase.setNombrePart(UtilString.formaterEnEntier(uniteDonnees[3]));
|
- |
|
538 |
}
|
- |
|
539 |
if (uniteDonnees.length > 4) {
|
- |
|
540 |
uniteBase.setPrecisionPart(getPrecisionNom(uniteDonnees[4]));
|
- |
|
541 |
}
|
- |
|
542 |
if (uniteDonnees.length > 5) {
|
- |
|
543 |
uniteBase.setNombreSp(UtilString.formaterEnEntier(uniteDonnees[5]));
|
- |
|
544 |
}
|
- |
|
545 |
if (uniteDonnees.length > 6) {
|
- |
|
546 |
uniteBase.setPrecisionSp(getPrecisionNom(uniteDonnees[6]));
|
- |
|
547 |
Debug.log(uniteTypeIdDonnees[0]+"/"+uniteTypeIdDonnees[1]+"/"+uniteDonnees[0]+"-"+uniteDonnees[1]+"-"+uniteDonnees[2]+uniteDonnees[3]+"-"+uniteDonnees[4]+"-"+uniteDonnees[5]);
|
- |
|
548 |
}
|
- |
|
549 |
unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteBase);
|
- |
|
550 |
}
|
- |
|
551 |
|
- |
|
552 |
ArrayList<UniteBase> listeUniteMaj = new ArrayList<UniteBase>();
|
- |
|
553 |
int nbreUnite = uniteBaseGrille.getStore().getCount();
|
- |
|
554 |
for (int i = 0; i < nbreUnite; i++) {
|
- |
|
555 |
UniteBase uniteDansGrille = uniteBaseGrille.getStore().getAt(i);
|
- |
|
556 |
UniteBase uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
|
- |
|
557 |
if (uniteEnregistree != null) {
|
- |
|
558 |
uniteEnregistree.setType(uniteDansGrille.getType());
|
- |
|
559 |
listeUniteMaj.add(uniteEnregistree);
|
- |
|
560 |
} else {
|
- |
|
561 |
listeUniteMaj.add(uniteDansGrille);
|
- |
|
562 |
}
|
- |
|
563 |
}
|
- |
|
564 |
uniteBaseGrille.getStore().removeAll();
|
- |
|
565 |
uniteBaseGrille.getStore().add(listeUniteMaj);
|
- |
|
566 |
layout();
|
- |
|
567 |
}
|
- |
|
568 |
}
|
491 |
|
569 |
|
492 |
private ToolBar creerBarreOutilsGrilleUniteBase() {
|
570 |
private ToolBar creerBarreOutilsGrilleUniteBase() {
|
493 |
ToolBar barreOutils = new ToolBar();
|
571 |
ToolBar barreOutils = new ToolBar();
|
494 |
|
572 |
|
495 |
Button ajouterBouton = creerBoutonAjouterUniteBase();
|
573 |
Button ajouterBouton = creerBoutonAjouterUniteBase();
|
496 |
barreOutils.add(ajouterBouton);
|
574 |
barreOutils.add(ajouterBouton);
|
497 |
|
575 |
|
498 |
barreOutils.add(new SeparatorToolItem());
|
576 |
barreOutils.add(new SeparatorToolItem());
|
499 |
|
577 |
|
500 |
Button supprimerBouton = creerBoutonSupprimerUniteBase();
|
578 |
Button supprimerBouton = creerBoutonSupprimerUniteBase();
|
501 |
barreOutils.add(supprimerBouton);
|
579 |
barreOutils.add(supprimerBouton);
|
502 |
|
580 |
|
503 |
return barreOutils;
|
581 |
return barreOutils;
|
504 |
}
|
582 |
}
|
505 |
|
583 |
|
506 |
private Button creerBoutonAjouterUniteBase() {
|
584 |
private Button creerBoutonAjouterUniteBase() {
|
507 |
Button bouton = new Button(i18nC.ajouter());
|
585 |
Button bouton = new Button(i18nC.ajouter());
|
508 |
bouton.setIcon(Images.ICONES.ajouter());
|
586 |
bouton.setIcon(Images.ICONES.ajouter());
|
509 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
587 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
510 |
@Override
|
588 |
@Override
|
511 |
public void componentSelected(ButtonEvent ce) {
|
589 |
public void componentSelected(ButtonEvent ce) {
|
512 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteBaseSaisirType());
|
590 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteBaseSaisirType());
|
513 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
591 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
514 |
public void handleEvent(MessageBoxEvent be) {
|
592 |
public void handleEvent(MessageBoxEvent be) {
|
515 |
final UniteBase unite = new UniteBase();
|
593 |
final UniteBase unite = new UniteBase();
|
516 |
unite.setType(be.getValue());
|
594 |
unite.setType(be.getValue());
|
517 |
unite.setTypeAutre(true);
|
595 |
unite.setTypeAutre(true);
|
518 |
uniteBaseGrille.getStore().add(unite);
|
596 |
uniteBaseGrille.getStore().add(unite);
|
519 |
}
|
597 |
}
|
520 |
});
|
598 |
});
|
521 |
}
|
599 |
}
|
522 |
});
|
600 |
});
|
523 |
return bouton;
|
601 |
return bouton;
|
524 |
}
|
602 |
}
|
525 |
|
603 |
|
526 |
private Button creerBoutonSupprimerUniteBase() {
|
604 |
private Button creerBoutonSupprimerUniteBase() {
|
527 |
Button bouton = new Button(i18nC.supprimer());
|
605 |
Button bouton = new Button(i18nC.supprimer());
|
528 |
bouton.setIcon(Images.ICONES.supprimer());
|
606 |
bouton.setIcon(Images.ICONES.supprimer());
|
529 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
607 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
530 |
@Override
|
608 |
@Override
|
531 |
public void componentSelected(ButtonEvent ce) {
|
609 |
public void componentSelected(ButtonEvent ce) {
|
532 |
UniteBase uniteBaseSelectionnee = uniteBaseGrille.getSelectionModel().getSelectedItem();
|
610 |
UniteBase uniteBaseSelectionnee = uniteBaseGrille.getSelectionModel().getSelectedItem();
|
533 |
if (uniteBaseSelectionnee == null) {
|
611 |
if (uniteBaseSelectionnee == null) {
|
534 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteBase()));
|
612 |
Info.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteBase()));
|
535 |
} else if (uniteBaseSelectionnee.getTypeAutre() == false) {
|
613 |
} else if (uniteBaseSelectionnee.getTypeAutre() == false) {
|
536 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteBaseAjoute());
|
614 |
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteBaseAjoute());
|
537 |
} else {
|
615 |
} else {
|
538 |
uniteBaseGrille.getStore().remove(uniteBaseSelectionnee);
|
616 |
uniteBaseGrille.getStore().remove(uniteBaseSelectionnee);
|
539 |
}
|
617 |
}
|
540 |
}
|
618 |
}
|
541 |
});
|
619 |
});
|
542 |
return bouton;
|
620 |
return bouton;
|
543 |
}
|
621 |
}
|
544 |
|
622 |
|
545 |
private void creerFieldsetConservation() {
|
623 |
private void creerFieldsetConservation() {
|
546 |
FieldSet conservationFieldSet = new FieldSet();
|
624 |
FieldSet conservationFieldSet = new FieldSet();
|
547 |
conservationFieldSet.setHeading("Conservation");
|
625 |
conservationFieldSet.setHeading("Conservation");
|
548 |
conservationFieldSet.setCollapsible(true);
|
626 |
conservationFieldSet.setCollapsible(true);
|
549 |
conservationFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
627 |
conservationFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
550 |
|
628 |
|
551 |
typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
|
629 |
typePapierConservationChp = new ChampCaseACocher(i18nC.typePapierConservation(), "typePapier", true);
|
552 |
conservationFieldSet.add(typePapierConservationChp);
|
630 |
conservationFieldSet.add(typePapierConservationChp);
|
553 |
|
631 |
|
554 |
methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
|
632 |
methodeConservationChp = new ChampCaseACocher(i18nC.methodeConservation(), "methodeRangement", true);
|
555 |
conservationFieldSet.add(methodeConservationChp);
|
633 |
conservationFieldSet.add(methodeConservationChp);
|
556 |
|
634 |
|
557 |
this.add(conservationFieldSet);
|
635 |
this.add(conservationFieldSet);
|
558 |
}
|
636 |
}
|
559 |
|
637 |
|
560 |
private void creerFieldsetEtiquette() {
|
638 |
private void creerFieldsetEtiquette() {
|
561 |
FieldSet etiquetteFieldSet = new FieldSet();
|
639 |
FieldSet etiquetteFieldSet = new FieldSet();
|
562 |
etiquetteFieldSet.setHeading("Conservation");
|
640 |
etiquetteFieldSet.setHeading("Conservation");
|
563 |
etiquetteFieldSet.setCollapsible(true);
|
641 |
etiquetteFieldSet.setCollapsible(true);
|
564 |
etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
642 |
etiquetteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
565 |
|
643 |
|
566 |
Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
|
644 |
Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
|
567 |
etiquetteFieldSet.add(fixationPoucentLabel);
|
645 |
etiquetteFieldSet.add(fixationPoucentLabel);
|
568 |
|
646 |
|
569 |
specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
|
647 |
specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
|
570 |
etiquetteFieldSet.add(specimenFixationPourcentChp, new FormData(200, 0));
|
648 |
etiquetteFieldSet.add(specimenFixationPourcentChp, new FormData(200, 0));
|
571 |
|
649 |
|
572 |
etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
|
650 |
etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
|
573 |
etiquetteFieldSet.add(etiquetteFixationPourcentChp, new FormData(200, 0));
|
651 |
etiquetteFieldSet.add(etiquetteFixationPourcentChp, new FormData(200, 0));
|
574 |
|
652 |
|
575 |
specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
|
653 |
specimentMethodeFixationChp = new ChampCaseACocher(i18nC.specimenMethodeFixation(), "methodeFixation", true);
|
576 |
etiquetteFieldSet.add(specimentMethodeFixationChp);
|
654 |
etiquetteFieldSet.add(specimentMethodeFixationChp);
|
577 |
|
655 |
|
578 |
etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
|
656 |
etiquetteMethodeFixationSurSupportChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSupport(), "methodeFixation", true);
|
579 |
etiquetteFieldSet.add(etiquetteMethodeFixationSurSupportChp);
|
657 |
etiquetteFieldSet.add(etiquetteMethodeFixationSurSupportChp);
|
580 |
|
658 |
|
581 |
etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
|
659 |
etiquetteMethodeFixationSurSpecimenChp = new ChampCaseACocher(i18nC.etiquetteMethodeFixationSurSpecimen(), "methodeFixationSurSpecimen", true);
|
582 |
etiquetteFieldSet.add(etiquetteMethodeFixationSurSpecimenChp);
|
660 |
etiquetteFieldSet.add(etiquetteMethodeFixationSurSpecimenChp);
|
583 |
|
661 |
|
584 |
typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
|
662 |
typeEcritureChp = new ChampCaseACocher(i18nC.typeEcriture(), "typeEcriture", false);
|
585 |
etiquetteFieldSet.add(typeEcritureChp);
|
663 |
etiquetteFieldSet.add(typeEcritureChp);
|
586 |
|
664 |
|
587 |
this.add(etiquetteFieldSet);
|
665 |
this.add(etiquetteFieldSet);
|
588 |
}
|
666 |
}
|
589 |
|
667 |
|
590 |
private void creerFieldsetTraitement() {
|
668 |
private void creerFieldsetTraitement() {
|
591 |
FieldSet traitementFieldSet = new FieldSet();
|
669 |
FieldSet traitementFieldSet = new FieldSet();
|
592 |
traitementFieldSet.setHeading("Traitements");
|
670 |
traitementFieldSet.setHeading("Traitements");
|
593 |
traitementFieldSet.setCollapsible(true);
|
671 |
traitementFieldSet.setCollapsible(true);
|
594 |
traitementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
672 |
traitementFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
595 |
|
673 |
|
596 |
traitementCombo = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
|
674 |
traitementCombo = new ChampComboBoxListeValeurs(i18nC.collectionTraitement(), "onpi");
|
597 |
traitementCombo.setTrie("id_valeur");
|
675 |
traitementCombo.setTrie("id_valeur");
|
598 |
traitementFieldSet.add(traitementCombo, new FormData(300, 0));
|
676 |
traitementFieldSet.add(traitementCombo, new FormData(300, 0));
|
599 |
|
677 |
|
600 |
poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
|
678 |
poisonTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementPoison(), "poisonTraitement", true);
|
601 |
traitementFieldSet.add(poisonTraitementChp);
|
679 |
traitementFieldSet.add(poisonTraitementChp);
|
602 |
|
680 |
|
603 |
insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
|
681 |
insecteTraitementChp = new ChampCaseACocher(i18nC.collectionTraitementInsecte(), "insecteTraitement", true);
|
604 |
traitementFieldSet.add(insecteTraitementChp);
|
682 |
traitementFieldSet.add(insecteTraitementChp);
|
605 |
|
683 |
|
606 |
this.add(traitementFieldSet);
|
684 |
this.add(traitementFieldSet);
|
607 |
}
|
685 |
}
|
608 |
|
686 |
|
609 |
private void creerFieldsetEtat() {
|
687 |
private void creerFieldsetEtat() {
|
610 |
FieldSet etatFieldSet = new FieldSet();
|
688 |
FieldSet etatFieldSet = new FieldSet();
|
611 |
etatFieldSet.setHeading("État général et dégradation");
|
689 |
etatFieldSet.setHeading("État général et dégradation");
|
612 |
etatFieldSet.setCollapsible(true);
|
690 |
etatFieldSet.setCollapsible(true);
|
613 |
etatFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
691 |
etatFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
|
614 |
|
692 |
|
615 |
etatGeneralCombo = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
|
693 |
etatGeneralCombo = new ChampComboBoxListeValeurs(i18nC.collectionEtatGeneral(), "etat");
|
616 |
etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
|
694 |
etatGeneralCombo.setToolTip(i18nC.collectionEtatGeneralInfo());
|
617 |
etatGeneralCombo.setTrie("id_valeur");
|
695 |
etatGeneralCombo.setTrie("id_valeur");
|
618 |
etatFieldSet.add(etatGeneralCombo, new FormData(300, 0));
|
696 |
etatFieldSet.add(etatGeneralCombo, new FormData(300, 0));
|
619 |
|
697 |
|
620 |
specimenDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationSpecimen(), 150, true);
|
698 |
specimenDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationSpecimen(), 150, true);
|
621 |
specimenDegradationChp.initialiserType("specimenDegradation");
|
699 |
specimenDegradationChp.initialiserType("specimenDegradation");
|
622 |
specimenDegradationChp.initialiserCombobox("niveauImportance");
|
700 |
specimenDegradationChp.initialiserCombobox("niveauImportance");
|
623 |
etatFieldSet.add(specimenDegradationChp);
|
701 |
etatFieldSet.add(specimenDegradationChp);
|
624 |
|
702 |
|
625 |
presentationDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationPresentation(), 150, 200, true);
|
703 |
presentationDegradationChp = new ChampMultiValeursMultiTypes(i18nC.degradationPresentation(), 150, 200, true);
|
626 |
presentationDegradationChp.initialiserType("supportDegradation");
|
704 |
presentationDegradationChp.initialiserType("supportDegradation");
|
627 |
presentationDegradationChp.initialiserCombobox("niveauImportance");
|
705 |
presentationDegradationChp.initialiserCombobox("niveauImportance");
|
628 |
etatFieldSet.add(presentationDegradationChp);
|
706 |
etatFieldSet.add(presentationDegradationChp);
|
629 |
|
707 |
|
630 |
determinationCombo = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
|
708 |
determinationCombo = new ChampComboBoxListeValeurs(i18nC.collectionDetermination(), "niveauDetermination");
|
631 |
determinationCombo.setTrie("id_valeur");
|
709 |
determinationCombo.setTrie("id_valeur");
|
632 |
etatFieldSet.add(determinationCombo, new FormData(450, 0));
|
710 |
etatFieldSet.add(determinationCombo, new FormData(450, 0));
|
633 |
|
711 |
|
634 |
this.add(etatFieldSet);
|
712 |
this.add(etatFieldSet);
|
635 |
}
|
713 |
}
|
636 |
|
714 |
|
637 |
public void peupler() {
|
715 |
public void peupler() {
|
638 |
initialiserCollection();
|
716 |
initialiserCollection();
|
639 |
if (collectionBotanique != null) {
|
717 |
if (collectionBotanique != null) {
|
640 |
typesCollectionBotaCombo.peupler(collectionBotanique.getType());
|
718 |
typesCollectionBotaCombo.peupler(collectionBotanique.getType());
|
641 |
if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
|
719 |
if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
|
642 |
nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
|
720 |
nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
|
643 |
}
|
721 |
}
|
644 |
peuplerGrilleUniteRangement(collectionBotanique.getUniteRangement());
|
722 |
peuplerGrilleUniteRangement(collectionBotanique.getUniteRangement());
|
- |
|
723 |
peuplerGrilleUniteBase(collectionBotanique.getUniteBase());
|
645 |
}
|
724 |
}
|
646 |
}
|
725 |
}
|
647 |
|
726 |
|
648 |
public void collecter() {
|
727 |
public void collecter() {
|
649 |
initialiserCollection();
|
728 |
initialiserCollection();
|
650 |
if (etreAccede()) {
|
729 |
if (etreAccede()) {
|
651 |
collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
|
730 |
collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
|
652 |
collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
|
731 |
collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
|
653 |
collectionBotaniqueCollectee.setUniteRangement(collecterGrilleUniteRangement());
|
732 |
collectionBotaniqueCollectee.setUniteRangement(collecterGrilleUniteRangement());
|
- |
|
733 |
collectionBotaniqueCollectee.setUniteBase(collecterGrilleUniteBase());
|
654 |
Debug.log(collecterGrilleUniteRangement());
|
734 |
Debug.log(collecterGrilleUniteBase());
|
655 |
}
|
735 |
}
|
656 |
}
|
736 |
}
|
657 |
|
737 |
|
658 |
private void initialiserCollection() {
|
738 |
private void initialiserCollection() {
|
659 |
collection = ((CollectionForm) formulaire).collection;
|
739 |
collection = ((CollectionForm) formulaire).collection;
|
660 |
if (collection != null) {
|
740 |
if (collection != null) {
|
661 |
collectionBotanique = collection.getBotanique();
|
741 |
collectionBotanique = collection.getBotanique();
|
662 |
}
|
742 |
}
|
663 |
|
743 |
|
664 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
744 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
665 |
if (collectionCollectee != null) {
|
745 |
if (collectionCollectee != null) {
|
666 |
collectionBotaniqueCollectee = collectionCollectee.getBotanique();
|
746 |
collectionBotaniqueCollectee = collectionCollectee.getBotanique();
|
667 |
}
|
747 |
}
|
668 |
}
|
748 |
}
|
669 |
|
749 |
|
670 |
public void rafraichir(Object nouvellesDonnees) {
|
750 |
public void rafraichir(Object nouvellesDonnees) {
|
671 |
if (nouvellesDonnees instanceof ValeurListe) {
|
751 |
if (nouvellesDonnees instanceof ValeurListe) {
|
672 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
752 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
673 |
rafraichirValeurListe(listeValeurs);
|
753 |
rafraichirValeurListe(listeValeurs);
|
674 |
} else {
|
754 |
} else {
|
675 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
755 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
676 |
}
|
756 |
}
|
677 |
}
|
757 |
}
|
678 |
|
758 |
|
679 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
759 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
680 |
if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
|
760 |
if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
|
681 |
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
|
761 |
Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
|
682 |
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
|
762 |
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
|
683 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
763 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
684 |
while (it.hasNext()) {
|
764 |
while (it.hasNext()) {
|
685 |
Valeur valeur = listeValeurs.get(it.next());
|
765 |
Valeur valeur = listeValeurs.get(it.next());
|
686 |
UniteRangement unite = new UniteRangement();
|
766 |
UniteRangement unite = new UniteRangement();
|
687 |
unite.setId(valeur.getId());
|
767 |
unite.setId(valeur.getId());
|
688 |
unite.setType(valeur.getNom());
|
768 |
unite.setType(valeur.getNom());
|
689 |
unite.setTypeAutre(false);
|
769 |
unite.setTypeAutre(false);
|
690 |
uniteRangementGrille.getStore().add(unite);
|
770 |
uniteRangementGrille.getStore().add(unite);
|
691 |
}
|
771 |
}
|
692 |
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
|
772 |
} else if (listeValeurs.getId().equals(config.getListeId("typeUniteBase"))) {
|
693 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
773 |
Iterator<String> it = listeValeurs.keySet().iterator();
|
694 |
while (it.hasNext()) {
|
774 |
while (it.hasNext()) {
|
695 |
Valeur valeur = listeValeurs.get(it.next());
|
775 |
Valeur valeur = listeValeurs.get(it.next());
|
696 |
UniteBase unite = new UniteBase();
|
776 |
UniteBase unite = new UniteBase();
|
697 |
unite.setId(valeur.getId());
|
777 |
unite.setId(valeur.getId());
|
698 |
unite.setType(valeur.getNom());
|
778 |
unite.setType(valeur.getNom());
|
699 |
unite.setTypeAutre(false);
|
779 |
unite.setTypeAutre(false);
|
700 |
uniteBaseGrille.getStore().add(unite);
|
780 |
uniteBaseGrille.getStore().add(unite);
|
701 |
}
|
781 |
}
|
702 |
} else {
|
782 |
} else {
|
703 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
783 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
704 |
}
|
784 |
}
|
705 |
}
|
785 |
}
|
706 |
}
|
786 |
}
|