| Line 8... |
Line 8... |
| 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.composants.InfoLogger;
|
- |
|
| 14 |
import org.tela_botanica.client.composants.ChampNombre;
|
13 |
import org.tela_botanica.client.composants.ChampNombre;
|
| 15 |
import org.tela_botanica.client.images.Images;
|
- |
|
| 16 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
14 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| 17 |
import org.tela_botanica.client.modeles.InterneValeur;
|
15 |
import org.tela_botanica.client.modeles.InterneValeur;
|
| 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;
|
- |
|
| 21 |
import org.tela_botanica.client.modeles.collection.Collection;
|
18 |
import org.tela_botanica.client.modeles.collection.Collection;
|
| 22 |
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
|
19 |
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
|
| 23 |
import org.tela_botanica.client.modeles.collection.UniteBase;
|
20 |
import org.tela_botanica.client.modeles.collection.UniteBase;
|
| 24 |
import org.tela_botanica.client.modeles.collection.UniteRangement;
|
21 |
import org.tela_botanica.client.modeles.collection.UniteRangement;
|
| 25 |
import org.tela_botanica.client.util.Debug;
|
22 |
import org.tela_botanica.client.util.Debug;
|
| 26 |
import org.tela_botanica.client.util.Pattern;
|
- |
|
| 27 |
import org.tela_botanica.client.util.UtilNombre;
|
- |
|
| 28 |
import org.tela_botanica.client.util.UtilString;
|
23 |
import org.tela_botanica.client.util.UtilString;
|
| 29 |
import org.tela_botanica.client.vues.Formulaire;
|
24 |
import org.tela_botanica.client.vues.Formulaire;
|
| 30 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
25 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
| 31 |
|
- |
|
| 32 |
import com.extjs.gxt.ui.client.Style.Scroll;
|
- |
|
| 33 |
import com.extjs.gxt.ui.client.event.BaseEvent;
|
- |
|
| 34 |
import com.extjs.gxt.ui.client.event.ButtonEvent;
|
- |
|
| 35 |
import com.extjs.gxt.ui.client.event.ComponentEvent;
|
- |
|
| 36 |
import com.extjs.gxt.ui.client.event.Events;
|
26 |
import com.extjs.gxt.ui.client.event.Events;
|
| 37 |
import com.extjs.gxt.ui.client.event.FieldEvent;
|
27 |
import com.extjs.gxt.ui.client.event.FieldEvent;
|
| 38 |
import com.extjs.gxt.ui.client.event.Listener;
|
28 |
import com.extjs.gxt.ui.client.event.Listener;
|
| 39 |
import com.extjs.gxt.ui.client.event.MessageBoxEvent;
|
- |
|
| 40 |
import com.extjs.gxt.ui.client.event.SelectionListener;
|
- |
|
| 41 |
import com.extjs.gxt.ui.client.store.ListStore;
|
29 |
import com.extjs.gxt.ui.client.store.ListStore;
|
| 42 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
- |
|
| 43 |
import com.extjs.gxt.ui.client.widget.Info;
|
30 |
import com.extjs.gxt.ui.client.widget.Label;
|
| 44 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
- |
|
| 45 |
import com.extjs.gxt.ui.client.widget.Text;
|
31 |
import com.extjs.gxt.ui.client.widget.Text;
|
| 46 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
- |
|
| 47 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
| 48 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
32 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
| 49 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
- |
|
| 50 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
33 |
import com.extjs.gxt.ui.client.widget.form.NumberField;
|
| 51 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
34 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
| 52 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
35 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
| 53 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
- |
|
| 54 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
36 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
| 55 |
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
|
- |
|
| 56 |
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
|
- |
|
| 57 |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
|
- |
|
| 58 |
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
|
- |
|
| 59 |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
|
- |
|
| 60 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
37 |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
|
| 61 |
import com.extjs.gxt.ui.client.widget.grid.Grid;
|
- |
|
| 62 |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
|
- |
|
| 63 |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
|
- |
|
| 64 |
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
|
- |
|
| 65 |
import com.extjs.gxt.ui.client.widget.grid.SummaryType;
|
- |
|
| 66 |
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
|
- |
|
| 67 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
38 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
| 68 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
39 |
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
|
| 69 |
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
|
- |
|
| 70 |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
|
- |
|
| 71 |
import com.google.gwt.event.dom.client.KeyCodes;
|
- |
|
| 72 |
import com.google.gwt.i18n.client.NumberFormat;
|
40 |
import com.google.gwt.i18n.client.NumberFormat;
|
| - |
|
41 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
| Line 73... |
Line 42... |
| 73 |
|
42 |
|
| Line 74... |
Line 43... |
| 74 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
43 |
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
|
| 75 |
|
44 |
|
| Line 101... |
Line 70... |
| 101 |
private ChampMultiValeursMultiTypes specimenDegradationChp = null;
|
70 |
private ChampMultiValeursMultiTypes specimenDegradationChp = null;
|
| 102 |
private ChampMultiValeursMultiTypes presentationDegradationChp = null;
|
71 |
private ChampMultiValeursMultiTypes presentationDegradationChp = null;
|
| 103 |
private Text labelPresentationDegradationChp = null;
|
72 |
private Text labelPresentationDegradationChp = null;
|
| 104 |
private ChampNombre planchesHerbier = null;
|
73 |
private ChampNombre planchesHerbier = null;
|
| 105 |
private ChampNombre nbEspeces = null;
|
74 |
private ChampNombre nbEspeces = null;
|
| - |
|
75 |
private ChampNombre nbCartonsHerbier = null;
|
| - |
|
76 |
private TextField<String> cartonsHerbierFormat = null;
|
| - |
|
77 |
private ChampNombre nbLiasses = null;
|
| - |
|
78 |
private TextField<String> liassesFormat = null;
|
| - |
|
79 |
private TextArea autresUnitesRangement = null;
|
| Line 106... |
Line 80... |
| 106 |
|
80 |
|
| 107 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
81 |
public CollectionFormDescription(Formulaire formulaireCourrant) {
|
| 108 |
initialiserOnglet(formulaireCourrant);
|
82 |
initialiserOnglet(formulaireCourrant);
|
| 109 |
setId(ID);
|
83 |
setId(ID);
|
| Line 151... |
Line 125... |
| 151 |
precisionStore = new ListStore<InterneValeur>();
|
125 |
precisionStore = new ListStore<InterneValeur>();
|
| 152 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, Mediateur.i18nC.precisionApproximatif()));
|
126 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_APPROXIMATIF, Mediateur.i18nC.precisionApproximatif()));
|
| 153 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, Mediateur.i18nC.precisionExact()));
|
127 |
precisionStore.add(new InterneValeur(UniteRangement.COMPTE_EXACT, Mediateur.i18nC.precisionExact()));
|
| 154 |
}
|
128 |
}
|
| 155 |
}
|
129 |
}
|
| 156 |
|
- |
|
| 157 |
private static String getPrecisionNom(String precisionAbr) {
|
- |
|
| 158 |
String precision = "";
|
- |
|
| 159 |
if (!precisionAbr.equals("NULL")) {
|
- |
|
| 160 |
creerStorePrecision();
|
- |
|
| 161 |
InterneValeur precisionValeur = precisionStore.findModel("abr", precisionAbr);
|
- |
|
| 162 |
if (precisionValeur != null && !precisionValeur.getNom().equals("NULL")) {
|
- |
|
| 163 |
precision = precisionValeur.getNom();
|
- |
|
| 164 |
}
|
- |
|
| 165 |
}
|
- |
|
| 166 |
return precision;
|
- |
|
| 167 |
}
|
- |
|
| 168 |
|
- |
|
| 169 |
private static String getPrecisionAbr(String precisionNom) {
|
- |
|
| 170 |
String precision = "";
|
- |
|
| 171 |
if (!precisionNom.equals("NULL")) {
|
- |
|
| 172 |
creerStorePrecision();
|
- |
|
| 173 |
InterneValeur precisionValeur = precisionStore.findModel("nom", precisionNom);
|
- |
|
| 174 |
if (precisionValeur != null) {
|
- |
|
| 175 |
precision = precisionValeur.getAbr();
|
- |
|
| 176 |
}
|
- |
|
| 177 |
}
|
- |
|
| 178 |
return precision;
|
- |
|
| 179 |
}
|
- |
|
| 180 |
|
- |
|
| 181 |
private ComboBox<InterneValeur> getChampPrecision() {
|
- |
|
| 182 |
ComboBox<InterneValeur> precisionCombo = new ComboBox<InterneValeur>();
|
- |
|
| 183 |
precisionCombo.setForceSelection(true);
|
- |
|
| 184 |
precisionCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 185 |
precisionCombo.setDisplayField("nom");
|
- |
|
| 186 |
precisionCombo.setStore(precisionStore);
|
- |
|
| 187 |
precisionCombo.setEditable(false);
|
- |
|
| 188 |
return precisionCombo;
|
- |
|
| 189 |
}
|
- |
|
| 190 |
|
- |
|
| 191 |
/**
|
- |
|
| 192 |
* La classe NumberField est sujette à un bug qui empeche son
|
- |
|
| 193 |
* édition dans firefox, il faut donc la surcharger
|
- |
|
| 194 |
**/
|
- |
|
| 195 |
private NumberField creerChampNombre() {
|
- |
|
| 196 |
ChampNombre champNombre = new ChampNombre();
|
- |
|
| 197 |
return champNombre;
|
- |
|
| 198 |
}
|
- |
|
| 199 |
|
- |
|
| 200 |
private ContentPanel creerUniteRangement() {
|
- |
|
| 201 |
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
|
- |
|
| 202 |
|
- |
|
| 203 |
uniteRangementGrille = creerGrilleUniteRangement();
|
- |
|
| 204 |
mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement", null);
|
- |
|
| 205 |
panneauGrille.add(uniteRangementGrille);
|
- |
|
| 206 |
|
- |
|
| 207 |
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
|
- |
|
| 208 |
panneauGrille.setTopComponent(barreOutils);
|
- |
|
| 209 |
|
- |
|
| 210 |
return panneauGrille;
|
- |
|
| 211 |
}
|
- |
|
| 212 |
|
- |
|
| 213 |
private ContentPanel creerPanneauContenantGrille(String titre) {
|
- |
|
| 214 |
ContentPanel panneau = new ContentPanel();
|
- |
|
| 215 |
panneau.setHeadingHtml(titre);
|
- |
|
| 216 |
panneau.setIcon(Images.ICONES.table());
|
- |
|
| 217 |
panneau.setLayout(new FitLayout());
|
- |
|
| 218 |
panneau.setFrame(true);
|
- |
|
| 219 |
panneau.setSize(800, 200);
|
- |
|
| 220 |
panneau.setScrollMode(Scroll.NONE);
|
- |
|
| 221 |
panneau.setCollapsible(true);
|
- |
|
| 222 |
panneau.setStyleAttribute("margin", "5px 0");
|
- |
|
| 223 |
|
- |
|
| 224 |
return panneau;
|
- |
|
| 225 |
}
|
- |
|
| 226 |
|
- |
|
| 227 |
private EditorGrid<UniteRangement> creerGrilleUniteRangement() {
|
- |
|
| 228 |
ListStore<UniteRangement> storeGrille = new ListStore<UniteRangement>();
|
- |
|
| 229 |
|
- |
|
| 230 |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
|
- |
|
| 231 |
colonnes.add(new ColumnConfig("type", i18nC.collectionUniteType(), 150));
|
- |
|
| 232 |
|
- |
|
| 233 |
NumberField champNombre = creerChampNombre();
|
- |
|
| 234 |
champNombre.setFormat(NumberFormat.getFormat("#"));
|
- |
|
| 235 |
ColumnConfig nombreColonne = new ColumnConfig("nombre", i18nC.collectionUniteNbre(), 50);
|
- |
|
| 236 |
nombreColonne.setEditor(new CellEditor(champNombre));
|
- |
|
| 237 |
nombreColonne.setNumberFormat(NumberFormat.getFormat("#"));
|
- |
|
| 238 |
colonnes.add(nombreColonne);
|
- |
|
| 239 |
|
- |
|
| 240 |
CellEditor editeurPrecision = new CellEditor(getChampPrecision()) {
|
- |
|
| 241 |
@Override
|
- |
|
| 242 |
public Object preProcessValue(Object valeur) {
|
- |
|
| 243 |
InterneValeur retour = null;
|
- |
|
| 244 |
if (valeur != null ) {
|
- |
|
| 245 |
if (precisionStore.findModel("nom", valeur.toString()) != null) {
|
- |
|
| 246 |
retour = precisionStore.findModel("nom", valeur.toString());
|
- |
|
| 247 |
} else if (precisionStore.findModel("abr", valeur.toString()) != null) {
|
- |
|
| 248 |
retour = precisionStore.findModel("abr", valeur.toString());
|
- |
|
| 249 |
}
|
- |
|
| 250 |
}
|
- |
|
| 251 |
return retour;
|
- |
|
| 252 |
}
|
- |
|
| 253 |
|
- |
|
| 254 |
@Override
|
- |
|
| 255 |
public Object postProcessValue(Object valeur) {
|
- |
|
| 256 |
String retour = null;
|
- |
|
| 257 |
if (valeur != null ) {
|
- |
|
| 258 |
if (valeur instanceof InterneValeur) {
|
- |
|
| 259 |
InterneValeur valeurInterne = (InterneValeur) valeur;
|
- |
|
| 260 |
retour = valeurInterne.getNom();
|
- |
|
| 261 |
}
|
- |
|
| 262 |
}
|
- |
|
| 263 |
return retour;
|
- |
|
| 264 |
}
|
- |
|
| 265 |
};
|
- |
|
| 266 |
|
- |
|
| 267 |
ColumnConfig precisionColonne = new ColumnConfig("precision", i18nC.collectionUnitePrecision(), 50);
|
- |
|
| 268 |
precisionColonne.setEditor(editeurPrecision);
|
- |
|
| 269 |
colonnes.add(precisionColonne);
|
- |
|
| 270 |
|
- |
|
| 271 |
TextField<String> formatChp = new TextField<String>();
|
- |
|
| 272 |
ColumnConfig formatColonne = new ColumnConfig("format", i18nC.collectionUniteFormat(), 100);
|
- |
|
| 273 |
formatColonne.setEditor(new CellEditor(formatChp));
|
- |
|
| 274 |
colonnes.add(formatColonne);
|
- |
|
| 275 |
|
- |
|
| 276 |
GridSelectionModel<UniteRangement> modeleDeSelection = new GridSelectionModel<UniteRangement>();
|
- |
|
| 277 |
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
|
- |
|
| 278 |
|
- |
|
| 279 |
AggregationRowConfig<UniteBase> total = new AggregationRowConfig<UniteBase>();
|
- |
|
| 280 |
total.setHtml("type", i18nC.total());
|
- |
|
| 281 |
total.setSummaryType("nombre", SummaryType.SUM);
|
- |
|
| 282 |
total.setSummaryFormat("nombre", NumberFormat.getFormat("#"));
|
- |
|
| 283 |
modeleDeColonnes.addAggregationRow(total);
|
- |
|
| 284 |
|
- |
|
| 285 |
EditorGrid<UniteRangement> grilleUniteRangement = new EditorGrid<UniteRangement>(storeGrille, modeleDeColonnes);
|
- |
|
| 286 |
grilleUniteRangement.setHeight(300);
|
- |
|
| 287 |
grilleUniteRangement.setBorders(true);
|
- |
|
| 288 |
grilleUniteRangement.setSelectionModel(modeleDeSelection);
|
- |
|
| 289 |
grilleUniteRangement.getView().setForceFit(true);
|
- |
|
| 290 |
grilleUniteRangement.getView().setAutoFill(true);
|
- |
|
| 291 |
grilleUniteRangement.setAutoExpandColumn("type");
|
- |
|
| 292 |
grilleUniteRangement.setStripeRows(true);
|
- |
|
| 293 |
grilleUniteRangement.setTrackMouseOver(true);
|
- |
|
| 294 |
|
- |
|
| 295 |
return grilleUniteRangement;
|
- |
|
| 296 |
}
|
- |
|
| 297 |
|
- |
|
| 298 |
private String collecterGrilleUniteRangement() {
|
- |
|
| 299 |
String truk = "";
|
- |
|
| 300 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
- |
|
| 301 |
for (int i = 0; i < nbreUnite; i++) {
|
- |
|
| 302 |
UniteRangement unite = uniteRangementGrille.getStore().getAt(i);
|
- |
|
| 303 |
if (unite.getTypeAutre()) {
|
- |
|
| 304 |
truk += unite.getType();
|
- |
|
| 305 |
} else {
|
- |
|
| 306 |
truk += unite.getId();
|
- |
|
| 307 |
}
|
- |
|
| 308 |
truk += aDonnee.SEPARATEUR_TYPE_VALEUR;
|
- |
|
| 309 |
truk += UtilNombre.formaterEnEntier(unite.getNombre())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
| 310 |
truk += getPrecisionAbr(unite.getPrecision())+aDonnee.SEPARATEUR_DONNEES;
|
- |
|
| 311 |
truk += unite.getFormat();
|
- |
|
| 312 |
truk += (i == (nbreUnite - 1)) ? "" : aDonnee.SEPARATEUR_VALEURS;
|
- |
|
| 313 |
|
- |
|
| 314 |
if (truk.matches("^"+aDonnee.SEPARATEUR_DONNEES)) {
|
- |
|
| 315 |
truk = truk.replaceFirst("^"+aDonnee.SEPARATEUR_DONNEES, "");
|
- |
|
| 316 |
}
|
- |
|
| 317 |
|
- |
|
| 318 |
if (truk.matches("^"+aDonnee.SEPARATEUR_TYPE_VALEUR)) {
|
- |
|
| 319 |
truk = truk.replaceFirst("^"+aDonnee.SEPARATEUR_TYPE_VALEUR, "");
|
- |
|
| 320 |
}
|
- |
|
| 321 |
}
|
- |
|
| 322 |
return truk;
|
- |
|
| 323 |
}
|
- |
|
| 324 |
|
- |
|
| 325 |
private void peuplerGrilleUniteRangement(String valeurTruk) {
|
- |
|
| 326 |
if (!UtilString.isEmpty(valeurTruk)) {
|
- |
|
| 327 |
HashMap<String,UniteRangement> unitesEnregistrees = parserValeurUniteRangement(valeurTruk);
|
- |
|
| 328 |
|
- |
|
| 329 |
ArrayList<UniteRangement> listeUniteMaj = new ArrayList<UniteRangement>();
|
- |
|
| 330 |
int nbreUnite = uniteRangementGrille.getStore().getCount();
|
- |
|
| 331 |
for (int i = 0; i < nbreUnite; i++) {
|
- |
|
| 332 |
UniteRangement uniteDansGrille = uniteRangementGrille.getStore().getAt(i);
|
- |
|
| 333 |
UniteRangement uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
|
- |
|
| 334 |
|
- |
|
| 335 |
if (uniteEnregistree != null) {
|
- |
|
| 336 |
uniteEnregistree.setType(uniteDansGrille.getType());
|
- |
|
| 337 |
listeUniteMaj.add(uniteEnregistree);
|
- |
|
| 338 |
} else {
|
- |
|
| 339 |
listeUniteMaj.add(uniteDansGrille);
|
- |
|
| 340 |
}
|
- |
|
| 341 |
}
|
- |
|
| 342 |
|
- |
|
| 343 |
Iterator<String> it = unitesEnregistrees.keySet().iterator();
|
- |
|
| 344 |
while (it.hasNext()) {
|
- |
|
| 345 |
String cle = it.next();
|
- |
|
| 346 |
if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+"[a-zA-Z0-9]+")) {
|
- |
|
| 347 |
UniteRangement uniteAutreEnregistree = unitesEnregistrees.get(cle);
|
- |
|
| 348 |
listeUniteMaj.add(uniteAutreEnregistree);
|
- |
|
| 349 |
}
|
- |
|
| 350 |
}
|
- |
|
| 351 |
|
- |
|
| 352 |
uniteRangementGrille.getStore().removeAll();
|
- |
|
| 353 |
uniteRangementGrille.getStore().add(listeUniteMaj);
|
- |
|
| 354 |
layout();
|
- |
|
| 355 |
}
|
- |
|
| 356 |
}
|
- |
|
| 357 |
|
- |
|
| 358 |
public static HashMap<String,UniteRangement> parserValeurUniteRangement(String valeurTruk) {
|
- |
|
| 359 |
HashMap<String,UniteRangement> unitesEnregistrees = new HashMap<String,UniteRangement>();
|
- |
|
| 360 |
if (!UtilString.isEmpty(valeurTruk)) {
|
- |
|
| 361 |
String[] unites = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
|
- |
|
| 362 |
for (int i = 0; i < unites.length; i++) {
|
- |
|
| 363 |
String[] uniteTypeIdDonnees = unites[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
- |
|
| 364 |
String uniteChaineDonnees = uniteTypeIdDonnees[1];
|
- |
|
| 365 |
String[] uniteDonnees = uniteChaineDonnees.split(Pattern.quote(aDonnee.SEPARATEUR_DONNEES));
|
- |
|
| 366 |
|
- |
|
| 367 |
UniteRangement uniteRangement = new UniteRangement();
|
- |
|
| 368 |
if (uniteDonnees.length > 0) {
|
- |
|
| 369 |
uniteRangement.setNombre(UtilString.formaterEnEntier(uniteDonnees[0]));
|
- |
|
| 370 |
}
|
- |
|
| 371 |
if (uniteDonnees.length > 1) {
|
- |
|
| 372 |
uniteRangement.setPrecision(getPrecisionNom(uniteDonnees[1]));
|
- |
|
| 373 |
}
|
- |
|
| 374 |
if (uniteDonnees.length > 2) {
|
- |
|
| 375 |
uniteRangement.setFormat(uniteDonnees[2]);
|
- |
|
| 376 |
}
|
- |
|
| 377 |
|
- |
|
| 378 |
if (uniteTypeIdDonnees[0].matches("[0-9]+")) {
|
- |
|
| 379 |
uniteRangement.setId(uniteTypeIdDonnees[0]);
|
- |
|
| 380 |
uniteRangement.setTypeAutre(false);
|
- |
|
| 381 |
unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteRangement);
|
- |
|
| 382 |
} else {
|
- |
|
| 383 |
uniteRangement.setType(uniteTypeIdDonnees[0]);
|
- |
|
| 384 |
uniteRangement.setTypeAutre(true);
|
- |
|
| 385 |
String id = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0]+"-"+i;
|
- |
|
| 386 |
uniteRangement.setId(id);
|
- |
|
| 387 |
unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0], uniteRangement);
|
- |
|
| 388 |
}
|
- |
|
| 389 |
}
|
- |
|
| 390 |
}
|
- |
|
| 391 |
return unitesEnregistrees;
|
- |
|
| 392 |
}
|
- |
|
| 393 |
|
- |
|
| 394 |
private ToolBar creerBarreOutilsGrilleUniteRangement() {
|
- |
|
| 395 |
ToolBar barreOutils = new ToolBar();
|
- |
|
| 396 |
|
- |
|
| 397 |
Button ajouterBouton = creerBoutonAjouterUniteRangement();
|
- |
|
| 398 |
barreOutils.add(ajouterBouton);
|
- |
|
| Line 399... |
Line -... |
| 399 |
|
- |
|
| 400 |
barreOutils.add(new SeparatorToolItem());
|
- |
|
| 401 |
|
- |
|
| 402 |
Button supprimerBouton = creerBoutonSupprimerUniteRangement();
|
- |
|
| 403 |
barreOutils.add(supprimerBouton);
|
- |
|
| 404 |
|
- |
|
| 405 |
return barreOutils;
|
- |
|
| 406 |
}
|
- |
|
| 407 |
|
- |
|
| 408 |
private Button creerBoutonAjouterUniteRangement() {
|
- |
|
| 409 |
Button bouton = new Button(i18nC.ajouter());
|
- |
|
| 410 |
bouton.setIcon(Images.ICONES.ajouter());
|
- |
|
| 411 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 412 |
@Override
|
- |
|
| 413 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
| 414 |
final MessageBox box = MessageBox.prompt(i18nC.collectionUniteType(), i18nC.collectionUniteRangementSaisirType());
|
- |
|
| 415 |
box.addCallback(new Listener<MessageBoxEvent>() {
|
- |
|
| 416 |
public void handleEvent(MessageBoxEvent be) {
|
- |
|
| 417 |
if (!UtilString.isEmpty(be.getValue()) && !be.getValue().matches("[0-9]+")) {
|
- |
|
| 418 |
final UniteRangement unite = new UniteRangement();
|
- |
|
| 419 |
unite.setType(be.getValue());
|
- |
|
| 420 |
unite.setTypeAutre(true);
|
- |
|
| 421 |
uniteRangementGrille.getStore().add(unite);
|
- |
|
| 422 |
} else {
|
- |
|
| 423 |
InfoLogger.display("Information", "Vous ne pouvez pas saisir de valeur vide ou numérique");
|
- |
|
| 424 |
}
|
- |
|
| 425 |
}
|
- |
|
| 426 |
});
|
- |
|
| 427 |
}
|
- |
|
| 428 |
});
|
- |
|
| 429 |
return bouton;
|
- |
|
| 430 |
}
|
- |
|
| 431 |
|
- |
|
| 432 |
private Button creerBoutonSupprimerUniteRangement() {
|
- |
|
| 433 |
Button bouton = new Button(i18nC.supprimer());
|
- |
|
| 434 |
bouton.setIcon(Images.ICONES.supprimer());
|
- |
|
| 435 |
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
- |
|
| 436 |
@Override
|
- |
|
| 437 |
public void componentSelected(ButtonEvent ce) {
|
- |
|
| 438 |
UniteRangement uniteRangementSelectionnee = uniteRangementGrille.getSelectionModel().getSelectedItem();
|
- |
|
| 439 |
if (uniteRangementSelectionnee == null) {
|
- |
|
| 440 |
InfoLogger.display(i18nC.informationTitreGenerique(), Mediateur.i18nM.veuillezSelectionner(i18nC.selectionnerUniteRangement()));
|
- |
|
| 441 |
} else if (uniteRangementSelectionnee.getTypeAutre() == false) {
|
- |
|
| 442 |
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerUniteRangementAjoute());
|
- |
|
| 443 |
} else {
|
- |
|
| 444 |
uniteRangementGrille.getStore().remove(uniteRangementSelectionnee);
|
- |
|
| 445 |
}
|
- |
|
| 446 |
}
|
- |
|
| 447 |
});
|
- |
|
| 448 |
return bouton;
|
- |
|
| 449 |
}
|
- |
|
| 450 |
|
130 |
|
| 451 |
private void creerFieldsetConservation() {
|
131 |
private void creerFieldsetConservation() {
|
| 452 |
FieldSet conservationFieldSet = new FieldSet();
|
132 |
FieldSet conservationFieldSet = new FieldSet();
|
| 453 |
conservationFieldSet.setHeadingHtml(i18nC.collectionTitreConservation());
|
133 |
conservationFieldSet.setHeadingHtml(i18nC.collectionTitreConservation());
|
| 454 |
conservationFieldSet.setCollapsible(true);
|
134 |
conservationFieldSet.setCollapsible(true);
|
| Line 527... |
Line 207... |
| 527 |
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
|
207 |
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
|
| 528 |
etatUniteRangementCombo.setTrie("id_valeur");
|
208 |
etatUniteRangementCombo.setTrie("id_valeur");
|
| 529 |
etatUniteRangementCombo.setWidth(300);
|
209 |
etatUniteRangementCombo.setWidth(300);
|
| 530 |
etatTypesUniteFieldSet.add(etatUniteRangementCombo);
|
210 |
etatTypesUniteFieldSet.add(etatUniteRangementCombo);
|
| Line -... |
Line 211... |
| - |
|
211 |
|
| - |
|
212 |
// Liasses et cartons d'herbier
|
| - |
|
213 |
Label labelcartonsHerbiersFormat = new Label(i18nC.collectionCartonsHerbiers());
|
| - |
|
214 |
labelcartonsHerbiersFormat.setStyleName("labelChampNombreFormat");
|
| - |
|
215 |
|
| - |
|
216 |
nbCartonsHerbier = new ChampNombre();
|
| - |
|
217 |
nbCartonsHerbier.setStyleName("champNombreFormat");
|
| - |
|
218 |
nbCartonsHerbier.setWidth(55);
|
| - |
|
219 |
nbCartonsHerbier.setEmptyText(i18nC.collectionUniteNbre());
|
| - |
|
220 |
|
| - |
|
221 |
cartonsHerbierFormat = new TextField<String>();
|
| - |
|
222 |
cartonsHerbierFormat.setStyleName("champNombreFormat");
|
| - |
|
223 |
cartonsHerbierFormat.setEmptyText(i18nC.collectionUniteFormat());
|
| - |
|
224 |
|
| - |
|
225 |
HorizontalPanel conteneurCartonsHerbiers = new HorizontalPanel();
|
| - |
|
226 |
conteneurCartonsHerbiers.setBorderWidth(0);
|
| - |
|
227 |
|
| - |
|
228 |
conteneurCartonsHerbiers.add(labelcartonsHerbiersFormat);
|
| - |
|
229 |
conteneurCartonsHerbiers.add(nbCartonsHerbier);
|
| - |
|
230 |
conteneurCartonsHerbiers.add(cartonsHerbierFormat);
|
| - |
|
231 |
|
| - |
|
232 |
etatTypesUniteFieldSet.add(conteneurCartonsHerbiers);
|
| - |
|
233 |
|
| - |
|
234 |
Label labelLiasses = new Label(i18nC.collectionLiasses());
|
| - |
|
235 |
labelLiasses.setStyleName("labelChampNombreFormat");
|
| - |
|
236 |
|
| - |
|
237 |
nbLiasses = new ChampNombre();
|
| - |
|
238 |
nbLiasses.setStyleName("champNombreFormat");
|
| - |
|
239 |
nbLiasses.setWidth(55);
|
| - |
|
240 |
nbLiasses.setEmptyText(i18nC.collectionUniteNbre());
|
| - |
|
241 |
|
| - |
|
242 |
liassesFormat = new TextField<String>();
|
| - |
|
243 |
liassesFormat.setStyleName("champNombreFormat");
|
| - |
|
244 |
liassesFormat.setEmptyText(i18nC.collectionUniteFormat());
|
| - |
|
245 |
|
| - |
|
246 |
HorizontalPanel conteneurLiasses = new HorizontalPanel();
|
| - |
|
247 |
conteneurLiasses.setBorderWidth(0);
|
| - |
|
248 |
|
| - |
|
249 |
conteneurLiasses.add(labelLiasses);
|
| - |
|
250 |
conteneurLiasses.add(nbLiasses);
|
| - |
|
251 |
conteneurLiasses.add(liassesFormat);
|
| - |
|
252 |
|
| - |
|
253 |
etatTypesUniteFieldSet.add(conteneurLiasses);
|
| - |
|
254 |
|
| - |
|
255 |
autresUnitesRangement = new TextArea();
|
| - |
|
256 |
autresUnitesRangement.setStyleName("textAreaAutreUniteRangement");
|
| - |
|
257 |
autresUnitesRangement.setHeight(90);
|
| - |
|
258 |
autresUnitesRangement.setFieldLabel(i18nC.collectionAutreUnitesRangement());
|
| 531 |
|
259 |
|
| 532 |
etatTypesUniteFieldSet.add(creerUniteRangement());
|
260 |
etatTypesUniteFieldSet.add(autresUnitesRangement);
|
| 533 |
|
261 |
|
| 534 |
planchesHerbier = new ChampNombre();
|
262 |
planchesHerbier = new ChampNombre();
|
| Line 535... |
Line 263... |
| 535 |
planchesHerbier.setFieldLabel(i18nC.collectionNbPlanchesHerbier());
|
263 |
planchesHerbier.setFieldLabel(i18nC.collectionNbPlanchesHerbier());
|
| 536 |
|
264 |
|
| Line 589... |
Line 317... |
| 589 |
typesCollectionBotaCombo.peupler(collectionBotanique.getType());
|
317 |
typesCollectionBotaCombo.peupler(collectionBotanique.getType());
|
| 590 |
if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
|
318 |
if (!UtilString.isEmpty(collectionBotanique.getNbreEchantillon())) {
|
| 591 |
nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
|
319 |
nbreEchantillonChp.setValue(Integer.parseInt(collectionBotanique.getNbreEchantillon()));
|
| 592 |
}
|
320 |
}
|
| Line -... |
Line 321... |
| - |
|
321 |
|
| - |
|
322 |
if(!collectionBotanique.getNbCartonsHerbiers().isEmpty()) {
|
| - |
|
323 |
nbCartonsHerbier.setValue((Integer.parseInt(collectionBotanique.getNbCartonsHerbiers())));
|
| - |
|
324 |
}
|
| - |
|
325 |
cartonsHerbierFormat.setValue(collectionBotanique.getFormatCartonsHerbiers());
|
| - |
|
326 |
|
| - |
|
327 |
if(!collectionBotanique.getNbLiasses().isEmpty()) {
|
| - |
|
328 |
nbLiasses.setValue((Integer.parseInt(collectionBotanique.getNbLiasses())));
|
| - |
|
329 |
}
|
| - |
|
330 |
liassesFormat.setValue(collectionBotanique.getFormatLiasses());
|
| 593 |
|
331 |
|
| - |
|
332 |
autresUnitesRangement.setValue(collectionBotanique.getAutresUnitesRangement());
|
| 594 |
peuplerGrilleUniteRangement(collectionBotanique.getUniteRangement());
|
333 |
|
| Line 595... |
Line 334... |
| 595 |
etatUniteRangementCombo.peupler(collectionBotanique.getUniteRangementEtat());
|
334 |
etatUniteRangementCombo.peupler(collectionBotanique.getUniteRangementEtat());
|
| 596 |
|
335 |
|
| Line 630... |
Line 369... |
| 630 |
collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
|
369 |
collectionBotaniqueCollectee.setType(typesCollectionBotaCombo.getValeur());
|
| 631 |
if (nbreEchantillonChp.getValue() != null) {
|
370 |
if (nbreEchantillonChp.getValue() != null) {
|
| 632 |
collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
|
371 |
collectionBotaniqueCollectee.setNbreEchantillon(Integer.toString(nbreEchantillonChp.getValue().intValue()));
|
| 633 |
}
|
372 |
}
|
| Line -... |
Line 373... |
| - |
|
373 |
|
| - |
|
374 |
collectionBotaniqueCollectee.setNbCartonsHerbiers(nbCartonsHerbier.getValue()+"");
|
| - |
|
375 |
collectionBotaniqueCollectee.setFormatCartonsHerbiers(cartonsHerbierFormat.getValue());
|
| - |
|
376 |
collectionBotaniqueCollectee.setNbLiasses(nbLiasses.getValue()+"");
|
| 634 |
|
377 |
collectionBotaniqueCollectee.setFormatLiasses(liassesFormat.getValue());
|
| - |
|
378 |
collectionBotaniqueCollectee.setAutresUnitesRangement(autresUnitesRangement.getValue());
|
| 635 |
collectionBotaniqueCollectee.setUniteRangement(collecterGrilleUniteRangement());
|
379 |
|
| Line 636... |
Line 380... |
| 636 |
collectionBotaniqueCollectee.setUniteRangementEtat(etatUniteRangementCombo.getValeur());
|
380 |
collectionBotaniqueCollectee.setUniteRangementEtat(etatUniteRangementCombo.getValeur());
|
| 637 |
|
381 |
|