| 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 |
|
|
|
27 |
import com.google.gwt.user.client.ui.DialogBox;
|
|
|
28 |
import com.google.gwt.user.client.ui.KeyboardListener;
|
| 173 |
aurelien |
29 |
import com.google.gwt.user.client.ui.Label;
|
| 12 |
david |
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 |
* Médiateur associé à la vue
|
|
|
43 |
*/
|
|
|
44 |
private CarnetEnLigneMediateur carnetEnLigneMediateur = null ;
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* email saisi
|
|
|
49 |
*/
|
| 42 |
jpm |
50 |
private TextField ident=null;
|
| 12 |
david |
51 |
|
|
|
52 |
/**
|
|
|
53 |
* mot de passe saisi
|
|
|
54 |
*/
|
|
|
55 |
private TextField motDePasse=null;
|
|
|
56 |
|
| 173 |
aurelien |
57 |
private Label saisieInvalide = null ;
|
|
|
58 |
|
| 12 |
david |
59 |
|
|
|
60 |
|
| 1291 |
aurelien |
61 |
public FormulaireDeConnexionVue(CarnetEnLigneMediateur cm) {
|
| 12 |
david |
62 |
carnetEnLigneMediateur=cm;
|
| 2278 |
aurelien |
63 |
|
|
|
64 |
setStyleName("popup_connexion");
|
| 12 |
david |
65 |
|
|
|
66 |
Panel panneauPrincipalDialogue=new Panel();
|
|
|
67 |
FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
|
|
|
68 |
panneauFormulaire.setTitle("Connexion");
|
|
|
69 |
panneauFormulaire.setWidth(350);
|
|
|
70 |
panneauFormulaire.setLabelWidth(100);
|
|
|
71 |
|
|
|
72 |
// Email
|
| 231 |
david |
73 |
ident = new TextField("Mail", "ident", 200);
|
| 42 |
jpm |
74 |
ident.setAllowBlank(false);
|
| 231 |
david |
75 |
ident.setInvalidText("Mail vide ou incorrect");
|
| 173 |
aurelien |
76 |
ident.setTabIndex(800);
|
| 42 |
jpm |
77 |
panneauFormulaire.add(ident);
|
| 12 |
david |
78 |
|
|
|
79 |
// Mot de passe
|
|
|
80 |
motDePasse = new TextField("Mot de passe", "motDePasse", 200);
|
| 173 |
aurelien |
81 |
motDePasse.setAllowBlank(false);
|
|
|
82 |
ident.setInvalidText("Mot de passe vide ou incorrect");
|
| 12 |
david |
83 |
motDePasse.setPassword(true);
|
| 173 |
aurelien |
84 |
motDePasse.setTabIndex(801);
|
| 12 |
david |
85 |
|
|
|
86 |
panneauFormulaire.add(motDePasse);
|
|
|
87 |
|
|
|
88 |
Button boutonOK = new Button("Ok");
|
| 173 |
aurelien |
89 |
boutonOK.setTabIndex(802);
|
| 12 |
david |
90 |
panneauFormulaire.addButton(boutonOK);
|
|
|
91 |
|
| 173 |
aurelien |
92 |
Button boutonAnnuler = new Button("Annuler");
|
|
|
93 |
boutonAnnuler.setTabIndex(803);
|
| 12 |
david |
94 |
panneauFormulaire.addButton(boutonAnnuler);
|
|
|
95 |
|
| 1291 |
aurelien |
96 |
// Click sur bouton de validation
|
|
|
97 |
boutonOK.addListener(
|
|
|
98 |
new ButtonListenerAdapter() {
|
|
|
99 |
@Override
|
|
|
100 |
public void onClick(Button button, EventObject e) {
|
|
|
101 |
carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
|
|
|
102 |
}
|
|
|
103 |
}
|
| 12 |
david |
104 |
);
|
|
|
105 |
|
|
|
106 |
// Click sur bouton d'annulation
|
| 1291 |
aurelien |
107 |
boutonAnnuler.addListener(
|
|
|
108 |
new ButtonListenerAdapter() {
|
|
|
109 |
@Override
|
|
|
110 |
public void onClick(Button button, EventObject e) {
|
|
|
111 |
cacher();
|
|
|
112 |
}
|
|
|
113 |
}
|
| 12 |
david |
114 |
);
|
|
|
115 |
|
|
|
116 |
// Email
|
|
|
117 |
// gestion de la touche entrée
|
| 42 |
jpm |
118 |
ident.addKeyListener(EventObject.ENTER, new KeyListener() {
|
| 12 |
david |
119 |
|
| 1291 |
aurelien |
120 |
@Override
|
| 12 |
david |
121 |
public void onKey(int key, EventObject e) {
|
| 42 |
jpm |
122 |
carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
|
| 12 |
david |
123 |
|
|
|
124 |
}
|
|
|
125 |
});
|
|
|
126 |
|
| 1291 |
aurelien |
127 |
// Mot de passe
|
| 12 |
david |
128 |
motDePasse.addKeyListener(EventObject.ENTER, new KeyListener() {
|
|
|
129 |
|
| 1291 |
aurelien |
130 |
@Override
|
| 12 |
david |
131 |
public void onKey(int key, EventObject e) {
|
| 42 |
jpm |
132 |
carnetEnLigneMediateur.connecterUtilisateur(ident.getText(),motDePasse.getText());
|
| 12 |
david |
133 |
|
|
|
134 |
}
|
| 38 |
jpm |
135 |
});
|
| 1291 |
aurelien |
136 |
|
| 173 |
aurelien |
137 |
saisieInvalide = new Label("");
|
|
|
138 |
saisieInvalide.setStyleName("saisie_invalide_invisible");
|
|
|
139 |
panneauFormulaire.add(saisieInvalide);
|
| 12 |
david |
140 |
|
| 1291 |
aurelien |
141 |
panneauPrincipalDialogue.add(panneauFormulaire);
|
|
|
142 |
setWidget(panneauPrincipalDialogue);
|
| 12 |
david |
143 |
}
|
| 1291 |
aurelien |
144 |
|
| 12 |
david |
145 |
/*
|
|
|
146 |
* On sort sur touche echappement
|
|
|
147 |
*/
|
| 1291 |
aurelien |
148 |
@Override
|
| 12 |
david |
149 |
public boolean onKeyDownPreview(char key, int modifiers) {
|
|
|
150 |
switch (key) {
|
|
|
151 |
case KeyboardListener.KEY_ESCAPE:
|
|
|
152 |
hide();
|
|
|
153 |
break;
|
|
|
154 |
}
|
|
|
155 |
|
|
|
156 |
return true;
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
public void afficherMessageAlerte() {
|
| 1291 |
aurelien |
160 |
saisieInvalide.setText("Identifiant ou mot de passe invalide");
|
|
|
161 |
saisieInvalide.setStyleName("saisie_invalide");
|
| 12 |
david |
162 |
}
|
| 173 |
aurelien |
163 |
|
|
|
164 |
|
| 1291 |
aurelien |
165 |
public void cacher() {
|
|
|
166 |
saisieInvalide.setText("");
|
|
|
167 |
saisieInvalide.setStyleName("saisie_invalide_invisible");
|
|
|
168 |
hide();
|
|
|
169 |
}
|
| 12 |
david |
170 |
}
|
|
|
171 |
|
|
|
172 |
/* +--Fin du code ---------------------------------------------------------------------------------------+
|
|
|
173 |
* $Log$
|
|
|
174 |
* Revision 1.1 2008-11-13 11:27:05 ddelon
|
|
|
175 |
* Reecriture gwt-ext
|
|
|
176 |
*
|
|
|
177 |
* Revision 1.1 2008-06-09 14:19:37 ddelon
|
|
|
178 |
* Initialisation observation
|
|
|
179 |
*
|
|
|
180 |
* Revision 1.10 2007-09-17 19:25:34 ddelon
|
|
|
181 |
* Documentation
|
|
|
182 |
*
|
|
|
183 |
* Revision 1.9 2007-05-21 21:03:44 ddelon
|
|
|
184 |
* nettoyage de code
|
|
|
185 |
*
|
|
|
186 |
* Revision 1.8 2007-05-21 18:14:06 ddelon
|
|
|
187 |
* Gestion importation releve locaux
|
|
|
188 |
*
|
|
|
189 |
* Revision 1.7 2007-05-21 11:47:30 ddelon
|
|
|
190 |
* meta cvs
|
|
|
191 |
*
|
|
|
192 |
* Revision 1.6 2007-05-21 11:39:48 ddelon
|
|
|
193 |
* meta cvs
|
|
|
194 |
*
|
|
|
195 |
* Revision 1.5 2007-05-21 11:39:12 ddelon
|
|
|
196 |
* meta cvs
|
|
|
197 |
*
|
|
|
198 |
* Revision 1.4 2007-05-21 11:37:35 ddelon
|
|
|
199 |
* meta cvs
|
|
|
200 |
*
|
|
|
201 |
* Revision 1.3 2007-05-21 11:36:51 ddelon
|
|
|
202 |
* meta cvs
|
|
|
203 |
*
|
|
|
204 |
*/
|