Subversion Repositories eFlore/Archives.cel-v2

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 aperonnet 1
 
2
package org.tela_botanica.client;
3
 
4
import com.gwtext.client.data.FieldDef;
5
import com.gwtext.client.data.Record;
6
import com.gwtext.client.data.RecordDef;
7
import com.gwtext.client.data.Store;
8
import com.gwtext.client.data.StoreMgr;
9
import com.gwtext.client.data.StringFieldDef;
10
import com.gwtext.client.widgets.grid.CellMetadata;
11
import com.gwtext.client.widgets.grid.ColumnConfig;
12
import com.gwtext.client.widgets.grid.ColumnModel;
13
import com.gwtext.client.widgets.grid.GridPanel;
14
import com.gwtext.client.widgets.grid.Renderer;
15
import com.gwtextux.client.data.BufferedStore;
16
 
17
public class ListeImageVue extends GridPanel implements Rafraichissable {
18
 
19
 
20
 
21
	// instance du médiateur
22
	private ImageMediateur iMediateur = null;
23
 
24
 
25
	private ColumnConfig numImage ;
26
	private ColumnConfig urlImage ;
27
	private ColumnModel modeleColonnes ;
28
 
29
 
30
 
31
	// données locales
32
	// store qui gère les données de la liste d'images
33
	private Store st = null ;
34
	private ColumnConfig cl = null ;
35
 
36
 
37
	public ListeImageVue(ImageMediateur im) {
38
 
39
		this.iMediateur = im ;
40
		configurerColonnes();
41
		configurerStore();
42
 
43
 
44
		setAutoWidth(true);
45
		setAutoHeight(true);
46
	}
47
 
48
 
49
	// role : configurer les colonnes affichées dans la grille
50
	private void configurerColonnes() {
51
 
52
		numImage = new ColumnConfig("numéro d'image","num_image",150,true);
53
		urlImage = new ColumnConfig("Image","url_image",150,true,new Renderer() {
54
 
55
			public String render(Object value, CellMetadata cellMetadata,
56
					Record record, int rowIndex, int colNum, Store store) {
57
 
58
				String ImgUrl = record.getAsString("Miniature");
59
				return "<img src=\""+ImgUrl+"\" title='example'>";
60
			}
61
 
62
		});
63
 
64
		ColumnConfig[] cm = {numImage,urlImage};
65
		modeleColonnes = new ColumnModel(cm);
66
		this.setColumnModel(modeleColonnes);
67
 
68
 
69
		FieldDef defNumImage = new StringFieldDef("num_image");
70
		FieldDef defUrlImage = new StringFieldDef("url_image");
71
		FieldDef[] defTab = {defNumImage,defUrlImage};
72
		RecordDef rd = new RecordDef(defTab) ;
73
		st = new Store(rd) ;
74
		this.setStore(st);
75
 
76
 
77
	}
78
 
79
 
80
	// role : préparer le store et faire l'appel aux données nécessaires
81
	private void configurerStore() {
82
 
83
 
84
 
85
	}
86
 
87
 
88
	public void rafraichir(Object nouvelleDonnees) {
89
		// TODO Auto-generated method stub
90
 
91
	}
92
 
93
 
94
 
95
}