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