Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 16 | Rev 22 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16 Rev 18
1
package org.tela_botanica.client.vues;
1
package org.tela_botanica.client.vues;
2
 
2
 
3
import java.util.Date;
3
import java.util.Date;
4
 
4
 
5
import org.tela_botanica.client.image.ImageMediateur;
5
import org.tela_botanica.client.image.ImageMediateur;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
-
 
7
 
-
 
8
import com.google.gwt.core.client.JavaScriptObject;
-
 
9
import com.google.gwt.user.client.ui.ClickListener;
-
 
10
import com.google.gwt.user.client.ui.Label;
-
 
11
import com.google.gwt.user.client.ui.TextBox;
-
 
12
import com.google.gwt.user.client.ui.Widget;
7
 
13
import com.gwtext.client.core.EventObject;
8
import com.gwtext.client.core.NameValuePair;
14
import com.gwtext.client.core.NameValuePair;
9
import com.gwtext.client.data.Store;
15
import com.gwtext.client.data.Store;
10
import com.gwtext.client.data.StringFieldDef;
16
import com.gwtext.client.data.StringFieldDef;
-
 
17
import com.gwtext.client.widgets.Button;
-
 
18
import com.gwtext.client.widgets.Component;
11
import com.gwtext.client.widgets.Panel;
19
import com.gwtext.client.widgets.Panel;
12
import com.gwtext.client.widgets.TabPanel;
20
import com.gwtext.client.widgets.TabPanel;
-
 
21
import com.gwtext.client.widgets.event.ButtonListener;
-
 
22
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
-
 
23
import com.gwtext.client.widgets.form.DateField;
-
 
24
import com.gwtext.client.widgets.form.TextArea;
-
 
25
import com.gwtext.client.widgets.form.TextField;
13
import com.gwtext.client.widgets.grid.GridView;
26
import com.gwtext.client.widgets.grid.GridView;
14
import com.gwtext.client.widgets.grid.PropertyGridPanel;
27
import com.gwtext.client.widgets.grid.PropertyGridPanel;
-
 
28
import com.gwtext.client.widgets.layout.RowLayout;
-
 
29
import com.gwtext.client.widgets.layout.RowLayoutData;
-
 
30
import com.gwtext.client.widgets.layout.VerticalLayout;
-
 
31
import com.gwtext.client.widgets.menu.DateItem;
-
 
32
import com.gwtext.client.widgets.menu.Menu;
15
 
33
 
16
public class PanneauMetadonneesVue extends TabPanel implements Rafraichissable {
34
public class PanneauMetadonneesVue extends TabPanel implements Rafraichissable {
17
 
35
 
18
	private ImageMediateur imediateur = null ;
36
	private ImageMediateur imediateur = null ;
19
	
37
	
20
	private PropertyGridPanel ExifGrid = null ;
38
	private PropertyGridPanel ExifGrid = null ;
21
	private PropertyGridPanel IptcGrid = null ;
39
	private PropertyGridPanel IptcGrid = null ;
22
	
40
	
23
	private GridView gViewExif = null ;
41
	private GridView gViewExif = null ;
24
	private GridView gViewIptc = null ;
42
	private GridView gViewIptc = null ;
25
	
43
	
26
	private Panel panneauExifGrid = null; 
44
	private Panel panneauExifGrid = null; 
27
	private Panel panneauIptcGrid = null ;
45
	private Panel panneauIptcGrid = null ;
28
	private Panel panneauInfoGrid = null ;
46
	private Panel panneauInfoGrid = null ;
-
 
47
	
-
 
48
	private TextField commentaireGeneral = null ;
-
 
49
	private DateField dateImage = null ;
-
 
50
	Button validerInfo = null ;
29
	
51
	
30
	boolean estInstancie = false ;
52
	boolean estInstancie = false ;
31
	
53
	
32
	public PanneauMetadonneesVue(ImageMediateur im)
54
	public PanneauMetadonneesVue(ImageMediateur im)
33
	{
55
	{
34
		super() ;
56
		super() ;
35
		
57
		
36
		imediateur = im ;
58
		imediateur = im ;
37
		
59
		
38
		panneauExifGrid = new Panel("Exif") ;
60
		panneauExifGrid = new Panel("Exif") ;
39
		panneauIptcGrid = new Panel("Iptc") ;
61
		panneauIptcGrid = new Panel("Iptc") ;
40
		panneauInfoGrid = new Panel("info") ;
62
		panneauInfoGrid = new Panel("info") ;
-
 
63
		
-
 
64
		panneauInfoGrid.setLayout(new VerticalLayout());
-
 
65
		panneauInfoGrid.setHeight(500);
-
 
66
		Label labelComm = new Label("Commentaires :") ;
-
 
67
		labelComm.setHeight("20px") ;
-
 
68
		commentaireGeneral = new TextArea() ;
-
 
69
		commentaireGeneral.setAutoWidth(true) ;
-
 
70
		Label labelDate = new Label("Date :") ;
-
 
71
		
-
 
72
		labelDate.setHeight("20px") ;
-
 
73
		
-
 
74
		dateImage = new DateField() ;
-
 
75
		dateImage.setAutoWidth(true) ;
-
 
76
		dateImage.setFormat("d/m/y") ;
-
 
77
		
-
 
78
		validerInfo = new Button("OK") ;
-
 
79
		validerInfo.addListener(new ButtonListenerAdapter() {
-
 
80
 
-
 
81
			public void onClick(Button button, EventObject e) {
-
 
82
				
-
 
83
				getIMediateur().mettreAJourInfo(commentaireGeneral.getText(), dateImage.getRawValue()) ;
-
 
84
				
-
 
85
			}	
-
 
86
		});
-
 
87
		
-
 
88
		panneauInfoGrid.add(labelComm) ;
-
 
89
		panneauInfoGrid.add(commentaireGeneral) ;
-
 
90
		panneauInfoGrid.add(labelDate) ;
-
 
91
		panneauInfoGrid.add(dateImage) ;
-
 
92
		panneauInfoGrid.add(validerInfo) ;
-
 
93
		
41
		
94
		
42
		
95
		
43
		this.add(panneauInfoGrid) ;
96
		this.add(panneauInfoGrid) ;
44
		this.add(panneauExifGrid) ;
97
		this.add(panneauExifGrid) ;
45
		this.add(panneauIptcGrid) ;
98
		this.add(panneauIptcGrid) ;
46
		
99
		
47
		gViewExif = new GridView();
100
		gViewExif = new GridView();
48
		gViewExif.setForceFit(true);
101
		gViewExif.setForceFit(true);
49
		
102
		
50
		ExifGrid = new PropertyGridPanel() ;
103
		ExifGrid = new PropertyGridPanel() ;
51
		ExifGrid.setId("meta_exif");
104
		ExifGrid.setId("meta_exif");
52
		ExifGrid.setView(gViewExif);
105
		ExifGrid.setView(gViewExif);
53
		ExifGrid.setNameText("Métadonnées Exif");
106
		ExifGrid.setNameText("Métadonnées Exif");
54
		ExifGrid.setAutoWidth(true);
107
		ExifGrid.setAutoWidth(true);
55
		ExifGrid.setAutoHeight(true);
108
		ExifGrid.setAutoHeight(true);
56
		ExifGrid.setSorted(false);
109
		ExifGrid.setSorted(false);
57
		
110
		
58
		gViewIptc = new GridView();
111
		gViewIptc = new GridView();
59
		gViewIptc.setForceFit(true);
112
		gViewIptc.setForceFit(true);
60
		
113
		
61
		IptcGrid = new PropertyGridPanel() ;
114
		IptcGrid = new PropertyGridPanel() ;
62
		IptcGrid.setId("meta_iptc");
115
		IptcGrid.setId("meta_iptc");
63
		IptcGrid.setView(gViewIptc);
116
		IptcGrid.setView(gViewIptc);
64
		
117
		
65
		IptcGrid.setNameText("Métadonnées IPTC");
118
		IptcGrid.setNameText("Métadonnées IPTC");
66
		IptcGrid.setAutoWidth(true);
119
		IptcGrid.setAutoWidth(true);
67
		IptcGrid.setAutoHeight(true);
120
		IptcGrid.setAutoHeight(true);
68
		IptcGrid.setSorted(false);
121
		IptcGrid.setSorted(false);
69
		
122
		
70
		panneauExifGrid.add(ExifGrid);
123
		panneauExifGrid.add(ExifGrid);
71
		panneauIptcGrid.add(IptcGrid); 
124
		panneauIptcGrid.add(IptcGrid); 
72
		
125
		
73
	}
126
	}
74
	
127
	
75
	public ImageMediateur getIMediateur()
128
	public ImageMediateur getIMediateur()
76
	{
129
	{
77
		return imediateur ;
130
		return imediateur ;
78
	}
131
	}
79
	
132
	
80
	
133
	
81
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
134
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
82
		
135
		
83
		if(nouvelleDonnees instanceof Object[])
136
		if(nouvelleDonnees instanceof Object[])
84
		{
137
		{
85
			Object meta[] = (Object[])nouvelleDonnees ;
138
			Object meta[] = (Object[])nouvelleDonnees ;
86
			String[][] exif = (String[][])meta[0] ;
139
			String[][] exif = (String[][])meta[0] ;
87
			String[][] iptc = (String[][])meta[1] ;
140
			String[][] iptc = (String[][])meta[1] ;
-
 
141
			String[][] gen = (String[][])meta[2] ;
88
			
142
			
89
			NameValuePair[] exifSource = new NameValuePair[exif.length] ;
143
			NameValuePair[] exifSource = new NameValuePair[exif.length] ;
90
			NameValuePair[] iptcSource = new NameValuePair[iptc.length] ;
144
			NameValuePair[] iptcSource = new NameValuePair[iptc.length] ;
91
			
145
			
92
			
146
			
93
			int maxLength ;
147
			int maxLength ;
94
			if(exif.length <= iptc.length)
148
			if(exif.length <= iptc.length)
95
			{
149
			{
96
				maxLength = iptc.length ;
150
				maxLength = iptc.length ;
97
			}
151
			}
98
			else
152
			else
99
			{
153
			{
100
				maxLength = exif.length ;
154
				maxLength = exif.length ;
101
			}
155
			}
102
			
156
			
103
			for(int i = 0; i < maxLength ; i++)
157
			for(int i = 0; i < maxLength ; i++)
104
			{
158
			{
105
				if(i < exif.length)
159
				if(i < exif.length)
106
				{
160
				{
107
					exifSource[i] = new NameValuePair(exif[i][0],exif[i][1]) ;
161
					exifSource[i] = new NameValuePair(exif[i][0],exif[i][1]) ;
108
				}
162
				}
109
				
163
				
110
				if(i < iptc.length)
164
				if(i < iptc.length)
111
				{
165
				{
112
					iptcSource[i] = new NameValuePair(iptc[i][0],iptc[i][1]) ;
166
					iptcSource[i] = new NameValuePair(iptc[i][0],iptc[i][1]) ;
113
				}
167
				}
114
			}
168
			}
-
 
169
			
-
 
170
			commentaireGeneral.setValue(gen[0][1]) ;
-
 
171
			
115
			
172
			dateImage.setValue(gen[1][1]) ;
116
			
173
			
117
			ExifGrid.setSource(exifSource);
174
			ExifGrid.setSource(exifSource);
118
			IptcGrid.setSource(iptcSource);
175
			IptcGrid.setSource(iptcSource);
-
 
176
		
119
			
177
			
120
			gViewExif.refresh(true) ;
178
			gViewExif.refresh(true) ;
121
			gViewIptc.refresh(true) ;
179
			gViewIptc.refresh(true) ;
122
			
180
			
123
		}	
181
		}	
124
	}
182
	}
125
}
183
}