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 9... Line 9...
9
import org.tela_botanica.client.interfaces.VueListable;
9
import org.tela_botanica.client.interfaces.VueListable;
10
import org.tela_botanica.client.modeles.ImageCarnet;
10
import org.tela_botanica.client.modeles.ImageCarnet;
11
import org.tela_botanica.client.modeles.ListeImageCarnet;
11
import org.tela_botanica.client.modeles.ListeImageCarnet;
Line -... Line 12...
-
 
12
 
12
 
13
 
13
 
14
import com.google.gwt.core.client.JavaScriptObject;
14
import com.google.gwt.user.client.Window;
15
import com.google.gwt.user.client.Window;
15
import com.gwtext.client.core.EventObject;
16
import com.gwtext.client.core.EventObject;
16
import com.gwtext.client.data.ArrayReader;
17
import com.gwtext.client.data.ArrayReader;
Line 20... Line 21...
20
import com.gwtext.client.data.Record;
21
import com.gwtext.client.data.Record;
21
import com.gwtext.client.data.RecordDef;
22
import com.gwtext.client.data.RecordDef;
22
import com.gwtext.client.data.Store;
23
import com.gwtext.client.data.Store;
23
import com.gwtext.client.data.StoreMgr;
24
import com.gwtext.client.data.StoreMgr;
24
import com.gwtext.client.data.StringFieldDef;
25
import com.gwtext.client.data.StringFieldDef;
-
 
26
import com.gwtext.client.widgets.BoxComponent;
25
import com.gwtext.client.widgets.Component;
27
import com.gwtext.client.widgets.Component;
-
 
28
import com.gwtext.client.widgets.Container;
-
 
29
import com.gwtext.client.widgets.Panel;
-
 
30
import com.gwtext.client.widgets.event.ComponentListenerAdapter;
26
import com.gwtext.client.widgets.event.ContainerListener;
31
import com.gwtext.client.widgets.event.ContainerListener;
27
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
32
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
28
import com.gwtext.client.widgets.event.PanelListener;
33
import com.gwtext.client.widgets.event.PanelListener;
29
import com.gwtext.client.widgets.event.PanelListenerAdapter;
34
import com.gwtext.client.widgets.event.PanelListenerAdapter;
30
import com.gwtext.client.widgets.grid.CellMetadata;
35
import com.gwtext.client.widgets.grid.CellMetadata;
31
import com.gwtext.client.widgets.grid.ColumnConfig;
36
import com.gwtext.client.widgets.grid.ColumnConfig;
32
import com.gwtext.client.widgets.grid.ColumnModel;
37
import com.gwtext.client.widgets.grid.ColumnModel;
33
import com.gwtext.client.widgets.grid.GridPanel;
38
import com.gwtext.client.widgets.grid.GridPanel;
34
import com.gwtext.client.widgets.grid.GridView;
39
import com.gwtext.client.widgets.grid.GridView;
35
import com.gwtext.client.widgets.grid.Renderer;
40
import com.gwtext.client.widgets.grid.Renderer;
-
 
41
import com.gwtext.client.widgets.grid.RowSelectionModel;
36
import com.gwtext.client.widgets.grid.event.GridCellListener;
42
import com.gwtext.client.widgets.grid.event.GridCellListener;
37
import com.gwtext.client.widgets.grid.event.GridListener;
43
import com.gwtext.client.widgets.grid.event.GridListener;
38
import com.gwtext.client.widgets.grid.event.GridRowListener;
44
import com.gwtext.client.widgets.grid.event.GridRowListener;
-
 
45
import com.gwtext.client.widgets.grid.event.RowSelectionListener;
-
 
46
import com.gwtext.client.widgets.grid.event.RowSelectionListenerAdapter;
39
import com.gwtext.client.widgets.layout.AnchorLayout;
47
import com.gwtext.client.widgets.layout.AnchorLayout;
40
import com.gwtext.client.widgets.layout.FitLayout;
48
import com.gwtext.client.widgets.layout.FitLayout;
41
import com.gwtextux.client.data.BufferedStore;
49
import com.gwtextux.client.data.BufferedStore;
Line 42... Line 50...
42
 
50
 
Line 99... Line 107...
99
		this.setColumnModel(modeleColonnes);
107
		this.setColumnModel(modeleColonnes);
100
		this.setAutoScroll(true);
108
		this.setAutoScroll(true);
101
		this.setAutoWidth(true);
109
		this.setAutoWidth(true);
Line -... Line 110...
-
 
110
		
102
		
111
		
103
		
112
		// creation du store
104
		FieldDef defNumImage = new StringFieldDef("num_image");
113
		FieldDef defNumImage = new IntegerFieldDef("num_image");
105
		FieldDef defDatImage = new StringFieldDef("dat_image");
114
		FieldDef defDatImage = new StringFieldDef("dat_image");
106
		FieldDef defLieImage = new StringFieldDef("lie_image");
115
		FieldDef defLieImage = new StringFieldDef("lie_image");
-
 
116
		FieldDef defAppImage = new StringFieldDef("app_image");
107
		FieldDef defAppImage = new StringFieldDef("app_image");
117
		FieldDef defUrlImageS = new StringFieldDef("url_image_S");
108
		FieldDef defUrlImageS = new StringFieldDef("url_image_S");
118
		FieldDef defUrlImageM = new StringFieldDef("url_image_M");
109
		FieldDef defUrlImage = new StringFieldDef("url_imag");
119
		FieldDef defUrlImage = new StringFieldDef("url_image");
110
		FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImageS,defUrlImage};
120
		FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImageS,defUrlImageM,defUrlImage};
111
		RecordDef rd = new RecordDef(defTab) ;
121
		RecordDef rd = new RecordDef(defTab) ;
112
		st = new Store(rd) ;
122
		st = new Store(rd) ;
Line 113... Line 123...
113
		this.setStore(st);
123
		this.setStore(st);
114
		this.getView().setAutoFill(true) ;
124
		this.getView().setAutoFill(true) ;
Line 115... Line 125...
115
		
125
		
Line 116... Line -...
116
		this.setLoadMask(true) ;
-
 
117
		this.setLoadMask("chargement") ;
-
 
118
		
-
 
119
		ajouterListeners() ;
-
 
120
		
-
 
121
	}
-
 
122
	
-
 
123
	
-
 
124
	// role : configurer les colonnes affichées dans la grille
-
 
Line 125... Line 126...
125
	private void initialiser() {
126
		//this.setLoadMask(true) ;
Line 126... Line 127...
126
		
127
		this.setLoadMask("chargement") ;
127
		getIMediateur().obtenirPhotoGalerie(this);
128
		
128
		estInstancie = true ;
129
		ajouterListeners() ;
Line 129... Line -...
129
		
-
 
130
		
-
 
131
	}
-
 
132
	
-
 
133
	public void ajouterListeners()
-
 
134
	{
-
 
Line 135... Line 130...
135
		this.addListener(new ContainerListenerAdapter() {
130
		
136
 
131
		
Line 137... Line 132...
137
 
132
	}
Line 138... Line 133...
138
			public boolean doBeforeRender(Component component)
133
	
139
			{
134
	public void ajouterListeners()
140
				initialiser();
-
 
141
				return true ;
-
 
142
			}
-
 
Line -... Line 135...
-
 
135
	{	
-
 
136
		this.addListener(new ContainerListenerAdapter() {
-
 
137
 
-
 
138
			
-
 
139
			public void onHide(Component component) {
-
 
140
				// TODO Auto-generated method stub
Line -... Line 141...
-
 
141
				
143
			
142
			}
Line -... Line 143...
-
 
143
 
144
			public void onHide(Component component) {
144
			
-
 
145
			public void onRender(Component component) {
Line 145... Line 146...
145
				// TODO Auto-generated method stub
146
 
Line 146... Line 147...
146
				
147
				if(!isEstInstancie())
Line 147... Line 148...
147
			}
148
				{
148
 
149
					setEstInstancie(true) ;
149
 
150
					getIMediateur().synchroniserSelection("galerie") ;
150
			public void onRender(Component component) {
151
				}
Line 151... Line 152...
151
				// TODO Auto-generated method stub
152
			}
152
				
153
 
-
 
154
			
153
			}
155
			public void onShow(Component component) {
Line 154... Line 156...
154
 
156
				
Line 155... Line 157...
155
 
157
				
156
			public void onShow(Component component) {
158
			}
Line -... Line 159...
-
 
159
 
157
				
160
			
-
 
161
		});
Line 158... Line 162...
158
			}
162
		
159
			
-
 
Line -... Line 163...
-
 
163
		this.addGridRowListener(new GridRowListener() {
-
 
164
 
-
 
165
 
-
 
166
			public void onRowClick(GridPanel grid, int rowIndex, EventObject e) {
-
 
167
					;
-
 
168
				getIMediateur().clicListeImage(rowIndex) ;	
-
 
169
			}
-
 
170
 
-
 
171
			public void onRowContextMenu(GridPanel grid, int rowIndex,
-
 
172
					EventObject e) {
-
 
173
				
-
 
174
				getIMediateur().montrerContextMenu(e) ;
-
 
175
				
-
 
176
			}
-
 
177
 
-
 
178
			public void onRowDblClick(GridPanel grid, int rowIndex,
-
 
179
					EventObject e) {
Line 160... Line 180...
160
		});
180
				
161
		
181
 
Line 162... Line 182...
162
		this.addGridRowListener(new GridRowListener() {
182
				getIMediateur().doubleClicListeImage(rowIndex) ;
Line 200... Line 220...
200
	}
220
	}
Line 201... Line 221...
201
 
221
 
Line 202... Line 222...
202
 
222
 
203
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
223
	public void rafraichir(Object nouvelleDonnees, boolean repandreRafraichissement) {
204
		
-
 
205
		if(nouvelleDonnees instanceof ListeImageCarnet && estInstancie)
-
 
206
		{
-
 
207
			ListeImageCarnet data = (ListeImageCarnet) nouvelleDonnees ;
-
 
208
			Object[][] photoData = new Object[data.size()][6];
-
 
209
			int i = 0 ;
-
 
210
			for (Iterator it = data.keySet().iterator(); it.hasNext();) 
-
 
211
			{
-
 
212
				ImageCarnet im = (ImageCarnet) data.get(it.next());
-
 
213
				photoData[i][0] = im.getOrdre() ;
-
 
214
				photoData[i][1] = im.getDate() ;
-
 
215
				photoData[i][2] = im.getIptcCity() ;
-
 
216
				photoData[i][3] = im.getMake()+" "+im.getModel() ;
-
 
217
				photoData[i][4] = im.getSUrl() ;
-
 
218
				photoData[i][5] = im.getUrl() ;
-
 
219
				
-
 
220
				i++ ;
-
 
221
			}
-
 
222
	
-
 
223
			FieldDef defNumImage = new IntegerFieldDef("num_image");
-
 
224
			FieldDef defDatImage = new StringFieldDef("dat_image");
-
 
225
			FieldDef defLieImage = new StringFieldDef("lie_image");
-
 
226
			FieldDef defAppImage = new StringFieldDef("app_image");
-
 
Line 227... Line -...
227
			FieldDef defUrlImage = new StringFieldDef("url_image_S");
-
 
228
			FieldDef defUrlImageL = new StringFieldDef("url_image");
-
 
229
			FieldDef[] defTab = {defNumImage,defDatImage,defLieImage,defAppImage,defUrlImage,defUrlImageL};
-
 
230
			
224
		
231
			final MemoryProxy dataProxy = new MemoryProxy(photoData);
-
 
232
			final ArrayReader reader = new ArrayReader(new RecordDef(defTab));
225
		if(nouvelleDonnees instanceof Store)
233
	
226
		{
234
			final Store photoStore = new Store(dataProxy, reader);
-
 
235
	
227
			
Line 236... Line 228...
236
			st = photoStore;
228
			st = (Store)nouvelleDonnees;
237
			this.reconfigure(st, this.getColumnModel());
229
			st.load();
238
			photoStore.load();
230
			this.reconfigure(st, this.getColumnModel());
239
		}
231
		}
240
		
232
		
Line 241... Line 233...
241
		if(repandreRafraichissement)
233
		if(repandreRafraichissement)
Line 271... Line 263...
271
 
263
 
272
 
264
 
273
	public ColumnConfig getCl() {
265
	public ColumnConfig getCl() {
-
 
266
		return cl;
-
 
267
	}
-
 
268
 
-
 
269
 
-
 
270
	/**
-
 
271
	 * @return the estInstancie
-
 
272
	 */
-
 
273
	public boolean isEstInstancie() {
-
 
274
		return estInstancie;
-
 
275
	}
-
 
276
 
-
 
277
 
-
 
278
	/**
-
 
279
	 * @param estInstancie the estInstancie to set
-
 
280
	 */
-
 
281
	public void setEstInstancie(boolean estInstancie) {
-
 
282
		this.estInstancie = estInstancie;
-
 
283
	}
-
 
284
 
-
 
285
 
-
 
286
	/**
-
 
287
	 * @param mediateur the iMediateur to set
-
 
288
	 */
-
 
289
	public void setIMediateur(ImageMediateur mediateur) {
-
 
290
		iMediateur = mediateur;
-
 
291
	}
-
 
292
 
-
 
293
	public void selectionnerEnregistrements(Record[] sel) {
-
 
294
		
-
 
295
		if(isEstInstancie())
-
 
296
		{
-
 
297
			getSelectionModel().clearSelections() ;
-
 
298
			getSelectionModel().selectRecords(sel) ;
Line 274... Line 299...
274
		return cl;
299
		}