Subversion Repositories eFlore/Applications.coel

Rev

Rev 857 | Rev 859 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 857 Rev 858
Line 6... Line 6...
6
 
6
 
7
import org.tela_botanica.client.Mediateur;
7
import org.tela_botanica.client.Mediateur;
8
import org.tela_botanica.client.composants.ChampCaseACocher;
8
import org.tela_botanica.client.composants.ChampCaseACocher;
9
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
9
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
-
 
10
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
10
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypes;
11
import org.tela_botanica.client.composants.ChampSliderPourcentage;
11
import org.tela_botanica.client.images.Images;
12
import org.tela_botanica.client.images.Images;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.modeles.InterneValeur;
14
import org.tela_botanica.client.modeles.InterneValeur;
14
import org.tela_botanica.client.modeles.UniteBase;
15
import org.tela_botanica.client.modeles.UniteBase;
Line 52... Line 53...
52
import com.google.gwt.core.client.GWT;
53
import com.google.gwt.core.client.GWT;
53
import com.google.gwt.i18n.client.NumberFormat;
54
import com.google.gwt.i18n.client.NumberFormat;
Line 54... Line 55...
54
 
55
 
Line -... Line 56...
-
 
56
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
-
 
57
	
-
 
58
	private ChampComboBoxListeValeurs typesCollectionBotaCombo = null;
55
public class CollectionFormDescription extends FormulaireOnglet implements Rafraichissable {
59
	private TextField<String> coteChp = null;
56
	
60
	private NumberField nbreEchantillonChp = null;
57
	private Grid<UniteRangement> uniteRangementGrille = null;
61
	private Grid<UniteRangement> uniteRangementGrille = null;
58
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
62
	private ChampComboBoxListeValeurs etatUniteRangementCombo = null;
59
	private Grid<UniteBase> uniteBaseGrille = null;
63
	private Grid<UniteBase> uniteBaseGrille = null;
60
	private ChampCaseACocher typePapierConservationChp = null;
64
	private ChampCaseACocher typePapierConservationChp = null;
61
	private ChampCaseACocher methodeConservationChp = null;
65
	private ChampCaseACocher methodeConservationChp = null;
62
	private SliderField specimenFixationPourcentChp = null;
66
	private ChampSliderPourcentage specimenFixationPourcentChp = null;
63
	private SliderField etiquetteFixationPourcentChp = null;
67
	private ChampSliderPourcentage etiquetteFixationPourcentChp = null;
64
	private ChampCaseACocher specimentMethodeFixationChp = null;
68
	private ChampCaseACocher specimentMethodeFixationChp = null;
65
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
69
	private ChampCaseACocher etiquetteMethodeFixationSurSupportChp = null;
66
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
70
	private ChampCaseACocher etiquetteMethodeFixationSurSpecimenChp = null;
Line 80... Line 84...
80
 
84
 
81
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
85
		FormLayout formulaireLayout = (FormLayout) this.getLayout();
82
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
86
		formulaireLayout.setLabelAlign(LabelAlign.LEFT);
Line -... Line 87...
-
 
87
		formulaireLayout.setLabelWidth(300);
-
 
88
		
-
 
89
		typesCollectionBotaCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionBotanique(), "typeCollectionBota");
-
 
90
		typesCollectionBotaCombo.setTabIndex(tabIndex++);
-
 
91
		add(typesCollectionBotaCombo, new FormData(250, 0));
-
 
92
		
-
 
93
		coteChp = new TextField<String>();
-
 
94
		coteChp.setTabIndex(tabIndex++);
-
 
95
		coteChp.setFieldLabel(i18nC.cote());
-
 
96
		add(coteChp, new FormData(450, 0));
-
 
97
		
-
 
98
		nbreEchantillonChp = new NumberField(); 
-
 
99
		nbreEchantillonChp.setFieldLabel(i18nC.nbreEchantillon());
-
 
100
		nbreEchantillonChp.setToolTip(i18nC.nbreEchantillonInfo());
-
 
101
		nbreEchantillonChp.setFormat(NumberFormat.getFormat("#"));
-
 
102
		nbreEchantillonChp.setToolTip(i18nC.champNumerique());
83
		formulaireLayout.setLabelWidth(300);
103
		add(nbreEchantillonChp);
84
		
104
		
Line 85... Line 105...
85
		creerUniteRangement();
105
		creerUniteRangement();
86
		creerUniteBase();
106
		creerUniteBase();
Line 92... Line 112...
92
		add(methodeConservationChp);
112
		add(methodeConservationChp);
Line 93... Line 113...
93
		
113
		
94
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
114
		Text fixationPoucentLabel = new Text(i18nC.fixationPourcent());
Line 95... Line -...
95
		add(fixationPoucentLabel);
-
 
96
		
-
 
97
		Slider specimenFixationPourcentSlider = creerSliderPoucentage(i18nC.specimenFixationPourcent(), specimenFixationPourcentChp);
-
 
98
		specimenFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
-
 
99
			public void handleEvent(SliderEvent be) {
-
 
100
				int pourcent = ((Slider) be.getComponent()).getValue();
-
 
101
				specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent()+" ("+pourcent+"%) ");
-
 
102
			}
-
 
103
		});
115
		add(fixationPoucentLabel);
104
		specimenFixationPourcentChp = new SliderField(specimenFixationPourcentSlider);
116
		
Line 105... Line -...
105
		specimenFixationPourcentChp.setFieldLabel(i18nC.specimenFixationPourcent());
-
 
106
		add(specimenFixationPourcentChp, new FormData(200, 0));
-
 
107
		
-
 
108
		Slider etiquetteFixationPourcentSlider = creerSliderPoucentage(i18nC.etiquetteFixationPourcent(), etiquetteFixationPourcentChp);
-
 
109
		etiquetteFixationPourcentSlider.addListener(Events.Change, new Listener<SliderEvent>() {
-
 
110
			public void handleEvent(SliderEvent be) {
-
 
111
				int pourcent = ((Slider) be.getComponent()).getValue();
-
 
112
				etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent()+" ("+pourcent+"%) ");
-
 
113
			}
117
		specimenFixationPourcentChp = new ChampSliderPourcentage(i18nC.specimenFixationPourcent());
114
		});
118
		add(specimenFixationPourcentChp, new FormData(200, 0));
Line 115... Line 119...
115
		etiquetteFixationPourcentChp = new SliderField(etiquetteFixationPourcentSlider);
119
		
116
		etiquetteFixationPourcentChp.setFieldLabel(i18nC.etiquetteFixationPourcent());
120
		etiquetteFixationPourcentChp = new ChampSliderPourcentage(i18nC.etiquetteFixationPourcent());
Line 162... Line 166...
162
	
166
	
163
	
167
	
164
	private void creerUniteRangement() {
168
	private void creerUniteRangement() {
-
 
169
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
165
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
170
		uniteRangementGrille  = creerGrilleUniteRangement();
166
		uniteRangementGrille  = creerGrilleUniteRangement();
171
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
167
		panneauGrille.add(uniteRangementGrille);
172
		panneauGrille.add(uniteRangementGrille);
168
		ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
173
		ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
Line 259... Line 264...
259
		grilleUniteRangement.getView().setAutoFill(true);
264
		grilleUniteRangement.getView().setAutoFill(true);
260
		grilleUniteRangement.setAutoExpandColumn("type");
265
		grilleUniteRangement.setAutoExpandColumn("type");
261
		grilleUniteRangement.setStripeRows(true);
266
		grilleUniteRangement.setStripeRows(true);
262
		grilleUniteRangement.setTrackMouseOver(true);
267
		grilleUniteRangement.setTrackMouseOver(true);
Line 263... Line -...
263
		
-
 
264
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteRangement");
-
 
265
		
268
		
266
		return grilleUniteRangement;
269
		return grilleUniteRangement;
Line 267... Line 270...
267
	}
270
	}
268
	
271
	
Line 320... Line 323...
320
	}
323
	}
Line 321... Line 324...
321
	
324
	
322
	private void creerUniteBase() {
325
	private void creerUniteBase() {
323
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
326
		ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
-
 
327
		uniteBaseGrille  = creerGrilleUniteBase();
324
		uniteBaseGrille  = creerGrilleUniteBase();
328
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
325
		panneauGrille.add(uniteBaseGrille);
329
		panneauGrille.add(uniteBaseGrille);
326
		ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
330
		ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
327
		panneauGrille.setTopComponent(barreOutils);
331
		panneauGrille.setTopComponent(barreOutils);
328
		add(panneauGrille);		
332
		add(panneauGrille);		
Line 431... Line 435...
431
		grilleUniteBase.getView().setAutoFill(true);
435
		grilleUniteBase.getView().setAutoFill(true);
432
		grilleUniteBase.setAutoExpandColumn("type");
436
		grilleUniteBase.setAutoExpandColumn("type");
433
		grilleUniteBase.setStripeRows(true);
437
		grilleUniteBase.setStripeRows(true);
434
		grilleUniteBase.setTrackMouseOver(true);
438
		grilleUniteBase.setTrackMouseOver(true);
Line 435... Line -...
435
		
-
 
436
		mediateur.obtenirListeValeurEtRafraichir(this, "typeUniteBase");
-
 
437
		
439
		
438
		return grilleUniteBase;
440
		return grilleUniteBase;
Line 439... Line 441...
439
	}
441
	}
440
	
442
	
Line 489... Line 491...
489
			}   
491
			}   
490
		});
492
		});
491
		return bouton;
493
		return bouton;
492
	}
494
	}
Line 493... Line -...
493
	
-
 
494
	private Slider creerSliderPoucentage(final String message, final SliderField champSlider) {
-
 
495
		Slider slider = new Slider();
-
 
496
		slider.setMinValue(0);  
-
 
497
		slider.setMaxValue(100);  
-
 
498
		slider.setValue(0);  
-
 
499
		slider.setIncrement(1);
-
 
500
		slider.setMessage("{0} "+message);
-
 
501
		return slider;
-
 
502
	}
-
 
503
	
495
	
504
	public void rafraichir(Object nouvellesDonnees) {
496
	public void rafraichir(Object nouvellesDonnees) {
505
		if (nouvellesDonnees instanceof ValeurListe) {
497
		if (nouvellesDonnees instanceof ValeurListe) {
506
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
498
			ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
507
			rafraichirValeurListe(listeValeurs);
499
			rafraichirValeurListe(listeValeurs);
508
		} else {
500
		} else {
509
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
501
			GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
510
		}
502
		}
Line 511... Line 503...
511
	}
503
	}
-
 
504
	
-
 
505
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
512
	
506
		if (listeValeurs.getId().equals(config.getListeId("typeCollectionBota"))) {
513
	private void rafraichirValeurListe(ValeurListe listeValeurs) {
507
			Formulaire.rafraichirComboBox(listeValeurs, typesCollectionBotaCombo);
514
		if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
508
		} else if (listeValeurs.getId().equals(config.getListeId("typeUniteRangement"))) {
515
			Iterator<String> it = listeValeurs.keySet().iterator();
509
			Iterator<String> it = listeValeurs.keySet().iterator();
516
			while (it.hasNext()) {
510
			while (it.hasNext()) {
517
				Valeur valeur = listeValeurs.get(it.next());
511
				Valeur valeur = listeValeurs.get(it.next());