Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 132 → Rev 133

/trunk/src/org/tela_botanica/client/vues/ListeObservationVue.java
9,6 → 9,9
import org.tela_botanica.client.interfaces.ListePaginable;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.interfaces.VueListable;
 
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.gwtext.client.core.EventCallback;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.Ext;
34,6 → 37,8
import com.gwtext.client.widgets.grid.ColumnModel;
import com.gwtext.client.widgets.grid.GridPanel;
import com.gwtext.client.widgets.grid.Renderer;
import com.gwtext.client.widgets.grid.event.GridListener;
import com.gwtext.client.widgets.grid.event.GridListenerAdapter;
import com.gwtext.client.widgets.grid.event.GridRowListenerAdapter;
 
/**
113,6 → 118,8
private Tool exporterObservations = null ;
private final int KEY_ENTER = 13;
/**
* Constructeur sans arguments (privé car ne doit pas être utilisé)
*/
204,6 → 211,30
} ;
Renderer dateRend = new Renderer() {
 
public String render(Object value, CellMetadata cellMetadata,
Record record, int rowIndex, int colNum, Store store) {
if(value == null || value.equals("null") || value.equals("000null") || value.equals("0000-00-00 00:00:00")) {
return "" ;
}
else
{
String dateEntiere = value.toString() ;
String[] dateEtHeure = dateEntiere.split(" ", 2);
if(verifierFormatDate(dateEtHeure[0])) {
String[] dateFormateeTab = dateEtHeure[0].split("-",3);
return dateFormateeTab[2]+"/"+dateFormateeTab[1]+"/"+dateFormateeTab[0] ;
}
}
return value.toString() ;
}
} ;
etatObservation = new ColumnConfig("Transmis", "etat_observation", 20, true, new Renderer() {
 
public String render(Object value, CellMetadata cellMetadata,
222,7 → 253,7
nomSaisiObservation = new ColumnConfig("Nom saisi", "nomSaisi_observation", 200, true, colRend);
nomRetenuObservation = new ColumnConfig("Nom retenu", "nomRetenu_observation", 200, true, colRend);
lieuObservation = new ColumnConfig("Lieu", "lieu_observation", 200, true, colRend);
dateObservation = new ColumnConfig("Date", "date_observation", 120, true, colRend);
dateObservation = new ColumnConfig("Date", "date_observation", 120, true, dateRend);
ordreObservation = new ColumnConfig("Ordre", "ordre_observation", 50, true, colRend);
308,6 → 339,17
});
this.addGridListener(new GridListenerAdapter() {
public void onKeyPress(EventObject e) {
if(e.getKey() == KEY_ENTER) {
Record rd = getSelectionModel().getSelected();
int rowIndex = st.indexOf(rd);
String ordreObservation = rd.getAsString("ordre_observation") ;
observationMediateur.onClicListeObservation(rowIndex, ordreObservation);
}
}
});
this.addListener(new PanelListenerAdapter() {
public void onRender(Component c) {
711,5 → 753,16
this.setStore(st);
}
public boolean verifierFormatDate(String date) {
String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
if(date.matches(regex) && !date.equals("0000-00-00")) {
return true ;
}
else {
return false;
}
}
 
}