Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 379 Rev 422
Line 4... Line 4...
4
import java.util.List;
4
import java.util.List;
Line 5... Line 5...
5
 
5
 
6
import org.tela_botanica.client.ComposantClass;
6
import org.tela_botanica.client.ComposantClass;
7
import org.tela_botanica.client.Mediateur;
7
import org.tela_botanica.client.Mediateur;
-
 
8
import org.tela_botanica.client.RegistreId;
8
import org.tela_botanica.client.RegistreId;
9
import org.tela_botanica.client.i18n.Constantes;
9
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.Information;
11
import org.tela_botanica.client.modeles.Structure;
12
import org.tela_botanica.client.modeles.Structure;
12
import org.tela_botanica.client.modeles.StructureListe;
13
import org.tela_botanica.client.modeles.StructureListe;
Line 33... Line 34...
33
import com.google.gwt.core.client.GWT;
34
import com.google.gwt.core.client.GWT;
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 {
-
 
37
	
36
	
38
	private Mediateur mediateur = null ;
37
	private Mediateur mediateur = null ;
39
	private Constantes i18nC = null ;
38
	private Rafraichissable structureListePanneauVue = null ;
40
	private Rafraichissable structureListePanneauVue = null ;
39
	private Table table = null;
41
	private Table table = null;
40
	private ListStore<Structure> store = null;
42
	private ListStore<Structure> store = null;
41
	private TableBinder<Structure> binder = null;
43
	private TableBinder<Structure> binder = null;
42
	private TextToolItem modifier;
44
	private TextToolItem modifier;
Line 43... Line 45...
43
	private TextToolItem supprimer;
45
	private TextToolItem supprimer;
44
	private TextToolItem ajouter;
46
	private TextToolItem ajouter;
-
 
47
 
Line 45... Line 48...
45
 
48
	public StructureListePanneauVue(Mediateur mediateurCourant) {
46
	public StructureListePanneauVue(Mediateur mediateurCourant) {
49
		mediateur = mediateurCourant;
Line 47... Line 50...
47
		mediateur = mediateurCourant;
50
		i18nC = mediateur.i18nC;
48
		
51
		
49
		Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
52
		Utilisateur utilisateur = (Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT);
50
		structureListePanneauVue = this;
53
		structureListePanneauVue = this;
51
		
54
		
52
		ToolBar toolBar = new ToolBar();
55
		ToolBar toolBar = new ToolBar();
53
		ajouter = new TextToolItem("Ajouter");
56
		ajouter = new TextToolItem(i18nC.ajouter());
54
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
57
		ajouter.setIconStyle(ComposantClass.ICONE_AJOUTER);
55
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
58
		ajouter.addSelectionListener(new SelectionListener<ComponentEvent>() {  
Line 56... Line 59...
56
			public void componentSelected(ComponentEvent ce) {  
59
			public void componentSelected(ComponentEvent ce) {  
57
				mediateur.clicAjouterStructure();
60
				mediateur.clicAjouterStructure();
58
			}
61
			}
59
		});
62
		});
60
		toolBar.add(ajouter);
63
		toolBar.add(ajouter);
61
 
64
 
62
		modifier = new TextToolItem("Modifier");
65
		modifier = new TextToolItem(i18nC.modifier());
63
		modifier.setIconStyle(ComposantClass.ICONE_MODIFIER);
66
		modifier.setIconStyle(ComposantClass.ICONE_MODIFIER);
Line 64... Line 67...
64
		modifier.addSelectionListener(new SelectionListener<ComponentEvent>() {
67
		modifier.addSelectionListener(new SelectionListener<ComponentEvent>() {
65
			public void componentSelected(ComponentEvent ce) {
68
			public void componentSelected(ComponentEvent ce) {
66
				mediateur.clicModifierStructure(binder.getSelection());
69
				mediateur.clicModifierStructure(binder.getSelection());
67
			}
70
			}
68
		});
71
		});
69
		toolBar.add(modifier);
72
		toolBar.add(modifier);
Line 82... Line 85...
82
 
85
 
Line 83... Line 86...
83
		setTopComponent(toolBar);
86
		setTopComponent(toolBar);
84
 
87
 
85
		List<TableColumn> columns = new ArrayList<TableColumn>();
88
		List<TableColumn> columns = new ArrayList<TableColumn>();
86
		// ATTENTION : les noms des colonnes doivent correspondrent aux noms variables de la classe utilisée dans la liste
89
		// ATTENTION : les noms des colonnes doivent correspondrent aux noms variables de la classe utilisée dans la liste
Line 87... Line 90...
87
		columns.add(new TableColumn("ville", "Ville", .3f));
90
		columns.add(new TableColumn("ville", i18nC.ville(), .3f));
88
		columns.add(new TableColumn("nom", "Nom", .7f));
91
		columns.add(new TableColumn("nom", i18nC.nom(), .7f));
89
		
92
		
90
		TableColumnModel cm = new TableColumnModel(columns);
93
		TableColumnModel cm = new TableColumnModel(columns);
Line 116... Line 119...
116
	}
119
	}
Line 117... Line 120...
117
 
120
 
118
	public void rafraichir(Object nouvelleDonnees) {
121
	public void rafraichir(Object nouvelleDonnees) {
119
		if (nouvelleDonnees instanceof StructureListe) {
122
		if (nouvelleDonnees instanceof StructureListe) {
120
			StructureListe structures = (StructureListe) nouvelleDonnees;
123
			StructureListe structures = (StructureListe) nouvelleDonnees;
Line 121... Line 124...
121
			setHeading("Institutions");
124
			setHeading(i18nC.titreStructureListe());
122
			
125
			
123
			List<Structure> liste = (List<Structure>) structures.toList();
126
			List<Structure> liste = (List<Structure>) structures.toList();
Line 132... Line 135...
132
		} else if (nouvelleDonnees instanceof Information) {
135
		} else if (nouvelleDonnees instanceof Information) {
133
			Information info = (Information) nouvelleDonnees;
136
			Information info = (Information) nouvelleDonnees;
134
			if (info.getType().equals("suppression_structure")) {
137
			if (info.getType().equals("suppression_structure")) {
135
				// Affichage d'un message d'information 
138
				// Affichage d'un message d'information 
136
				//GWT.log(info.toString(), null);
139
				//GWT.log(info.toString(), null);
137
				Info.display("Suppression d'une Institution", info.toString().replaceAll("\n", "<br />"));
140
				Info.display(i18nC.suppressionStructure(), info.toString().replaceAll("\n", "<br />"));
Line 138... Line 141...
138
 
141
 
139
				// Suppression des structures sélectionnées
142
				// Suppression des structures sélectionnées
140
				List<TableItem> selectionStructure = table.getSelectedItems();
143
				List<TableItem> selectionStructure = table.getSelectedItems();
141
				final int taille = selectionStructure.size();
144
				final int taille = selectionStructure.size();