Subversion Repositories eFlore/Applications.cel

Rev

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

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