| 2 |
aperonnet |
1 |
package org.tela_botanica.client.interfaces;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.client.image.ImageMediateur;
|
|
|
4 |
|
|
|
5 |
import com.gwtext.client.core.EventObject;
|
|
|
6 |
|
|
|
7 |
import com.gwtext.client.widgets.Button;
|
|
|
8 |
import com.gwtext.client.widgets.Panel;
|
|
|
9 |
import com.gwtext.client.widgets.Window;
|
|
|
10 |
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
|
|
|
11 |
import com.gwtext.client.widgets.event.KeyListener;
|
|
|
12 |
import com.gwtext.client.widgets.event.WindowListenerAdapter;
|
|
|
13 |
import com.gwtext.client.widgets.form.TextField;
|
|
|
14 |
|
|
|
15 |
public class IdVue extends Window implements Rafraichissable {
|
|
|
16 |
|
|
|
17 |
private ImageMediateur iMediateur ;
|
|
|
18 |
private TextField champId = null ;
|
|
|
19 |
private Button ok = null ;
|
|
|
20 |
|
|
|
21 |
public IdVue(ImageMediateur im)
|
|
|
22 |
{
|
|
|
23 |
super("Identification") ;
|
|
|
24 |
|
|
|
25 |
iMediateur = im ;
|
|
|
26 |
|
|
|
27 |
champId = new TextField() ;
|
|
|
28 |
ok = new Button("OK") ;
|
|
|
29 |
|
|
|
30 |
add(champId) ;
|
|
|
31 |
add(ok) ;
|
|
|
32 |
|
|
|
33 |
setSize(156,75) ;
|
|
|
34 |
setClosable(false) ;
|
|
|
35 |
setModal(true) ;
|
|
|
36 |
this.setCloseAction(HIDE) ;
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
ajouterListeners() ;
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
private void ajouterListeners() {
|
|
|
43 |
|
|
|
44 |
// gestion du clic sur le bouton
|
|
|
45 |
ok.addListener(new ButtonListenerAdapter() {
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
public void onClick(Button button, EventObject e) {
|
|
|
49 |
|
|
|
50 |
valider() ;
|
|
|
51 |
}
|
|
|
52 |
|
|
|
53 |
}) ;
|
|
|
54 |
|
|
|
55 |
// gestion de la touche entrée
|
|
|
56 |
champId.addKeyListener(EventObject.ENTER, new KeyListener() {
|
|
|
57 |
|
|
|
58 |
public void onKey(int key, EventObject e) {
|
|
|
59 |
|
|
|
60 |
valider() ;
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
}) ;
|
|
|
65 |
|
|
|
66 |
this.addListener(new WindowListenerAdapter() {
|
|
|
67 |
|
|
|
68 |
public void onClose(Panel panel) {
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
});
|
|
|
74 |
|
|
|
75 |
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public ImageMediateur getIMediateur()
|
|
|
79 |
{
|
|
|
80 |
return iMediateur ;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
protected void valider() {
|
|
|
84 |
|
|
|
85 |
String id = champId.getText() ;
|
|
|
86 |
getIMediateur().setIdentifiant(""+id.hashCode()) ;
|
|
|
87 |
getIMediateur().changerUtilisateur() ;
|
|
|
88 |
this.close() ;
|
|
|
89 |
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
public void rafraichir(Object nouvelleDonnees,
|
|
|
93 |
boolean repandreRaffraichissement) {
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
|
|
|
99 |
}
|