Subversion Repositories eFlore/Archives.cel-v2

Rev

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

Rev Author Line No. Line
16 aperonnet 1
package org.tela_botanica.client.vues;
2
 
3
import java.util.Date;
4
 
5
import org.tela_botanica.client.image.ImageMediateur;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
7
 
8
import com.gwtext.client.core.NameValuePair;
9
import com.gwtext.client.data.Store;
10
import com.gwtext.client.data.StringFieldDef;
11
import com.gwtext.client.widgets.Panel;
12
import com.gwtext.client.widgets.TabPanel;
13
import com.gwtext.client.widgets.grid.GridView;
14
import com.gwtext.client.widgets.grid.PropertyGridPanel;
15
 
16
public class PanneauMetadonneesVue extends TabPanel implements Rafraichissable {
17
 
18
	private ImageMediateur imediateur = null ;
19
 
20
	private PropertyGridPanel ExifGrid = null ;
21
	private PropertyGridPanel IptcGrid = null ;
22
 
23
	private GridView gViewExif = null ;
24
	private GridView gViewIptc = null ;
25
 
26
	private Panel panneauExifGrid = null;
27
	private Panel panneauIptcGrid = null ;
28
	private Panel panneauInfoGrid = null ;
29
 
30
	boolean estInstancie = false ;
31
 
32
	public PanneauMetadonneesVue(ImageMediateur im)
33
	{
34
		super() ;
35
 
36
		imediateur = im ;
37
 
38
		panneauExifGrid = new Panel("Exif") ;
39
		panneauIptcGrid = new Panel("Iptc") ;
40
		panneauInfoGrid = new Panel("info") ;
41
 
42
 
43
		this.add(panneauInfoGrid) ;
44
		this.add(panneauExifGrid) ;
45
		this.add(panneauIptcGrid) ;
46
 
47
		gViewExif = new GridView();
48
		gViewExif.setForceFit(true);
49
 
50
		ExifGrid = new PropertyGridPanel() ;
51
		ExifGrid.setId("meta_exif");
52
		ExifGrid.setView(gViewExif);
53
		ExifGrid.setNameText("Métadonnées Exif");
54
		ExifGrid.setAutoWidth(true);
55
		ExifGrid.setAutoHeight(true);
56
		ExifGrid.setSorted(false);
57
 
58
		gViewIptc = new GridView();
59
		gViewIptc.setForceFit(true);
60
 
61
		IptcGrid = new PropertyGridPanel() ;
62
		IptcGrid.setId("meta_iptc");
63
		IptcGrid.setView(gViewIptc);
64
 
65
		IptcGrid.setNameText("Métadonnées IPTC");
66
		IptcGrid.setAutoWidth(true);
67
		IptcGrid.setAutoHeight(true);
68
		IptcGrid.setSorted(false);
69
 
70
		panneauExifGrid.add(ExifGrid);
71
		panneauIptcGrid.add(IptcGrid);
72
 
73
	}
74
 
75
	public ImageMediateur getIMediateur()
76
	{
77
		return imediateur ;
78
	}
79
 
80
 
81
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
82
 
83
		if(nouvelleDonnees instanceof Object[])
84
		{
85
			Object meta[] = (Object[])nouvelleDonnees ;
86
			String[][] exif = (String[][])meta[0] ;
87
			String[][] iptc = (String[][])meta[1] ;
88
 
89
			NameValuePair[] exifSource = new NameValuePair[exif.length] ;
90
			NameValuePair[] iptcSource = new NameValuePair[iptc.length] ;
91
 
92
 
93
			int maxLength ;
94
			if(exif.length <= iptc.length)
95
			{
96
				maxLength = iptc.length ;
97
			}
98
			else
99
			{
100
				maxLength = exif.length ;
101
			}
102
 
103
			for(int i = 0; i < maxLength ; i++)
104
			{
105
				if(i < exif.length)
106
				{
107
					exifSource[i] = new NameValuePair(exif[i][0],exif[i][1]) ;
108
				}
109
 
110
				if(i < iptc.length)
111
				{
112
					iptcSource[i] = new NameValuePair(iptc[i][0],iptc[i][1]) ;
113
				}
114
			}
115
 
116
 
117
			ExifGrid.setSource(exifSource);
118
			IptcGrid.setSource(iptcSource);
119
 
120
			gViewExif.refresh(true) ;
121
			gViewIptc.refresh(true) ;
122
 
123
		}
124
	}
125
}