Subversion Repositories eFlore/Applications.cel

Rev

Rev 195 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 195 Rev 231
1
/**
1
/**
2
 David Delon david.delon@clapas.net 2007
2
 David Delon david.delon@clapas.net 2007
3
 
3
 
4
 
4
 
5
 */
5
 */
6
 
6
 
7
/*
7
/*
8
 * LoginDialog.java  (DialogBox)
8
 * LoginDialog.java  (DialogBox)
9
 * 
9
 * 
10
 * Cas d'utilisation :
10
 * Cas d'utilisation :
11
 * Dialogue de validation de l'identification utilisateur
11
 * Dialogue de validation de l'identification utilisateur
12
 * 
12
 * 
13
 * 1 : L'utilisateur saisit son identifiant (e-mail) et son mot de passe
13
 * 1 : L'utilisateur saisit son identifiant (e-mail) et son mot de passe
14
 * 2 : Le dialogue controle aupres du systeme distant la validite des informations saisies 
14
 * 2 : Le dialogue controle aupres du systeme distant la validite des informations saisies 
15
 * 3 : Le dialogue transmet au systeme local les informations d'identification
15
 * 3 : Le dialogue transmet au systeme local les informations d'identification
16
 * 		3a : Le dialogue informe l'utilisateur que les elements d'identification ne sont pas valide : retour au point 1, ou passe au point 4.
16
 * 		3a : Le dialogue informe l'utilisateur que les elements d'identification ne sont pas valide : retour au point 1, ou passe au point 4.
17
 * 4 : Cloture du dialogue
17
 * 4 : Cloture du dialogue
18
 * 5 : Appel du dialogue d'importation
18
 * 5 : Appel du dialogue d'importation
19
 */
19
 */
20
 
20
 
21
package org.tela_botanica.client.vues;
21
package org.tela_botanica.client.vues;
22
 
22
 
23
// TODO : controle de forme sur saisie (regex integree) ...
23
// TODO : controle de forme sur saisie (regex integree) ...
24
 
24
 
25
import org.tela_botanica.client.CarnetEnLigneMediateur;
25
import org.tela_botanica.client.CarnetEnLigneMediateur;
26
 
26
 
27
import com.google.gwt.user.client.ui.DialogBox;
27
import com.google.gwt.user.client.ui.DialogBox;
28
import com.google.gwt.user.client.ui.KeyboardListener;
28
import com.google.gwt.user.client.ui.KeyboardListener;
29
import com.google.gwt.user.client.ui.Label;
29
import com.google.gwt.user.client.ui.Label;
30
import com.gwtext.client.core.EventObject;
30
import com.gwtext.client.core.EventObject;
31
import com.gwtext.client.core.Position;
31
import com.gwtext.client.core.Position;
32
import com.gwtext.client.widgets.Button;
32
import com.gwtext.client.widgets.Button;
33
import com.gwtext.client.widgets.Panel;
33
import com.gwtext.client.widgets.Panel;
34
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
34
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
35
import com.gwtext.client.widgets.event.KeyListener;
35
import com.gwtext.client.widgets.event.KeyListener;
36
import com.gwtext.client.widgets.form.FormPanel;
36
import com.gwtext.client.widgets.form.FormPanel;
37
import com.gwtext.client.widgets.form.TextField;
37
import com.gwtext.client.widgets.form.TextField;
38
 
38
 
39
public class FormulaireDeConnexionVue extends DialogBox  {
39
public class FormulaireDeConnexionVue extends DialogBox  {
40
 
40
 
41
	
41
	
42
	/**
42
	/**
43
	 * Médiateur associé à la vue
43
	 * Médiateur associé à la vue
44
	 */
44
	 */
45
	
45
	
46
	private CarnetEnLigneMediateur carnetEnLigneMediateur = null ;	
46
	private CarnetEnLigneMediateur carnetEnLigneMediateur = null ;	
47
	
47
	
48
	
48
	
49
	/**
49
	/**
50
	 * email saisi
50
	 * email saisi
51
	 */
51
	 */
52
	
52
	
53
	private TextField ident=null;
53
	private TextField ident=null;
54
	
54
	
55
	/**
55
	/**
56
	 * mot de passe saisi
56
	 * mot de passe saisi
57
	 */
57
	 */
58
	
58
	
59
	private TextField motDePasse=null;
59
	private TextField motDePasse=null;
60
	
60
	
61
	private Label saisieInvalide = null ;
61
	private Label saisieInvalide = null ;
62
	
62
	
63
 
63
 
64
  
64
  
65
  public FormulaireDeConnexionVue(CarnetEnLigneMediateur cm) {
65
  public FormulaireDeConnexionVue(CarnetEnLigneMediateur cm) {
66
	  
66
	  
67
	  
67
	  
68
	carnetEnLigneMediateur=cm;
68
	carnetEnLigneMediateur=cm;
69
	
69
	
70
 
70
 
71
	
71
	
72
    Panel panneauPrincipalDialogue=new Panel();
72
    Panel panneauPrincipalDialogue=new Panel();
73
    
73
    
74
    FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
74
    FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
75
    
75
    
76
    
76
    
77
    panneauFormulaire.setTitle("Connexion");  
77
    panneauFormulaire.setTitle("Connexion");  
78
    
78
    
79
    panneauFormulaire.setWidth(350);  
79
    panneauFormulaire.setWidth(350);  
80
    panneauFormulaire.setLabelWidth(100); 
80
    panneauFormulaire.setLabelWidth(100); 
81
    
81
    
82
    
82
    
83
    
83
    
84
/*
84
/*
85
 *  E-Mail : Zone_saisie_email 
85
 *  E-Mail : Zone_saisie_email 
86
 *  Mot-de-passe : Zone_saisie_mot_de_passe
86
 *  Mot-de-passe : Zone_saisie_mot_de_passe
87
 *  Message d'information
87
 *  Message d'information
88
 *  Bouton_Ok   Bouton_Annuler
88
 *  Bouton_Ok   Bouton_Annuler
89
 */ 
89
 */ 
90
 
90
 
91
    /**
91
    /**
92
     * On ajoute les differents elements du formulaire 
92
     * On ajoute les differents elements du formulaire 
93
     */
93
     */
94
    
94
    
95
    // Email
95
    // Email
96
    
96
    
97
    ident = new TextField("Identifiant", "ident", 200);  
97
    ident = new TextField("Mail", "ident", 200);  
98
    ident.setAllowBlank(false);  
98
    ident.setAllowBlank(false);  
99
    ident.setInvalidText("Identifiant vide ou incorrect");
99
    ident.setInvalidText("Mail vide ou incorrect");
100
    ident.setTabIndex(800);
100
    ident.setTabIndex(800);
101
    panneauFormulaire.add(ident);  
101
    panneauFormulaire.add(ident);  
102
    
102
    
103
    // Mot de passe 
103
    // Mot de passe 
104
    
104
    
105
    motDePasse = new TextField("Mot de passe", "motDePasse", 200);  
105
    motDePasse = new TextField("Mot de passe", "motDePasse", 200);  
106
    motDePasse.setAllowBlank(false); 
106
    motDePasse.setAllowBlank(false); 
107
    ident.setInvalidText("Mot de passe vide ou incorrect");
107
    ident.setInvalidText("Mot de passe vide ou incorrect");
108
    motDePasse.setPassword(true);
108
    motDePasse.setPassword(true);
109
    motDePasse.setTabIndex(801);
109
    motDePasse.setTabIndex(801);
110
    
110
    
111
    panneauFormulaire.add(motDePasse);  
111
    panneauFormulaire.add(motDePasse);  
112
 
112
 
113
    
113
    
114
    
114
    
115
    Button boutonOK = new Button("Ok");  
115
    Button boutonOK = new Button("Ok");  
116
    boutonOK.setTabIndex(802);
116
    boutonOK.setTabIndex(802);
117
    panneauFormulaire.addButton(boutonOK);
117
    panneauFormulaire.addButton(boutonOK);
118
    
118
    
119
    Button boutonAnnuler = new Button("Annuler"); 
119
    Button boutonAnnuler = new Button("Annuler"); 
120
    boutonAnnuler.setTabIndex(803);
120
    boutonAnnuler.setTabIndex(803);
121
    panneauFormulaire.addButton(boutonAnnuler);
121
    panneauFormulaire.addButton(boutonAnnuler);
122
    
122
    
123
    
123
    
124
    // Click sur bouton de validation
124
    // Click sur bouton de validation
125
    
125
    
126
    boutonOK.addListener(
126
    boutonOK.addListener(
127
    		
127
    		
128
    new ButtonListenerAdapter() {
128
    new ButtonListenerAdapter() {
129
    	
129
    	
130
    	public void onClick(Button button, EventObject e) {
130
    	public void onClick(Button button, EventObject e) {
131
    		carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
131
    		carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
132
    		
132
    		
133
    	}
133
    	}
134
    	
134
    	
135
    }
135
    }
136
    
136
    
137
    );
137
    );
138
    
138
    
139
 
139
 
140
    // Click sur  bouton d'annulation
140
    // Click sur  bouton d'annulation
141
    
141
    
142
    
142
    
143
    boutonAnnuler.addListener(
143
    boutonAnnuler.addListener(
144
    		
144
    		
145
    new ButtonListenerAdapter() {
145
    new ButtonListenerAdapter() {
146
    	
146
    	
147
    	public void onClick(Button button, EventObject e) {
147
    	public void onClick(Button button, EventObject e) {
148
	        cacher();
148
	        cacher();
149
    	}
149
    	}
150
    	
150
    	
151
    }
151
    }
152
    
152
    
153
    );
153
    );
154
 
154
 
155
	
155
	
156
 /**
156
 /**
157
  * Validation directe depuis un champ de saisie
157
  * Validation directe depuis un champ de saisie
158
  * 
158
  * 
159
  */
159
  */
160
 
160
 
161
    // Email
161
    // Email
162
    
162
    
163
	// gestion de la touche entrée
163
	// gestion de la touche entrée
164
    ident.addKeyListener(EventObject.ENTER, new KeyListener() {
164
    ident.addKeyListener(EventObject.ENTER, new KeyListener() {
165
 
165
 
166
		public void onKey(int key, EventObject e) {
166
		public void onKey(int key, EventObject e) {
167
			carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
167
			carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
168
			
168
			
169
		}
169
		}
170
    });
170
    });
171
    
171
    
172
    // Mot de passe
172
    // Mot de passe
173
    
173
    
174
    motDePasse.addKeyListener(EventObject.ENTER, new KeyListener() {
174
    motDePasse.addKeyListener(EventObject.ENTER, new KeyListener() {
175
 
175
 
176
		public void onKey(int key, EventObject e) {
176
		public void onKey(int key, EventObject e) {
177
			carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
177
			carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
178
			
178
			
179
		}
179
		}
180
    });		
180
    });		
181
    
181
    
182
    
182
    
183
  	saisieInvalide = new Label("");
183
  	saisieInvalide = new Label("");
184
  	saisieInvalide.setStyleName("saisie_invalide_invisible");
184
  	saisieInvalide.setStyleName("saisie_invalide_invisible");
185
  	panneauFormulaire.add(saisieInvalide);
185
  	panneauFormulaire.add(saisieInvalide);
186
   	 
186
   	 
187
  	 panneauPrincipalDialogue.add(panneauFormulaire);
187
  	 panneauPrincipalDialogue.add(panneauFormulaire);
188
	 
188
	 
189
     setWidget(panneauPrincipalDialogue);
189
     setWidget(panneauPrincipalDialogue);
190
	 
190
	 
191
        
191
        
192
  }
192
  }
193
  
193
  
194
  
194
  
195
  /*
195
  /*
196
   * On sort sur touche echappement
196
   * On sort sur touche echappement
197
   */
197
   */
198
	
198
	
199
  public boolean onKeyDownPreview(char key, int modifiers) {
199
  public boolean onKeyDownPreview(char key, int modifiers) {
200
	    switch (key) {
200
	    switch (key) {
201
	      case KeyboardListener.KEY_ESCAPE:
201
	      case KeyboardListener.KEY_ESCAPE:
202
	        hide();
202
	        hide();
203
	        break;
203
	        break;
204
	    }
204
	    }
205
 
205
 
206
	    return true;
206
	    return true;
207
  }
207
  }
208
 
208
 
209
  public void afficherMessageAlerte() {
209
  public void afficherMessageAlerte() {
210
 
210
 
211
	  saisieInvalide.setText("Identifiant ou mot de passe invalide");
211
	  saisieInvalide.setText("Identifiant ou mot de passe invalide");
212
	  saisieInvalide.setStyleName("saisie_invalide");
212
	  saisieInvalide.setStyleName("saisie_invalide");
213
  }
213
  }
214
 
214
 
215
 
215
 
216
public void cacher() {
216
public void cacher() {
217
	saisieInvalide.setText("");
217
	saisieInvalide.setText("");
218
	saisieInvalide.setStyleName("saisie_invalide_invisible");
218
	saisieInvalide.setStyleName("saisie_invalide_invisible");
219
	hide();
219
	hide();
220
	
220
	
221
}
221
}
222
  
222
  
223
 
223
 
224
}
224
}
225
 
225
 
226
/* +--Fin du code ---------------------------------------------------------------------------------------+
226
/* +--Fin du code ---------------------------------------------------------------------------------------+
227
* $Log$
227
* $Log$
228
* Revision 1.1  2008-11-13 11:27:05  ddelon
228
* Revision 1.1  2008-11-13 11:27:05  ddelon
229
* Reecriture gwt-ext
229
* Reecriture gwt-ext
230
*
230
*
231
* Revision 1.1  2008-06-09 14:19:37  ddelon
231
* Revision 1.1  2008-06-09 14:19:37  ddelon
232
* Initialisation observation
232
* Initialisation observation
233
*
233
*
234
* Revision 1.10  2007-09-17 19:25:34  ddelon
234
* Revision 1.10  2007-09-17 19:25:34  ddelon
235
* Documentation
235
* Documentation
236
*
236
*
237
* Revision 1.9  2007-05-21 21:03:44  ddelon
237
* Revision 1.9  2007-05-21 21:03:44  ddelon
238
* nettoyage de code
238
* nettoyage de code
239
*
239
*
240
* Revision 1.8  2007-05-21 18:14:06  ddelon
240
* Revision 1.8  2007-05-21 18:14:06  ddelon
241
* Gestion importation releve locaux
241
* Gestion importation releve locaux
242
*
242
*
243
* Revision 1.7  2007-05-21 11:47:30  ddelon
243
* Revision 1.7  2007-05-21 11:47:30  ddelon
244
* meta cvs
244
* meta cvs
245
*
245
*
246
* Revision 1.6  2007-05-21 11:39:48  ddelon
246
* Revision 1.6  2007-05-21 11:39:48  ddelon
247
* meta cvs
247
* meta cvs
248
*
248
*
249
* Revision 1.5  2007-05-21 11:39:12  ddelon
249
* Revision 1.5  2007-05-21 11:39:12  ddelon
250
* meta cvs
250
* meta cvs
251
*
251
*
252
* Revision 1.4  2007-05-21 11:37:35  ddelon
252
* Revision 1.4  2007-05-21 11:37:35  ddelon
253
* meta cvs
253
* meta cvs
254
*
254
*
255
* Revision 1.3  2007-05-21 11:36:51  ddelon
255
* Revision 1.3  2007-05-21 11:36:51  ddelon
256
* meta cvs
256
* meta cvs
257
* 
257
* 
258
*/
258
*/