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