Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 301 Rev 318
Line 22... Line 22...
22
import com.gwtext.client.data.MemoryProxy;
22
import com.gwtext.client.data.MemoryProxy;
23
import com.gwtext.client.data.Record;
23
import com.gwtext.client.data.Record;
24
import com.gwtext.client.data.RecordDef;
24
import com.gwtext.client.data.RecordDef;
25
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.Store;
26
import com.gwtext.client.data.StringFieldDef;
26
import com.gwtext.client.data.StringFieldDef;
-
 
27
import com.gwtext.client.dd.DragData;
-
 
28
import com.gwtext.client.dd.DragSource;
-
 
29
import com.gwtext.client.dd.DropTarget;
-
 
30
import com.gwtext.client.dd.DropTargetConfig;
27
import com.gwtext.client.widgets.Button;
31
import com.gwtext.client.widgets.Button;
28
import com.gwtext.client.widgets.Component;
32
import com.gwtext.client.widgets.Component;
29
import com.gwtext.client.widgets.Panel;
33
import com.gwtext.client.widgets.Panel;
30
import com.gwtext.client.widgets.Tool;
34
import com.gwtext.client.widgets.Tool;
31
import com.gwtext.client.widgets.Toolbar;
35
import com.gwtext.client.widgets.Toolbar;
Line 34... Line 38...
34
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
38
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
35
import com.gwtext.client.widgets.event.PanelListenerAdapter;
39
import com.gwtext.client.widgets.event.PanelListenerAdapter;
36
import com.gwtext.client.widgets.grid.CellMetadata;
40
import com.gwtext.client.widgets.grid.CellMetadata;
37
import com.gwtext.client.widgets.grid.ColumnConfig;
41
import com.gwtext.client.widgets.grid.ColumnConfig;
38
import com.gwtext.client.widgets.grid.ColumnModel;
42
import com.gwtext.client.widgets.grid.ColumnModel;
-
 
43
import com.gwtext.client.widgets.grid.GridDragData;
39
import com.gwtext.client.widgets.grid.GridPanel;
44
import com.gwtext.client.widgets.grid.GridPanel;
40
import com.gwtext.client.widgets.grid.Renderer;
45
import com.gwtext.client.widgets.grid.Renderer;
41
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
46
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
42
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
47
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
Line 140... Line 145...
140
	 */
145
	 */
141
	public ListeObservationVue(ObservationMediateur obs) {		
146
	public ListeObservationVue(ObservationMediateur obs) {		
Line 142... Line 147...
142
		
147
		
Line -... Line 148...
-
 
148
		this.observationMediateur = obs;
-
 
149
		
143
		this.observationMediateur = obs;
150
		setId("x-list-obs");
Line 144... Line 151...
144
		
151
		
145
		setHeader(true);
152
		setHeader(true);
Line 295... Line 302...
295
		
302
		
296
		this.setStore(st);
303
		this.setStore(st);
297
		this.getView().setAutoFill(true);
304
		this.getView().setAutoFill(true);
Line -... Line 305...
-
 
305
		this.getView().setForceFit(true) ;
-
 
306
		
-
 
307
		//Enable drag and drop
-
 
308
		this.setEnableDragDrop(true);
-
 
309
		//You need to set the same group for both grids
298
		this.getView().setForceFit(true) ;
310
		this.setDdGroup("ObsMotsClesGroup");
299
		
311
		
Line 300... Line 312...
300
		// on crée un masque de chargement qui s'affichera lors des mises à jour
312
		// on crée un masque de chargement qui s'affichera lors des mises à jour
301
		this.setLoadMask("Chargement");
313
		this.setLoadMask("Chargement");
Line -... Line 314...
-
 
314
	
302
	
315
		// on ajoute les listeners
303
		// on ajoute les listeners
316
		ajouterListeners();
Line 304... Line 317...
304
		ajouterListeners();
317
		
305
		
318
		configDragAndDrop();
Line 372... Line 385...
372
			}
385
			}
373
		});
386
		});
Line 374... Line 387...
374
		
387
		
375
		this.addListener(new PanelListenerAdapter() {
388
		this.addListener(new PanelListenerAdapter() {
376
			public void onBodyResize(Panel panel, java.lang.String width, java.lang.String height) {
389
			public void onBodyResize(Panel panel, java.lang.String width, java.lang.String height) {
377
				setHeight("50%");
390
				doLayout();
378
			}
391
			}
379
		});
392
		});
-
 
393
	}
-
 
394
	
-
 
395
	/**
-
 
396
	 * Configure le drag 'n drop pour la liste
-
 
397
	 */
-
 
398
	private void configDragAndDrop()
-
 
399
	{
-
 
400
 
-
 
401
		// on fabrique la nouvelle configuration
-
 
402
		// les éléments sur lesquels on fait du drag 'n drop doivent tous avoir le même ddGroup
-
 
403
		this.setDdGroup("ObsMotsClesGroup");
-
 
404
		DropTargetConfig dtc = new DropTargetConfig();
-
 
405
		dtc.setdDdGroup("ObsMotsClesGroup");
-
 
406
 
-
 
407
		//La drop target permet de gérer l'évenement onDrop sur l'élement courant
-
 
408
		@SuppressWarnings("unused")
-
 
409
		DropTarget tg = new DropTarget(this, dtc)
-
 
410
		{
-
 
411
			public boolean notifyDrop(DragSource source, EventObject e, DragData data){	
-
 
412
				
-
 
413
				// si on reçoit des données provenant d'une grille
-
 
414
				if(data instanceof GridDragData)
-
 
415
		    	  {
-
 
416
					// on la convertit 
-
 
417
		    		  	GridDragData gdd = (GridDragData)data ;
-
 
418
		    		  	// et on vérifie que les données ne viennent pas de l'élément courant
-
 
419
		    		  	if(gdd.getGrid().getId().equals("x-list-obs"))
-
 
420
		    		  	{
-
 
421
		    		  		Window.alert("on a recu du grid : "+data.toString());
-
 
422
		    		  		return true ;
-
 
423
		    		  		// on appelle le médiateur
-
 
424
		    		  		//return iMediateur.lierImagesDD(source, e, data) ;   
-
 
425
		    		  	}
-
 
426
		    	  }
-
 
427
				return true ;
-
 
428
	
-
 
429
			}
-
 
430
			
-
 
431
			public String notifyOver(DragSource source, EventObject e, DragData data){
-
 
432
			    return "x-dd-drop-ok";
-
 
433
			}
-
 
434
		};
-
 
435
        
Line 380... Line 436...
380
	}
436
	}
381
 
437
 
382
	/**
438
	/**
383
	 * Méthode héritée de l'interface VueListable
439
	 * Méthode héritée de l'interface VueListable