Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1513 Rev 1613
Line 12... Line 12...
12
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.interfaces.Rafraichissable;
13
import org.tela_botanica.client.modeles.Information;
13
import org.tela_botanica.client.modeles.Information;
14
import org.tela_botanica.client.modeles.Utilisateur;
14
import org.tela_botanica.client.modeles.Utilisateur;
15
import org.tela_botanica.client.modeles.collection.Collection;
15
import org.tela_botanica.client.modeles.collection.Collection;
16
import org.tela_botanica.client.modeles.collection.CollectionListe;
16
import org.tela_botanica.client.modeles.collection.CollectionListe;
-
 
17
import org.tela_botanica.client.modeles.personne.Personne;
17
import org.tela_botanica.client.modeles.publication.Publication;
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.vues.BarrePaginationVue;
21
import org.tela_botanica.client.vues.BarrePaginationVue;
Line 28... Line 29...
28
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
29
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
29
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
30
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
30
import com.extjs.gxt.ui.client.event.SelectionListener;
31
import com.extjs.gxt.ui.client.event.SelectionListener;
31
import com.extjs.gxt.ui.client.store.ListStore;
32
import com.extjs.gxt.ui.client.store.ListStore;
32
import com.extjs.gxt.ui.client.widget.ContentPanel;
33
import com.extjs.gxt.ui.client.widget.ContentPanel;
33
import com.extjs.gxt.ui.client.widget.Info;
-
 
34
import com.extjs.gxt.ui.client.widget.button.Button;
34
import com.extjs.gxt.ui.client.widget.button.Button;
35
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
35
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
36
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
36
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
37
import com.extjs.gxt.ui.client.widget.grid.Grid;
37
import com.extjs.gxt.ui.client.widget.grid.Grid;
38
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
38
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
39
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
39
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
40
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
40
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
41
import com.google.gwt.core.client.GWT;
-
 
Line 42... Line 41...
42
 
41
 
Line 43... Line 42...
43
public class CollectionListeVue extends ContentPanel implements Rafraichissable {
42
public class CollectionListeVue extends ContentPanel implements Rafraichissable {
44
	
43
	
Line 51... Line 50...
51
	private Button modifier;
50
	private Button modifier;
52
	private Button supprimer;
51
	private Button supprimer;
53
	private Button ajouter;
52
	private Button ajouter;
54
	private BarrePaginationVue pagination = null;
53
	private BarrePaginationVue pagination = null;
Line -... Line 54...
-
 
54
	
-
 
55
	private int indexElementSelectionne = 0;
-
 
56
	private Collection collectionSelectionnee = null;
55
	
57
	
56
	public CollectionListeVue(Mediateur mediateurCourant) {
58
	public CollectionListeVue(Mediateur mediateurCourant) {
57
		mediateur = mediateurCourant;
59
		mediateur = mediateurCourant;
Line 58... Line 60...
58
		i18nC = Mediateur.i18nC;
60
		i18nC = Mediateur.i18nC;
Line 98... Line 100...
98
		ColumnModel modeleDeColonne = new ColumnModel(colonnes);
100
		ColumnModel modeleDeColonne = new ColumnModel(colonnes);
Line 99... Line 101...
99
		
101
		
100
		GridSelectionModel<Collection> modeleDeSelection = new GridSelectionModel<Collection>();
102
		GridSelectionModel<Collection> modeleDeSelection = new GridSelectionModel<Collection>();
101
		modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Collection>() {
103
		modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Collection>() {
102
			public void selectionChanged(SelectionChangedEvent<Collection> event) {
104
			public void selectionChanged(SelectionChangedEvent<Collection> event) {
-
 
105
				collectionSelectionnee = (Collection) event.getSelectedItem();
103
				Collection collectionSelectionnee = (Collection) event.getSelectedItem();
106
				indexElementSelectionne = store.indexOf(collectionSelectionnee);
104
				clicListe(collectionSelectionnee);
107
				clicListe(collectionSelectionnee);
105
			}
108
			}
Line 106... Line 109...
106
		});
109
		});
Line 175... Line 178...
175
			}
178
			}
176
		} else if (nouvellesDonnees instanceof Information) {
179
		} else if (nouvellesDonnees instanceof Information) {
177
			Information info = (Information) nouvellesDonnees;
180
			Information info = (Information) nouvellesDonnees;
178
			if (info.getType().equals("maj_utilisateur")) {
181
			if (info.getType().equals("maj_utilisateur")) {
179
				gererEtatActivationBouton();
182
				gererEtatActivationBouton();
-
 
183
			} else if (info.getType().equals("modif_collection")) {
-
 
184
				if(collectionSelectionnee != null) {
-
 
185
					store.remove(indexElementSelectionne);
-
 
186
					collectionSelectionnee = null;
-
 
187
				}
-
 
188
				Collection collecModifiee = (Collection)info.getDonnee(0);
-
 
189
				// au cas ou le bouton appliquer aurait été cliqué avant de valider
-
 
190
				store.remove(collecModifiee);
-
 
191
				store.insert(collecModifiee, indexElementSelectionne);
-
 
192
				grille.repaint();
-
 
193
				grille.getSelectionModel().select(indexElementSelectionne, true);
-
 
194
				clicListe(collecModifiee);
180
			} else if (info.getType().equals("suppression_collection")) {
195
			} else if (info.getType().equals("suppression_collection")) {
181
				// Affichage d'un message d'information 
196
				// Affichage d'un message d'information 
182
				InfoLogger.display(i18nC.suppressionCollection(), info.toString().replaceAll("\n", "<br />"));
197
				InfoLogger.display(i18nC.suppressionCollection(), info.toString().replaceAll("\n", "<br />"));
Line 183... Line 198...
183
 
198