Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 155 Rev 156
Line 9... Line 9...
9
import org.tela_botanica.client.RegistreId;
9
import org.tela_botanica.client.RegistreId;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
11
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.Information;
12
import org.tela_botanica.client.modeles.Structure;
12
import org.tela_botanica.client.modeles.Structure;
13
import org.tela_botanica.client.modeles.StructureListe;
13
import org.tela_botanica.client.modeles.StructureListe;
-
 
14
import org.tela_botanica.client.modeles.Utilisateur;
Line 14... Line 15...
14
 
15
 
15
import com.extjs.gxt.ui.client.Registry;
16
import com.extjs.gxt.ui.client.Registry;
16
import com.extjs.gxt.ui.client.Style.SelectionMode;
17
import com.extjs.gxt.ui.client.Style.SelectionMode;
17
import com.extjs.gxt.ui.client.binder.TableBinder;
18
import com.extjs.gxt.ui.client.binder.TableBinder;
Line 33... Line 34...
33
import com.google.gwt.user.client.Window;
34
import com.google.gwt.user.client.Window;
Line 34... Line 35...
34
 
35
 
Line 35... Line 36...
35
public class StructureListePanneauVue extends ContentPanel implements Rafraichissable {
36
public class StructureListePanneauVue extends ContentPanel implements Rafraichissable {
36
	
37
	
37
	private Rafraichissable structureListePanneauVue = null ;
38
	private Rafraichissable structureListePanneauVue = null ;
38
	private Mediateur coelMediateur = null ;
39
	private Mediateur mediateur = null ;
39
	private Table table = null;
40
	private Table table = null;
40
	private ListStore<Structure> store = null;
41
	private ListStore<Structure> store = null;
41
	private TableBinder<Structure> binder = null;
42
	private TableBinder<Structure> binder = null;
42
	private TextToolItem modifier;
43
	private TextToolItem modifier;
Line 43... Line 44...
43
	private TextToolItem supprimer;
44
	private TextToolItem supprimer;
-
 
45
	private TextToolItem ajouter;
44
	private TextToolItem ajouter;
46
 
45
 
47
	public StructureListePanneauVue() {
Line 46... Line 48...
46
	public StructureListePanneauVue() {
48
		Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR);
47
		coelMediateur = Registry.get(RegistreId.MEDIATEUR);
49
		mediateur = Registry.get(RegistreId.MEDIATEUR);
48
		structureListePanneauVue = this;
50
		structureListePanneauVue = this;
49
		
51
		
50
		ToolBar toolBar = new ToolBar();
52
		ToolBar toolBar = new ToolBar();
51
		ajouter = new TextToolItem("Ajouter");
53
		ajouter = new TextToolItem("Ajouter");
52
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
54
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
53
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
55
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
54
			public void componentSelected(ComponentEvent ce) {  
56
			public void componentSelected(ComponentEvent ce) {  
Line 55... Line 57...
55
				coelMediateur.clicAjouterStructure();
57
				mediateur.clicAjouterStructure();
56
			}
58
			}
-
 
59
		});
-
 
60
		toolBar.add(ajouter);
-
 
61
 
-
 
62
		modifier = new TextToolItem("Modifier");
-
 
63
		modifier.setIconStyle(ComposantClass.ICONE_MODIFIER);
57
		});
64
		modifier.addSelectionListener(new SelectionListener<ComponentEvent>() {
Line 58... Line 65...
58
		toolBar.add(ajouter);
65
			public void componentSelected(ComponentEvent ce) {
59
 
66
				mediateur.clicModifierStructure(binder.getSelection());
60
		modifier = new TextToolItem("Modifier");
67
			}
61
		modifier.setIconStyle(ComposantClass.ICONE_MODIFIER);
68
		});
62
		toolBar.add(modifier);
69
		toolBar.add(modifier);
63
		
70
		
64
		supprimer = new TextToolItem("Supprimer");
71
		supprimer = new TextToolItem("Supprimer");
-
 
72
		supprimer.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
-
 
73
		supprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {
-
 
74
			public void componentSelected(ComponentEvent ce) {
65
		supprimer.setIconStyle(ComposantClass.ICONE_SUPPRIMER);
75
				mediateur.clicSupprimerStructure(structureListePanneauVue, binder.getSelection());
Line 66... Line 76...
66
		supprimer.addSelectionListener(new SelectionListener<ComponentEvent>() {
76
			}
Line 67... Line 77...
67
			public void componentSelected(ComponentEvent ce) {
77
		});
Line 106... Line 116...
106
	public TableBinder<Structure> getBinder() {
116
	public TableBinder<Structure> getBinder() {
107
		return binder;
117
		return binder;
108
	}
118
	}
Line 109... Line 119...
109
 
119
 
110
	private void clicListe(Structure institution) {
120
	private void clicListe(Structure institution) {
111
		coelMediateur.clicListeInstitution(institution);
121
		mediateur.clicListeInstitution(institution);
Line 112... Line 122...
112
	}
122
	}
113
 
123
 
114
	public void rafraichir(Object nouvelleDonnees) {
124
	public void rafraichir(Object nouvelleDonnees) {
Line 146... Line 156...
146
				// Désactivation des boutons si la liste est vide
156
				// Désactivation des boutons si la liste est vide
147
				if (table.getItemCount() == 0) {  
157
				if (table.getItemCount() == 0) {  
148
					supprimer.disable();
158
					supprimer.disable();
149
					modifier.disable();
159
					modifier.disable();
150
				}
160
				}
-
 
161
			} else if (info.getType().equals("maj_utilisateur")) {
-
 
162
				if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR)).isIdentifie()) {
-
 
163
					if (table.getItemCount() != 0) {
-
 
164
						supprimer.enable();
-
 
165
					}
-
 
166
				} else {
-
 
167
					supprimer.disable();
-
 
168
				}
151
			}
169
			}
-
 
170
		} else {
-
 
171
			GWT.log("Ce type d'objet n'est pas pris en compte par la méthode rafraichir de la classe EntetePanneauVue", null);
152
		}
172
		}
-
 
173
		layout();
153
	}
174
	}
154
}
175
}