Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1513 Rev 1613
Line 13... Line 13...
13
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.interfaces.Rafraichissable;
14
import org.tela_botanica.client.modeles.Information;
14
import org.tela_botanica.client.modeles.Information;
15
import org.tela_botanica.client.modeles.Utilisateur;
15
import org.tela_botanica.client.modeles.Utilisateur;
16
import org.tela_botanica.client.modeles.projet.Projet;
16
import org.tela_botanica.client.modeles.projet.Projet;
17
import org.tela_botanica.client.modeles.projet.ProjetListe;
17
import org.tela_botanica.client.modeles.projet.ProjetListe;
-
 
18
import org.tela_botanica.client.modeles.publication.Publication;
18
import org.tela_botanica.client.modeles.structure.StructureListe;
19
import org.tela_botanica.client.modeles.structure.StructureListe;
19
import org.tela_botanica.client.util.Debug;
20
import org.tela_botanica.client.util.Debug;
20
import org.tela_botanica.client.util.UtilString;
21
import org.tela_botanica.client.util.UtilString;
21
import org.tela_botanica.client.vues.BarrePaginationVue;
22
import org.tela_botanica.client.vues.BarrePaginationVue;
Line 38... Line 39...
38
import com.extjs.gxt.ui.client.widget.grid.Grid;
39
import com.extjs.gxt.ui.client.widget.grid.Grid;
39
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
40
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
40
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
41
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
41
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
42
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
42
import com.google.gwt.core.client.GWT;
43
import com.google.gwt.core.client.GWT;
-
 
44
import com.google.gwt.user.client.Window;
Line 43... Line 45...
43
 
45
 
Line 44... Line 46...
44
public class ProjetListeVue extends ContentPanel implements Rafraichissable {
46
public class ProjetListeVue extends ContentPanel implements Rafraichissable {
45
 
47
 
Line 53... Line 55...
53
	
55
	
54
	private Button ajouter;
56
	private Button ajouter;
55
	private Button modifier;
57
	private Button modifier;
Line -... Line 58...
-
 
58
	private Button supprimer;
-
 
59
	
-
 
60
	private int indexElementSelectionne = 0;
56
	private Button supprimer;
61
	private Projet projetSelectionne = null;
57
	
62
	
58
	public ProjetListeVue(Mediateur mediateurCourant) {
63
	public ProjetListeVue(Mediateur mediateurCourant) {
59
		super();
64
		super();
Line 76... Line 81...
76
		modifier = new Button(i18nC.modifier());
81
		modifier = new Button(i18nC.modifier());
77
		modifier.setIcon(Images.ICONES.formModifier());
82
		modifier.setIcon(Images.ICONES.formModifier());
78
		modifier.addSelectionListener(new SelectionListener<ButtonEvent>() {  
83
		modifier.addSelectionListener(new SelectionListener<ButtonEvent>() {  
79
			public void componentSelected(ButtonEvent be) { 
84
			public void componentSelected(ButtonEvent be) { 
80
				mediateur.clicModifierProjet(grille.getSelectionModel().getSelectedItems());
85
				mediateur.clicModifierProjet(grille.getSelectionModel().getSelectedItems());
-
 
86
				indexElementSelectionne = store.indexOf(grille.getSelectionModel().getSelectedItem());
81
			}  
87
			}  
82
		});
88
		});
83
		toolBar.add(modifier);
89
		toolBar.add(modifier);
Line 84... Line 90...
84
		
90
		
Line 105... Line 111...
105
		modeleDesColonnes = new ColumnModel(colonnes);
111
		modeleDesColonnes = new ColumnModel(colonnes);
Line 106... Line 112...
106
 
112
 
107
		GridSelectionModel<Projet> modeleDeSelection = new GridSelectionModel<Projet>();
113
		GridSelectionModel<Projet> modeleDeSelection = new GridSelectionModel<Projet>();
108
		modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Projet>() {
114
		modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Projet>() {
109
			public void selectionChanged(SelectionChangedEvent<Projet> event) {
115
			public void selectionChanged(SelectionChangedEvent<Projet> event) {
110
				Projet projet = (Projet) event.getSelectedItem();
116
				projetSelectionne = (Projet) event.getSelectedItem();
111
				clicListe(projet);
117
				clicListe(projetSelectionne);
112
			}
118
			}
Line 113... Line 119...
113
		});
119
		});
114
		
120
		
Line 186... Line 192...
186
			}
192
			}
187
		} else if (nouvellesDonnees instanceof Information) {
193
		} else if (nouvellesDonnees instanceof Information) {
188
			Information info = (Information) nouvellesDonnees;
194
			Information info = (Information) nouvellesDonnees;
189
			if (info.getType().equals("maj_utilisateur")) {
195
			if (info.getType().equals("maj_utilisateur")) {
190
				gererEtatActivationBouton();
196
				gererEtatActivationBouton();
-
 
197
			} else if (info.getType().equals("projet_modifie")) {
-
 
198
				if(projetSelectionne != null) {
-
 
199
					store.remove(indexElementSelectionne);
-
 
200
					projetSelectionne = null;
-
 
201
				}
-
 
202
				Projet projetModifie = (Projet)info.getDonnee(0);
-
 
203
				// au cas ou le bouton appliquer aurait été cliqué avant de valider
-
 
204
				store.remove(projetModifie);
-
 
205
				store.insert(projetModifie, indexElementSelectionne);
-
 
206
				grille.repaint();
-
 
207
				grille.getSelectionModel().select(indexElementSelectionne, true);
-
 
208
				clicListe(projetModifie);
191
			} else if (info.getType().equals("suppression_projet")) {
209
			} else if (info.getType().equals("suppression_projet")) {
192
				String message = info.toString();
210
				String message = info.toString();
193
				if (info.getDonnee(0) != null) {
211
				if (info.getDonnee(0) != null) {
194
					message = (String) info.getDonnee(0);
212
					message = (String) info.getDonnee(0);
195
				}
213
				}