Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 323 Rev 337
Line 9... Line 9...
9
import org.tela_botanica.client.vues.BarrePaginationVue;
9
import org.tela_botanica.client.vues.BarrePaginationVue;
10
import org.tela_botanica.client.interfaces.ListePaginable;
10
import org.tela_botanica.client.interfaces.ListePaginable;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
11
import org.tela_botanica.client.interfaces.Rafraichissable;
12
import org.tela_botanica.client.interfaces.VueListable;
12
import org.tela_botanica.client.interfaces.VueListable;
Line -... Line 13...
-
 
13
 
13
 
14
import com.google.gwt.core.client.GWT;
14
import com.google.gwt.user.client.Window;
15
import com.google.gwt.user.client.Window;
15
import com.gwtext.client.core.EventCallback;
16
import com.gwtext.client.core.EventCallback;
16
import com.gwtext.client.core.EventObject;
17
import com.gwtext.client.core.EventObject;
17
import com.gwtext.client.core.Ext;
18
import com.gwtext.client.core.Ext;
Line 23... Line 24...
23
import com.gwtext.client.data.Record;
24
import com.gwtext.client.data.Record;
24
import com.gwtext.client.data.RecordDef;
25
import com.gwtext.client.data.RecordDef;
25
import com.gwtext.client.data.Store;
26
import com.gwtext.client.data.Store;
26
import com.gwtext.client.data.StringFieldDef;
27
import com.gwtext.client.data.StringFieldDef;
27
import com.gwtext.client.dd.DragData;
28
import com.gwtext.client.dd.DragData;
-
 
29
import com.gwtext.client.dd.DragDropConfig;
28
import com.gwtext.client.dd.DragSource;
30
import com.gwtext.client.dd.DragSource;
29
import com.gwtext.client.dd.DropTarget;
31
import com.gwtext.client.dd.DropTarget;
30
import com.gwtext.client.dd.DropTargetConfig;
32
import com.gwtext.client.dd.DropTargetConfig;
31
import com.gwtext.client.widgets.Button;
33
import com.gwtext.client.widgets.Button;
32
import com.gwtext.client.widgets.Component;
34
import com.gwtext.client.widgets.Component;
Line 42... Line 44...
42
import com.gwtext.client.widgets.grid.ColumnModel;
44
import com.gwtext.client.widgets.grid.ColumnModel;
43
import com.gwtext.client.widgets.grid.GridDragData;
45
import com.gwtext.client.widgets.grid.GridDragData;
44
import com.gwtext.client.widgets.grid.GridPanel;
46
import com.gwtext.client.widgets.grid.GridPanel;
45
import com.gwtext.client.widgets.grid.Renderer;
47
import com.gwtext.client.widgets.grid.Renderer;
46
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
48
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
-
 
49
import com.gwtext.client.widgets.grid.event.GridRowListener;
47
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
50
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
-
 
51
import com.gwtext.client.widgets.tree.TreeDragData;
-
 
52
import com.gwtext.client.widgets.tree.TreeNode;
Line 48... Line 53...
48
 
53
 
49
/**
54
/**
50
 * Liste d'observation composée de ligne d'observation
55
 * Liste d'observation composée de ligne d'observation
51
 * l'interface rafraichissable et l'interface vueListable
56
 * l'interface rafraichissable et l'interface vueListable
Line 301... Line 306...
301
		// on associe le store
306
		// on associe le store
Line 302... Line 307...
302
		
307
		
303
		this.setStore(st);
308
		this.setStore(st);
304
		this.getView().setAutoFill(true);
309
		this.getView().setAutoFill(true);
305
		this.getView().setForceFit(true) ;
310
		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
-
 
310
		this.setDdGroup("ObsMotsClesGroup");
-
 
311
		
311
				
312
		// 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
Line 313... Line 313...
313
		this.setLoadMask("Chargement");
313
		this.setLoadMask("Chargement");
314
	
314
	
Line 396... Line 396...
396
	 * Configure le drag 'n drop pour la liste
396
	 * Configure le drag 'n drop pour la liste
397
	 */
397
	 */
398
	private void configDragAndDrop()
398
	private void configDragAndDrop()
399
	{
399
	{
Line -... Line 400...
-
 
400
 
-
 
401
		setDdGroup("ObsMotsClesGroup");
-
 
402
		setEnableDragDrop(true);
400
 
403
		setDragDropText("Glissez les observations sélectionnées sur un projet pour les lier");
401
		// on fabrique la nouvelle configuration
404
		// 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");
405
		// les éléments sur lesquels on fait du drag 'n drop doivent tous avoir le même ddGroup
404
		DropTargetConfig dtc = new DropTargetConfig();
406
		DropTargetConfig dtc = new DropTargetConfig();
-
 
407
		dtc.setdDdGroup("ObsMotsClesGroup");
-
 
408
		dtc.setTarget(true);
-
 
409
		
Line 405... Line 410...
405
		dtc.setdDdGroup("ObsMotsClesGroup");
410
		DragDropConfig ddc = new DragDropConfig();
406
 
411
 
407
		//La drop target permet de gérer l'évenement onDrop sur l'élement courant
412
		//La drop target permet de gérer l'évenement onDrop sur l'élement courant
408
		@SuppressWarnings("unused")
413
		@SuppressWarnings("unused")
409
		DropTarget tg = new DropTarget(this, dtc)
414
		DropTarget tg = new DropTarget(this, dtc)
Line 410... Line 415...
410
		{
415
		{
-
 
416
			public boolean notifyDrop(DragSource source, EventObject e, DragData data){	
411
			public boolean notifyDrop(DragSource source, EventObject e, DragData data){	
417
				
-
 
418
				// si on reçoit des données provenant d'un arbre
-
 
419
				// on les convertit 
412
				
420
				if(data instanceof TreeDragData)  {
413
				// si on reçoit des données provenant d'une grille
421
			    	TreeDragData tdd = (TreeDragData)data ;
-
 
422
			    	
414
				if(data instanceof GridDragData)
423
			    	TreeNode treeNode = tdd.getTreeNode();  
415
		    	  {
424
			    	String idMc = treeNode.getId();  
-
 
425
			    	
416
					// on la convertit 
426
			    	int index = getView().findRowIndex(e);
-
 
427
			    	Record obsRd = getStore().getRecordAt(index);
417
		    		  	GridDragData gdd = (GridDragData)data ;
428
			    	
418
		    		  	// et on vérifie que les données ne viennent pas de l'élément courant
429
			    	String ordreObs = obsRd.getAsString("ordre_observation");
419
		    		  	if(gdd.getGrid().getId().equals("x-list-obs"))
430
			    	
420
		    		  	{
431
			    	if(ordreObs != null) {
421
		    		  		Window.alert("on a recu du grid : "+data.toString());
432
			    		observationMediateur.gererDDMotCleSurObs(ordreObs, idMc);
422
		    		  		return true ;
433
			    		return true ;
423
		    		  		// on appelle le médiateur
434
			    	} else {
424
		    		  		//return iMediateur.lierImagesDD(source, e, data) ;   
435
			    		return true;
425
		    		  	}
-
 
426
		    	  }
436
			    	}
Line 427... Line 437...
427
				return true ;
437
				}
-
 
438
		    	return true;
-
 
439
			}
-
 
440
			
-
 
441
			public String notifyOver(DragSource source, EventObject e, DragData data){
-
 
442
				
-
 
443
				if(data instanceof TreeDragData)  {
-
 
444
			    	TreeDragData tdd = (TreeDragData)data ;
-
 
445
			    	
-
 
446
			    	TreeNode treeNode = tdd.getTreeNode();  
428
	
447
			    	String idMc = treeNode.getId();  
-
 
448
			    	
-
 
449
			    	int index = getView().findRowIndex(e);
-
 
450
			    	if(index < 0) {
-
 
451
			    		return "x-dd-drop-nodrop";
-
 
452
			    	}
-
 
453
			    	
-
 
454
			    	Record obsRd = getStore().getRecordAt(index);
-
 
455
			    	
-
 
456
			    	String ordreObs = obsRd.getAsString("ordre_observation");
-
 
457
			    	
-
 
458
			    	if(ordreObs != null) {
-
 
459
			    		return observationMediateur.gererOverDDMotCleSurObs(ordreObs, idMc);
429
			}
460
			    	}
430
			
461
				}
431
			public String notifyOver(DragSource source, EventObject e, DragData data){
-
 
432
			    return "x-dd-drop-ok";
462
				
Line 433... Line 463...
433
			}
463
				return "x-dd-drop-nodrop";
434
		};
464
			}
435
        
465
		};