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