Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 107 Rev 128
Line 7... Line 7...
7
import org.tela_botanica.client.modeles.Observation;
7
import org.tela_botanica.client.modeles.Observation;
8
import org.tela_botanica.client.observation.ObservationMediateur;
8
import org.tela_botanica.client.observation.ObservationMediateur;
9
import org.tela_botanica.client.interfaces.ListePaginable;
9
import org.tela_botanica.client.interfaces.ListePaginable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
10
import org.tela_botanica.client.interfaces.Rafraichissable;
11
import org.tela_botanica.client.interfaces.VueListable;
11
import org.tela_botanica.client.interfaces.VueListable;
12
 
-
 
13
import com.google.gwt.user.client.Window;
12
import com.gwtext.client.core.EventCallback;
14
import com.gwtext.client.core.EventObject;
13
import com.gwtext.client.core.EventObject;
15
import com.gwtext.client.core.Ext;
14
import com.gwtext.client.core.Ext;
16
import com.gwtext.client.core.ExtElement;
15
import com.gwtext.client.core.ExtElement;
17
import com.gwtext.client.core.Function;
16
import com.gwtext.client.core.Function;
18
import com.gwtext.client.data.ArrayReader;
17
import com.gwtext.client.data.ArrayReader;
19
import com.gwtext.client.data.FieldDef;
18
import com.gwtext.client.data.FieldDef;
20
import com.gwtext.client.data.MemoryProxy;
19
import com.gwtext.client.data.MemoryProxy;
21
import com.gwtext.client.data.Record;
20
import com.gwtext.client.data.Record;
22
import com.gwtext.client.data.RecordDef;
21
import com.gwtext.client.data.RecordDef;
23
import com.gwtext.client.data.SimpleStore;
-
 
24
import com.gwtext.client.data.Store;
22
import com.gwtext.client.data.Store;
25
import com.gwtext.client.data.StringFieldDef;
23
import com.gwtext.client.data.StringFieldDef;
-
 
24
import com.gwtext.client.widgets.Button;
26
import com.gwtext.client.widgets.Component;
25
import com.gwtext.client.widgets.Component;
27
import com.gwtext.client.widgets.Tool;
26
import com.gwtext.client.widgets.Tool;
-
 
27
import com.gwtext.client.widgets.Toolbar;
-
 
28
import com.gwtext.client.widgets.ToolbarButton;
-
 
29
import com.gwtext.client.widgets.ToolbarTextItem;
28
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
30
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
29
import com.gwtext.client.widgets.form.ComboBox;
31
import com.gwtext.client.widgets.event.PanelListenerAdapter;
30
import com.gwtext.client.widgets.grid.CellMetadata;
32
import com.gwtext.client.widgets.grid.CellMetadata;
31
import com.gwtext.client.widgets.grid.ColumnConfig;
33
import com.gwtext.client.widgets.grid.ColumnConfig;
32
import com.gwtext.client.widgets.grid.ColumnModel;
34
import com.gwtext.client.widgets.grid.ColumnModel;
33
import com.gwtext.client.widgets.grid.GridPanel;
35
import com.gwtext.client.widgets.grid.GridPanel;
34
import com.gwtext.client.widgets.grid.Renderer;
36
import com.gwtext.client.widgets.grid.Renderer;
Line 105... Line 107...
105
	/**
107
	/**
106
	 * Nombre d'éléments total correspondant à la requete
108
	 * Nombre d'éléments total correspondant à la requete
107
	 */
109
	 */
108
	private int nbElements = 0 ;
110
	private int nbElements = 0 ;
Line 109... Line -...
109
	
-
 
110
	
111
	
Line 111... Line 112...
111
	private ListeObservation cacheListeObservation = null;
112
	private ListeObservation cacheListeObservation = null;
Line 112... Line 113...
112
	
113
	
Line 134... Line 135...
134
        
135
        
135
		// on place la barre de pagination
136
		// on place la barre de pagination
136
		bt = new BarrePaginationVue(this);		
137
		bt = new BarrePaginationVue(this);		
137
		bt.setLabelElement("Observations");
138
		bt.setLabelElement("Observations");
138
		bt.setTaillePageParDefaut(20);
139
		bt.setTaillePageParDefaut(20);
139
		bt.setIntervallesPages(new String[] {"400","200",  "100" , "50" , "20"}) ;
140
		bt.setIntervallesPages(new String[] {"400","200",  "100" , "50" , "20", "10"}) ;
-
 
141
		this.setTopToolbar(bt) ;
-
 
142
		
-
 
143
		Toolbar barreActions = new Toolbar();
-
 
144
		ToolbarButton transmettre = new ToolbarButton("Transmettre");
-
 
145
		transmettre.addListener(new ButtonListenerAdapter() {
-
 
146
			public void onClick(Button b, EventObject e) {
-
 
147
				observationMediateur.transmettreObservations();
-
 
148
			}
-
 
149
		});
-
 
150
		ToolbarButton supprimer = new ToolbarButton("Supprimer");
-
 
151
		supprimer.addListener(new ButtonListenerAdapter() {
-
 
152
			public void onClick(Button b, EventObject e) {
-
 
153
				observationMediateur.supprimerObservations();
-
 
154
			}
-
 
155
		});
-
 
156
		
-
 
157
 
-
 
158
		ToolbarTextItem exporter = new ToolbarTextItem("<a href=\"#\" id=\"lienExport\"> Exporter </a>");
-
 
159
		
-
 
160
		barreActions.addButton(transmettre);
-
 
161
		barreActions.addSpacer();
-
 
162
		barreActions.addButton(supprimer);
-
 
163
		barreActions.addSpacer();
-
 
164
		barreActions.addItem(exporter);
-
 
165
		
-
 
166
		
Line 140... Line 167...
140
		this.setBottomToolbar(bt) ;
167
		this.setBottomToolbar(barreActions);
Line 141... Line 168...
141
		
168
		
142
		exporterObservations = new Tool(Tool.PIN, new Function() {
169
		exporterObservations = new Tool(Tool.PIN, new Function() {
Line 172... Line 199...
172
				return value.toString() ;
199
				return value.toString() ;
173
			}
200
			}
Line 174... Line 201...
174
			
201
			
Line 175... Line 202...
175
		} ;
202
		} ;
Line 176... Line 203...
176
		
203
		
177
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 60, true, new Renderer() {
204
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
178
 
205
 
179
			public String render(Object value, CellMetadata cellMetadata,
206
			public String render(Object value, CellMetadata cellMetadata,
180
					Record record, int rowIndex, int colNum, Store store) {
207
					Record record, int rowIndex, int colNum, Store store) {
181
				if(value.equals("1"))
208
				if(value.equals("1"))
182
				{
209
				{
183
					return "<input type=\"checkbox\" checked =\"checked\" disabled=\"disabled\" />" ;
210
					return "<img src=\"tela.png\"/></img>" ;
184
				}
211
				}
185
				else
212
				else
Line 276... Line 303...
276
				observationMediateur.doubleClicListeObservation(rowIndex);
303
				observationMediateur.doubleClicListeObservation(rowIndex);
277
			}
304
			}
Line 278... Line 305...
278
			
305
			
Line 279... Line -...
279
		});
-
 
280
		
306
		});
281
	
-
 
282
		/*this.getSelectionModel().addListener(new RowSelectionListenerAdapter() {
307
		
283
 
308
		this.addListener(new PanelListenerAdapter() {
-
 
309
			public void onRender(Component c) {
284
			// gestion de la sélection
310
				
Line 285... Line 311...
285
			
311
				ExtElement lienExport = Ext.get("lienExport") ;
286
			public void onSelectionChange(RowSelectionModel sm) {
-
 
287
 
-
 
-
 
312
				lienExport.addListener("click", new EventCallback() {
288
				// si on a rien de sélectionné
313
 
289
				if (sm.getCount() <= 0) {
314
					public void execute(EventObject e) {
290
					// on notifie le médiateur (qui désactive notamment l'accès à certaines infos)
-
 
291
		//			getobservationMediateur().aucuneSelection();
-
 
292
				} else {
-
 
293
					// sinon on notifie le médiateur
-
 
-
 
315
						
294
			//		getobservationMediateur().selection();
316
						observationMediateur.exporterObservations();
295
					// et on lui demande de synchroniser la selection avec les autres vues
317
					}
296
				//	getobservationMediateur().synchroniserSelection("liste");
318
					
297
				}
319
				});
Line 298... Line 320...
298
			}
320
			}
299
		});*/
321
		});
300
	}
322
	}