Subversion Repositories eFlore/Archives.cel-v2

Rev

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

Rev 19 Rev 22
Line 16... Line 16...
16
import com.google.gwt.user.client.Window;
16
import com.google.gwt.user.client.Window;
17
import com.gwtext.client.core.EventObject;
17
import com.gwtext.client.core.EventObject;
18
import com.gwtext.client.core.XTemplate;
18
import com.gwtext.client.core.XTemplate;
19
import com.gwtext.client.data.ArrayReader;
19
import com.gwtext.client.data.ArrayReader;
20
import com.gwtext.client.data.FieldDef;
20
import com.gwtext.client.data.FieldDef;
-
 
21
import com.gwtext.client.data.IntegerFieldDef;
21
import com.gwtext.client.data.MemoryProxy;
22
import com.gwtext.client.data.MemoryProxy;
22
import com.gwtext.client.data.Record;
23
import com.gwtext.client.data.Record;
23
import com.gwtext.client.data.RecordDef;
24
import com.gwtext.client.data.RecordDef;
24
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.StringFieldDef;
26
import com.gwtext.client.data.StringFieldDef;
Line 122... Line 123...
122
				
123
				
Line 123... Line 124...
123
			}
124
			}
124
 
-
 
Line -... Line 125...
-
 
125
 
-
 
126
 
-
 
127
			public void onSelectionChange(DataView view, Element[] selections) {
-
 
128
				
-
 
129
				if(selections.length <= 0)
-
 
130
				{
-
 
131
					getIMediateur().aucuneSelection();
-
 
132
				}
-
 
133
				else
125
 
134
				{
Line 126... Line 135...
126
			public void onSelectionChange(DataView view, Element[] selections) {
135
					getIMediateur().selection() ;
127
				//TODO: appeler le mediateur
136
					getIMediateur().synchroniserSelection("galerie") ;
Line 140... Line 149...
140
		// pour chacune des photos
149
		// pour chacune des photos
141
		final XTemplate template = new XTemplate(
150
		final XTemplate template = new XTemplate(
142
				new String[]{
151
				new String[]{
143
						"<tpl for='.'>",
152
						"<tpl for='.'>",
144
						"<div class='thumb-wrap' id='{num_image}'>",
153
						"<div class='thumb-wrap' id='{num_image}'>",
145
						"<div class='thumb'><img src='{url_image_S}' title='{num_image}'></div>",
154
						"<div class='thumb'><img src='{url_image_M}' title='{num_image}'></div>",
146
						"<span>{nom}</span></div>", "</tpl>",
155
						"<span>{nom}</span></div>", "</tpl>",
147
						"<div class='x-clear'></div>"});
156
						"<div class='x-clear'></div>"});
148
		template.compile();
157
		template.compile();
Line 149... Line 158...
149
 
158
 
Line 164... Line 173...
164
		dView.setOverCls("x-view-over");
173
		dView.setOverCls("x-view-over");
165
		dView.setEmptyText("Aucune image à afficher");
174
		dView.setEmptyText("Aucune image à afficher");
Line 166... Line 175...
166
		
175
		
167
		
176
		
-
 
177
		// creation du store
168
		// creation du store
178
		FieldDef defNumImage = new IntegerFieldDef("num_image");
169
		FieldDef defNumImage = new StringFieldDef("num_image");
179
		FieldDef defDatImage = new StringFieldDef("dat_image");
170
		FieldDef defUrlImage = new StringFieldDef("url_image");
180
		FieldDef defLieImage = new StringFieldDef("lie_image");
-
 
181
		FieldDef defAppImage = new StringFieldDef("app_image");
-
 
182
		FieldDef defUrlImageS = new StringFieldDef("url_image_S");
171
		FieldDef defUrlImageM = new StringFieldDef("url_image_M");
183
		FieldDef defUrlImageM = new StringFieldDef("url_image_M");
172
		FieldDef defUrlImageS = new StringFieldDef("url_image_S");
184
		FieldDef defUrlImage = new StringFieldDef("url_image");
173
		FieldDef[] defTab = {defNumImage,defUrlImage,defUrlImageM,defUrlImageS};
185
		FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImageS,defUrlImageM,defUrlImage};
174
		RecordDef rd = new RecordDef(defTab) ;
186
		RecordDef rd = new RecordDef(defTab) ;
Line 175... Line 187...
175
		st = new Store(rd) ;
187
		st = new Store(rd) ;
Line 187... Line 199...
187
	
199
	
Line 188... Line 200...
188
	
200
	
189
	
201
	
190
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
202
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
191
		
-
 
192
		if(nouvelleDonnees instanceof ListeImageCarnet)
-
 
193
		{
-
 
194
			ListeImageCarnet data = (ListeImageCarnet) nouvelleDonnees ;
-
 
195
			Object[][] photoData = new Object[data.size()][4];
-
 
196
			int i = 0 ;
-
 
197
			
-
 
198
			for (Iterator it = data.keySet().iterator(); it.hasNext();) 
-
 
199
			{
-
 
200
				ImageCarnet im = (ImageCarnet) data.get(it.next());
-
 
201
				photoData[i][0] = im.getOrdre() ;
-
 
202
				photoData[i][1] = im.getUrl() ;
-
 
203
				photoData[i][2] = im.getSUrl() ;
-
 
204
				photoData[i][3] = im.getMUrl() ;
-
 
205
				i++ ;
-
 
206
			}
-
 
207
			
-
 
208
			final MemoryProxy dataProxy = new MemoryProxy(photoData);
-
 
209
			final ArrayReader reader = new ArrayReader(new RecordDef(
-
 
210
					new FieldDef[]{new StringFieldDef("num_image"),
-
 
211
							new StringFieldDef("url_image"),
-
 
212
							new StringFieldDef("url_image_S"),
203
		
213
							new StringFieldDef("url_image_M")}));
-
 
214
	
-
 
215
			final Store photoStore = new Store(dataProxy, reader);
204
		if(nouvelleDonnees instanceof Store)
216
			photoStore.load();
205
		{	
-
 
206
			st = (Store)nouvelleDonnees;
217
	
207
			st.load() ;
218
			st = photoStore;
208
			dView.setStore(st);
219
			dView.setStore(st);
209
			dView.refresh();			
220
			dView.refresh();
210
		}
221
			
-
 
222
			if(repandreRafraichissement)
211
		
223
			{
-
 
224
				getIMediateur().synchroniserZoomListeGalerie(nouvelleDonnees, this) ;
212
		if(repandreRafraichissement)
Line 225... Line 213...
225
			}
213
		{
226
		}
214
			getIMediateur().synchroniserDonneesZoomListeGalerie(nouvelleDonnees, this) ;
Line 253... Line 241...
253
			id_selection[i] = selection[i].getAsString("num_image") ;
241
			id_selection[i] = selection[i].getAsString("num_image") ;
254
		}
242
		}
Line 255... Line 243...
255
		
243
		
256
		return id_selection ;
244
		return id_selection ;
-
 
245
	}
-
 
246
 
-
 
247
 
-
 
248
	public void selectionnerImages(int[] ids) {
-
 
249
		
-
 
250
		getDView().select(ids) ;
-
 
251
		
257
	}
252
	}