Subversion Repositories eFlore/Applications.coel

Rev

Rev 262 | Rev 287 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 262 Rev 278
Line 18... Line 18...
18
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
18
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
19
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
19
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
20
import com.extjs.gxt.ui.client.event.SelectionListener;
20
import com.extjs.gxt.ui.client.event.SelectionListener;
21
import com.extjs.gxt.ui.client.store.ListStore;
21
import com.extjs.gxt.ui.client.store.ListStore;
22
import com.extjs.gxt.ui.client.widget.ContentPanel;
22
import com.extjs.gxt.ui.client.widget.ContentPanel;
-
 
23
import com.extjs.gxt.ui.client.widget.LayoutContainer;
23
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
24
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
24
import com.extjs.gxt.ui.client.widget.table.Table;
25
import com.extjs.gxt.ui.client.widget.table.Table;
25
import com.extjs.gxt.ui.client.widget.table.TableColumn;
26
import com.extjs.gxt.ui.client.widget.table.TableColumn;
26
import com.extjs.gxt.ui.client.widget.table.TableColumnModel;
27
import com.extjs.gxt.ui.client.widget.table.TableColumnModel;
27
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
28
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem;
28
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
29
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
-
 
30
import com.google.gwt.core.client.GWT;
Line 29... Line 31...
29
 
31
 
Line 30... Line 32...
30
public class PanneauPersonneListe extends ContentPanel implements Rafraichissable {
32
public class PanneauPersonneListe extends ContentPanel implements Rafraichissable {
31
	
33
	
32
	private Mediateur coelMediateur = null ;
34
	private Mediateur mediateur = null ;
33
	private Table table = null;
35
	private Table table = null;
Line 34... Line 36...
34
	private ListStore<Personne> store = null;
36
	private ListStore<Personne> store = null;
35
	private TableBinder<Personne> binder = null;
37
	private TableBinder<Personne> binder = null;
Line 36... Line 38...
36
	
38
	
37
	public PanneauPersonneListe() {
39
	public PanneauPersonneListe() {
38
		coelMediateur = Registry.get(RegistreId.MEDIATEUR);
40
		mediateur = Registry.get(RegistreId.MEDIATEUR);
39
		
41
		
40
		//Définition de la barre d'outil
42
		//Définition de la barre d'outil
41
		ToolBar toolBar = new ToolBar();
43
		ToolBar toolBar = new ToolBar();
42
		TextToolItem ajouter = new TextToolItem("Ajouter");
44
		TextToolItem ajouter = new TextToolItem("Ajouter");
43
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
45
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
44
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
46
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
45
			public void componentSelected(ComponentEvent ce) {  
47
			public void componentSelected(ComponentEvent ce) {  
Line 63... Line 65...
63
		
65
		
64
		final TextToolItem supprimer = new TextToolItem("Supprimer");
66
		final TextToolItem supprimer = new TextToolItem("Supprimer");
65
		supprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {  
67
		supprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {  
Line 66... Line 68...
66
			public void componentSelected(ComponentEvent ce) {  
68
			public void componentSelected(ComponentEvent ce) {  
67
			
69
			
68
				coelMediateur.clicSupprimerPersonne(r,binder.getSelection());
70
				mediateur.clicSupprimerPersonne(r,binder.getSelection());
69
			}  
71
			}  
70
		});
72
		});
Line 103... Line 105...
103
		
105
		
104
		binder.addSelectionChangedListener(new SelectionChangedListener<Personne>() {
106
		binder.addSelectionChangedListener(new SelectionChangedListener<Personne>() {
105
		public void selectionChanged(SelectionChangedEvent<Personne> event) {
107
		public void selectionChanged(SelectionChangedEvent<Personne> event) {
106
				Personne p = (Personne) event.getSelectedItem();
108
				Personne p = (Personne) event.getSelectedItem();
107
				clicListe(p);
-
 
108
				
109
				clicListe(p);
109
			}
110
			}
Line 110... Line 111...
110
		});
111
		});
111
 
112
 
Line 119... Line 120...
119
	public TableBinder<Personne> getBinder() {
120
	public TableBinder<Personne> getBinder() {
120
		return binder;
121
		return binder;
121
	}
122
	}
Line 122... Line 123...
122
 
123
 
123
	private void clicListe(Personne personne) {
124
	private void clicListe(Personne personne) {
124
		coelMediateur.clicListePersonne(personne);
125
		mediateur.clicListePersonne(personne);
Line 125... Line 126...
125
	}
126
	}
126
 
127
 
127
	public void rafraichir(Object nouvelleDonnees) {
-
 
128
		if (nouvelleDonnees instanceof PersonneListe) {
128
	public void rafraichir(Object nouvelleDonnees) {
129
			store.removeAll();
-
 
130
			setHeading("Personnes");
129
		if (nouvelleDonnees instanceof PersonneListe) {
Line 131... Line 130...
131
			
130
			setHeading("Personnes");
132
			PersonneListe listePersonnes = (PersonneListe) nouvelleDonnees;
-
 
133
			
131
			PersonneListe listePersonnes = (PersonneListe) nouvelleDonnees;
134
			List<Personne> liste = new ArrayList<Personne>();
-
 
135
			
132
			
136
			for (Iterator<String> it = listePersonnes.keySet().iterator(); it.hasNext();) {
133
			List<Personne> liste = new ArrayList<Personne>();
Line 137... Line -...
137
				
-
 
-
 
134
			for (Iterator<String> it = listePersonnes.keySet().iterator(); it.hasNext();) {
138
				liste.add(listePersonnes.get(it.next()));
135
				liste.add(listePersonnes.get(it.next()));
139
			}
136
			}
-
 
137
			
-
 
138
			store.removeAll();
140
			
139
			store.add(liste);
-
 
140
 
141
			
141
			// Mise à jour du panneau central
142
			store.add((List<Personne>) liste);
142
			((LayoutContainer) Registry.get(RegistreId.PANNEAU_CENTRE)).layout();
143
			
143
		} else {
144
			
144
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);