New file |
0,0 → 1,204 |
/** |
David Delon david.delon@clapas.net 2007 |
|
|
*/ |
|
/* |
* LoginDialog.java (DialogBox) |
* |
* Cas d'utilisation : |
* Dialogue de validation de l'identification utilisateur |
* |
* 1 : L'utilisateur saisit son identifiant (e-mail) et son mot de passe |
* 2 : Le dialogue controle aupres du systeme distant la validite des informations saisies |
* 3 : Le dialogue transmet au systeme local les informations d'identification |
* 3a : Le dialogue informe l'utilisateur que les elements d'identification ne sont pas valide : retour au point 1, ou passe au point 4. |
* 4 : Cloture du dialogue |
* 5 : Appel du dialogue d'importation |
*/ |
|
package org.tela_botanica.client.observation; |
|
// TODO : utiliser classe formulaire |
|
import com.google.gwt.user.client.ui.ClickListener; |
import com.google.gwt.user.client.ui.DialogBox; |
import com.google.gwt.user.client.ui.Grid; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.KeyboardListener; |
import com.google.gwt.user.client.ui.PasswordTextBox; |
import com.google.gwt.user.client.ui.TextBox; |
import com.google.gwt.user.client.ui.VerticalPanel; |
import com.google.gwt.user.client.ui.Widget; |
|
public class FormulaireDeConnexionVue extends DialogBox { |
|
|
private ObservationMediateur observationMediateur=null; |
private TextBox login = new TextBox(); |
private PasswordTextBox password = new PasswordTextBox(); |
private Grid inner = new Grid(4,2); |
|
public FormulaireDeConnexionVue(final ObservationMediateur carnetEnLigneMediateur) { |
|
setText("Connexion"); |
|
this.observationMediateur=carnetEnLigneMediateur; |
|
VerticalPanel outer = new VerticalPanel(); |
|
/* |
* E-Mail : Zone_saisie_email |
* Mot-de-passe : Zone_saisie_mot_de_passe |
* Message d'information |
* Bouton_Ok Bouton_Annuler |
*/ |
|
|
// Validation bouton |
|
HTML okButton=new HTML("Ok"); |
okButton.setStyleName("html_button"); |
okButton.addClickListener( |
new ClickListener() { |
public void onClick(Widget sender) { |
connecteUtilisateur(); |
} |
} |
); |
|
|
// Annulation |
|
HTML cancelButton=new HTML("Annuler"); |
cancelButton.setStyleName("html_button"); |
cancelButton.addClickListener( |
new ClickListener() { |
public void onClick(Widget sender) { |
hide(); |
} |
} |
); |
|
//Validation utilisateur sans utilisation des boutons : |
|
|
login.addKeyboardListener( new KeyboardListener() { |
|
public void onKeyDown(Widget arg0, char arg1, int arg2) { |
if(arg1 == KEY_ENTER) |
{ |
connecteUtilisateur(); |
} |
} |
|
public void onKeyUp(Widget arg0, char arg1, int arg2) { } |
public void onKeyPress(Widget arg0, char arg1, int arg2) { } |
|
} |
); |
|
|
// Validation utilisateur sans utilisation des boutons : |
|
password.addKeyboardListener( new KeyboardListener() { |
|
public void onKeyDown(Widget arg0, char arg1, int arg2) { |
|
if(arg1 == KEY_ENTER) |
{ |
connecteUtilisateur(); |
} |
} |
|
public void onKeyUp(Widget arg0, char arg1, int arg2) { } |
public void onKeyPress(Widget arg0, char arg1, int arg2) { } |
|
} |
); |
|
|
inner.setHTML(0,0,"E-mail:"); |
inner.setWidget(0,1,login); |
inner.setHTML(1,0,"Mot de passe: "); |
inner.setWidget(1,1,password); |
inner.setWidget(3,0,okButton); |
inner.setWidget(3,1,cancelButton); |
|
inner.setCellPadding(10); |
outer.add(inner); |
setWidget(outer); |
|
} |
|
|
|
/** |
* Appel du service d'identification et positionnement de l'etat de connection en fonction du resultat. |
* |
* @param login : identifiant saisi |
* @param password : mot de passe saisi |
* |
*/ |
|
private void connecteUtilisateur() { |
|
final String login=this.login.getText(); |
String password=this.password.getText(); |
|
observationMediateur.connecterUtilisateur(login,password); |
|
|
} |
|
|
|
|
|
public boolean onKeyDownPreview(char key, int modifiers) { |
// Use the popup's key preview hooks to close the dialog when either |
// escape is pressed. |
switch (key) { |
case KeyboardListener.KEY_ESCAPE: |
hide(); |
break; |
} |
|
return true; |
} |
|
public void afficherMessageAlerte() { |
inner.setHTML(2,0,"Identification incorrecte !"); |
} |
|
|
} |
|
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* Revision 1.10 2007-09-17 19:25:34 ddelon |
* Documentation |
* |
* Revision 1.9 2007-05-21 21:03:44 ddelon |
* nettoyage de code |
* |
* Revision 1.8 2007-05-21 18:14:06 ddelon |
* Gestion importation releve locaux |
* |
* Revision 1.7 2007-05-21 11:47:30 ddelon |
* meta cvs |
* |
* Revision 1.6 2007-05-21 11:39:48 ddelon |
* meta cvs |
* |
* Revision 1.5 2007-05-21 11:39:12 ddelon |
* meta cvs |
* |
* Revision 1.4 2007-05-21 11:37:35 ddelon |
* meta cvs |
* |
* Revision 1.3 2007-05-21 11:36:51 ddelon |
* meta cvs |
* |
*/ |