Subversion Repositories eFlore/Applications.cel

Rev

Rev 5 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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 {
5 aperonnet 16
 
17
	private ImageMediateur iMediateur;
18
	private TextField champId = null;
19
	private Button ok = null;
20
 
21
	public IdVue(ImageMediateur im) {
22
		super("Identification");
23
 
24
		iMediateur = im;
25
 
26
		champId = new TextField();
27
		ok = new Button("OK");
28
 
29
		add(champId);
30
		add(ok);
31
 
32
		setSize(156, 75);
33
		setClosable(false);
34
		setModal(true);
35
		this.setCloseAction(HIDE);
36
 
37
		ajouterListeners();
2 aperonnet 38
	}
5 aperonnet 39
 
2 aperonnet 40
	private void ajouterListeners() {
41
 
42
		// gestion du clic sur le bouton
43
		ok.addListener(new ButtonListenerAdapter() {
44
 
45
			public void onClick(Button button, EventObject e) {
5 aperonnet 46
 
47
				valider();
2 aperonnet 48
			}
5 aperonnet 49
 
50
		});
51
 
2 aperonnet 52
		// gestion de la touche entrée
53
		champId.addKeyListener(EventObject.ENTER, new KeyListener() {
54
 
55
			public void onKey(int key, EventObject e) {
5 aperonnet 56
 
57
				valider();
2 aperonnet 58
			}
5 aperonnet 59
 
60
		});
61
 
2 aperonnet 62
		this.addListener(new WindowListenerAdapter() {
63
 
64
			public void onClose(Panel panel) {
5 aperonnet 65
 
2 aperonnet 66
			}
5 aperonnet 67
 
2 aperonnet 68
		});
69
 
70
	}
5 aperonnet 71
 
72
	public ImageMediateur getIMediateur() {
73
		return iMediateur;
2 aperonnet 74
	}
5 aperonnet 75
 
2 aperonnet 76
	protected void valider() {
5 aperonnet 77
 
78
		String id = champId.getText();
79
		getIMediateur().setIdentifiant("" + id.hashCode());
80
		getIMediateur().changerUtilisateur();
81
		this.close();
82
 
2 aperonnet 83
	}
84
 
85
	public void rafraichir(Object nouvelleDonnees,
86
			boolean repandreRaffraichissement) {
5 aperonnet 87
 
2 aperonnet 88
	}
89
 
90
}