Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 129 Rev 133
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.Event;
-
 
14
import com.google.gwt.user.client.Window;
12
import com.gwtext.client.core.EventCallback;
15
import com.gwtext.client.core.EventCallback;
13
import com.gwtext.client.core.EventObject;
16
import com.gwtext.client.core.EventObject;
14
import com.gwtext.client.core.Ext;
17
import com.gwtext.client.core.Ext;
15
import com.gwtext.client.core.ExtElement;
18
import com.gwtext.client.core.ExtElement;
16
import com.gwtext.client.core.Function;
19
import com.gwtext.client.core.Function;
Line 32... Line 35...
32
import com.gwtext.client.widgets.grid.CellMetadata;
35
import com.gwtext.client.widgets.grid.CellMetadata;
33
import com.gwtext.client.widgets.grid.ColumnConfig;
36
import com.gwtext.client.widgets.grid.ColumnConfig;
34
import com.gwtext.client.widgets.grid.ColumnModel;
37
import com.gwtext.client.widgets.grid.ColumnModel;
35
import com.gwtext.client.widgets.grid.GridPanel;
38
import com.gwtext.client.widgets.grid.GridPanel;
36
import com.gwtext.client.widgets.grid.Renderer;
39
import com.gwtext.client.widgets.grid.Renderer;
-
 
40
import com.gwtext.client.widgets.grid.event.GridListener;
-
 
41
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
37
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
42
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
Line 38... Line 43...
38
 
43
 
39
/**
44
/**
40
 * Liste d'observation composée de ligne d'observation
45
 * Liste d'observation composée de ligne d'observation
Line 111... Line 116...
111
	
116
	
Line 112... Line 117...
112
	private ListeObservation cacheListeObservation = null;
117
	private ListeObservation cacheListeObservation = null;
Line -... Line 118...
-
 
118
	
-
 
119
	private Tool exporterObservations = null ;
113
	
120
	
114
	private Tool exporterObservations = null ;
121
	private final int KEY_ENTER = 13;
115
	
122
	
116
	/**
123
	/**
117
	 * Constructeur sans arguments (privé car ne doit pas être utilisé)
124
	 * Constructeur sans arguments (privé car ne doit pas être utilisé)
Line 202... Line 209...
202
				return value.toString() ;
209
				return value.toString() ;
203
			}
210
			}
Line 204... Line 211...
204
			
211
			
Line -... Line 212...
-
 
212
		} ;
-
 
213
		
-
 
214
		Renderer dateRend = new Renderer() {
-
 
215
 
-
 
216
			public String render(Object value, CellMetadata cellMetadata,
-
 
217
					Record record, int rowIndex, int colNum, Store store) {
-
 
218
				
-
 
219
				if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
-
 
220
				
-
 
221
					return "" ;
-
 
222
				}	
-
 
223
				else
-
 
224
				{
-
 
225
					String dateEntiere = value.toString() ;
-
 
226
					String[] dateEtHeure = dateEntiere.split(" ", 2);
-
 
227
					if(verifierFormatDate(dateEtHeure[0])) {
-
 
228
						String[] dateFormateeTab = dateEtHeure[0].split("-",3);
-
 
229
						return dateFormateeTab[2]+"/"+dateFormateeTab[1]+"/"+dateFormateeTab[0] ;
-
 
230
					}
-
 
231
				}
-
 
232
				
-
 
233
				return value.toString() ;
-
 
234
			}
-
 
235
			
205
		} ;
236
		} ;
Line 206... Line 237...
206
		
237
		
207
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
238
		etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
208
 
239
 
Line 220... Line 251...
220
			
251
			
221
		});		
252
		});		
222
		nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
253
		nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
223
		nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
254
		nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
224
		lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
255
		lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
225
		dateObservation = new ColumnConfig("Date", "date_observation", 120, true, colRend);
256
		dateObservation = new ColumnConfig("Date", "date_observation", 120, true, dateRend);
Line 226... Line 257...
226
		ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
257
		ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
Line 306... Line 337...
306
				observationMediateur.doubleClicListeObservation(rowIndex);
337
				observationMediateur.doubleClicListeObservation(rowIndex);
307
			}
338
			}
Line 308... Line 339...
308
			
339
			
Line -... Line 340...
-
 
340
		});
-
 
341
		
-
 
342
		this.addGridListener(new GridListenerAdapter() {
-
 
343
			public void onKeyPress(EventObject e) {
-
 
344
				if(e.getKey() == KEY_ENTER) {
-
 
345
					Record rd = getSelectionModel().getSelected();
-
 
346
					int rowIndex = st.indexOf(rd);
-
 
347
					String ordreObservation = rd.getAsString("ordre_observation") ;
-
 
348
					observationMediateur.onClicListeObservation(rowIndex, ordreObservation);
-
 
349
				}
-
 
350
			}
309
		});
351
		});
310
		
352
		
Line 311... Line 353...
311
		this.addListener(new PanelListenerAdapter() {
353
		this.addListener(new PanelListenerAdapter() {
312
			public void onRender(Component c) {
354
			public void onRender(Component c) {
Line 709... Line 751...
709
		// on associe le store
751
		// on associe le store
Line 710... Line 752...
710
		
752
		
Line 711... Line 753...
711
		this.setStore(st);
753
		this.setStore(st);
-
 
754
		
-
 
755
	}
-
 
756
	
-
 
757
	public boolean verifierFormatDate(String date) {
-
 
758
		
-
 
759
		String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
-
 
760
		if(date.matches(regex) && !date.equals("0000-00-00")) {
-
 
761
			return true ;
-
 
762
		}
-
 
763
		else {
-
 
764
			return false;
Line 712... Line 765...
712
		
765
		}