Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1322 Rev 1329
Line 32... Line 32...
32
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
32
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
33
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
33
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
34
import com.extjs.gxt.ui.client.event.SelectionListener;
34
import com.extjs.gxt.ui.client.event.SelectionListener;
35
import com.extjs.gxt.ui.client.store.GroupingStore;
35
import com.extjs.gxt.ui.client.store.GroupingStore;
36
import com.extjs.gxt.ui.client.store.ListStore;
36
import com.extjs.gxt.ui.client.store.ListStore;
-
 
37
import com.extjs.gxt.ui.client.util.Util;
37
import com.extjs.gxt.ui.client.widget.ContentPanel;
38
import com.extjs.gxt.ui.client.widget.ContentPanel;
38
import com.extjs.gxt.ui.client.widget.Info;
39
import com.extjs.gxt.ui.client.widget.Info;
39
import com.extjs.gxt.ui.client.widget.button.Button;
40
import com.extjs.gxt.ui.client.widget.button.Button;
40
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
41
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
41
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
42
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
Line 114... Line 115...
114
		setTopComponent(toolBar);
115
		setTopComponent(toolBar);
Line 115... Line 116...
115
 
116
 
116
		// Gestion de la grille
117
		// Gestion de la grille
117
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
118
		List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
118
		// ATTENTION : les noms des colonnes doivent correspondre aux noms variables de la classe utilisée dans la liste
119
		// ATTENTION : les noms des colonnes doivent correspondre aux noms variables de la classe utilisée dans la liste
119
		colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150));
120
		colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150));		
120
		colonnes.add(creerColonneType());
121
		colonnes.add(creerColonneType());
121
		colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150));
122
		colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150));
122
		colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 30));
123
		colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 30));
123
		colonnes.add(creerColonneAcces());
124
		colonnes.add(creerColonneAcces());
Line 142... Line 143...
142
		vueDeGroupe.setAutoFill(true);
143
		vueDeGroupe.setAutoFill(true);
143
		vueDeGroupe.setGroupRenderer(new GridGroupRenderer() {
144
		vueDeGroupe.setGroupRenderer(new GridGroupRenderer() {
144
			public String render(GroupColumnData data) {
145
			public String render(GroupColumnData data) {
145
				String f = modeleDesColonnes.getColumnById(data.field).getHeader();
146
				String f = modeleDesColonnes.getColumnById(data.field).getHeader();
146
				String l = data.models.size() == 1 ? i18nC.commentaireSingulier() : i18nC.commentairePluriel();
147
				String l = data.models.size() == 1 ? i18nC.commentaireSingulier() : i18nC.commentairePluriel();
-
 
148
				
-
 
149
				if (Util.isEmptyString(data.group)) return f + ": aucune (" + data.models.size() + " " + l + ")";
147
				return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
150
				else return f + ": " + data.group + " (" + data.models.size() + " " + l + ")";
148
			}
151
			}
149
		});
152
		});
Line 150... Line 153...
150
		
153
		
151
		grille = new Grid<Commentaire>(store, modeleDesColonnes);
154
		grille = new Grid<Commentaire>(store, modeleDesColonnes);
Line 174... Line 177...
174
		GridCellRenderer<Commentaire> typeRendu = new GridCellRenderer<Commentaire>() {
177
		GridCellRenderer<Commentaire> typeRendu = new GridCellRenderer<Commentaire>() {
175
			public String render(Commentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<Commentaire> store, Grid<Commentaire> grid) {
178
			public String render(Commentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<Commentaire> store, Grid<Commentaire> grid) {
176
				// FIXME : créer une classe Ontologie qui mixe le code ci-dessous et tout ce qui concerne l'ontologie dans DetailVue
179
				// FIXME : créer une classe Ontologie qui mixe le code ci-dessous et tout ce qui concerne l'ontologie dans DetailVue
177
				String type = "";
180
				String type = "";
178
				String[] valeurs = model.getCollectionACommentaire().getType().split(aDonnee.SEPARATEUR_VALEURS);
181
				String[] valeurs = model.getCollectionACommentaire().getType().split(aDonnee.SEPARATEUR_VALEURS);
-
 
182
				
179
				int nbreValeurs = valeurs.length;
183
				int nbreValeurs = valeurs.length;
-
 
184
				
180
				int indexAvtDernier = nbreValeurs - 1;
185
				int indexAvtDernier = nbreValeurs - 1;
181
				if (nbreValeurs > 0)	{
186
				if (nbreValeurs > 0)	{
182
					for (int i = 0; i < nbreValeurs; i++)	{
187
					for (int i = 0; i < nbreValeurs; i++)	{
183
						String valeur = valeurs[i];
188
						String valeur = valeurs[i];
-
 
189
						
184
						if (valeur.matches("^[0-9]+$"))	{
190
						if (valeur.matches("^[0-9]+$"))	{
185
							if (valeur.equals("0")) {
191
							if (valeur.equals("0")) {
186
								valeur = "";
192
								valeur = "";
187
							} else if (ontologie != null) {
193
							} else if (ontologie != null) {
188
								Valeur valeurOntologie = ontologie.get(valeur);
194
								Valeur valeurOntologie = ontologie.get(valeur);
Line 196... Line 202...
196
						} else {
202
						} else {
197
							type += valeur;
203
							type += valeur;
198
						}
204
						}
199
					}
205
					}
200
				}
206
				}
-
 
207
				
201
				model.set("_type_", type);
208
				model.set("_type_", type);
202
				return type;
209
				return type;
203
			}
210
			}
204
		};
211
		};
205
		ColumnConfig typeColonne = new ColumnConfig("_type_", i18nC.commentaireType(), 100);
212
		ColumnConfig typeColonne = new ColumnConfig("_type_", i18nC.commentaireType(), 100);
Line 291... Line 298...
291
	}
298
	}
Line 292... Line 299...
292
	
299
	
293
	private void chargerListe() {
300
	private void chargerListe() {
294
		if (commentaires != null) {
301
		if (commentaires != null) {
-
 
302
			List<Commentaire> liste = commentaires.toList();
295
			List<Commentaire> liste = commentaires.toList();
303
			
296
			store.removeAll();
304
			store.removeAll();
Line 297... Line 305...
297
			store.add(liste);
305
			store.add(liste);
298
			
306