Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 19 → Rev 20

/trunk/src/org/tela_botanica/client/cel2.java
3,6 → 3,7
import org.tela_botanica.client.image.ImageMediateur;
 
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.RootPanel;
import com.gwtext.client.widgets.Viewport;
 
/**
21,8 → 22,10
CarnetEnLigneMediateur carnetEnLigneMediateur= CarnetEnLigneMediateur.Instance();
RootPanel.get().add(carnetEnLigneMediateur.getPanneauPrincipalCarnetEnLigne());
new Viewport(carnetEnLigneMediateur.getPanneauPrincipalCarnetEnLigne());
// TODO : l'utilisation du viewport rend l'application extremement lente en mode javas
// new Viewport(carnetEnLigneMediateur.getPanneauPrincipalCarnetEnLigne());
// On appelle la gestion de l'identification
// Veillez d'ailleurs a ne pas appeller de services dans les constructeurs
/trunk/src/org/tela_botanica/client/modeles/ListeObservationAsynchroneDAO.java
14,6 → 14,7
/**
* DAO la liste des observations attachées a un observateur
* @author David Delon
* TODO : se servir de ObservationDAO pour la lecture unitaire
*
*/
public class ListeObservationAsynchroneDAO {
88,11 → 89,16
for (int i = 0; i < taillemax; i++) {
if ((observation=reponse.get(i).isArray()) != null) {
 
String transmis=((JSONString) observation.get(13)).stringValue();
String identifiantLocalite=((JSONString) observation.get(14)).toString();
String nomSaisi=Util.toCelString(((JSONString) observation.get(0)).toString());
String nomRetenu=Util.toCelString(((JSONString) observation.get(2)).toString());
String numeroNomenclatural=((JSONString) observation.get(3)).stringValue();
String numeroNomenclaturalSaisi=((JSONString) observation.get(1)).stringValue();
String numeroNomenclaturalRetenu=((JSONString) observation.get(3)).stringValue();
String numeroTaxonomique=((JSONString) observation.get(4)).stringValue();
String famille=Util.toCelString(((JSONString) observation .get(5)).toString());
String localite=Util.toCelString(((JSONString) observation .get(6)).toString());
103,7 → 109,7
String date=((JSONString) observation .get(8)).stringValue();
String numeroOrdre=((JSONString) observation.get(7)).stringValue();
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclatural, numeroTaxonomique, famille, localite, lieudit, station, milieu, commentaire, date, numeroOrdre);
Observation obs=new Observation(transmis, nomSaisi, nomRetenu, numeroNomenclaturalSaisi, numeroNomenclaturalRetenu ,numeroTaxonomique, famille, localite, identifiantLocalite, lieudit, station, milieu, commentaire, date, numeroOrdre);
observationData.put(obs.getNumeroOrdre(),obs);
}
/trunk/src/org/tela_botanica/client/modeles/Observation.java
7,10 → 7,12
private String transmis=null;
private String nomSaisi=null;
private String nomRetenu=null;
private String numeroNomenclatural=null;
private String numeroNomenclaturalSaisi=null;
private String numeroNomenclaturalRetenu=null;
private String numeroTaxonomique=null;
private String famille=null;
private String localite=null;
private String identifiantLocalite=null;
private String lieudit=null;
private String station=null;
private String milieu=null;
19,6 → 21,7
private String numeroOrdre=null;
 
 
 
public Observation() {
}
28,10 → 31,12
* @param transmis
* @param nomSaisi
* @param nomRetenu
* @param numeroNomenclatural
* @param numeroNomenclaturalSaisi
* @param numeroNomenclaturalRetenu
* @param numeroTaxonomique
* @param famille
* @param localite
* @param IdentifiantLocalite
* @param lieudit
* @param station
* @param milieu
39,15 → 44,17
* @param date
* @param numeroOrdre
*/
public Observation(String transmis, String nomSaisi, String nomRetenu, String numeroNomenclatural, String numeroTaxonomique, String famille, String localite, String lieudit, String station, String milieu, String commentaire, String date, String numeroOrdre) {
public Observation(String transmis, String nomSaisi, String nomRetenu, String numeroNomenclaturalSaisi, String numeroNomenclaturalRetenu, String numeroTaxonomique, String famille, String localite, String identifiantLocalite, String lieudit, String station, String milieu, String commentaire, String date, String numeroOrdre) {
this.transmis = transmis;
this.nomSaisi = nomSaisi;
this.nomRetenu = nomRetenu;
this.numeroNomenclatural = numeroNomenclatural;
this.numeroNomenclaturalSaisi = numeroNomenclaturalSaisi;
this.numeroNomenclaturalRetenu = numeroNomenclaturalRetenu;
this.numeroTaxonomique = numeroTaxonomique;
this.famille = famille;
this.localite = localite;
this.identifiantLocalite = identifiantLocalite;
this.lieudit = lieudit;
this.station = station;
this.milieu = milieu;
94,6 → 101,11
}
 
 
public String getIdentifiantLocalite() {
return identifiantLocalite;
}
 
public String getMilieu() {
return milieu;
}
104,11 → 116,16
}
 
 
public String getNumeroNomenclatural() {
return numeroNomenclatural;
public String getNumeroNomenclaturalSaisi() {
return numeroNomenclaturalSaisi;
}
 
 
public String getNumeroNomenclaturalRetenu() {
return numeroNomenclaturalRetenu;
}
 
 
public String getNumeroTaxonomique() {
return numeroTaxonomique;
}
/trunk/src/org/tela_botanica/client/observation/ObservationModele.java
7,7 → 7,10
import org.tela_botanica.client.modeles.Configuration;
import org.tela_botanica.client.modeles.ListeObservationAsynchroneDAO;
import org.tela_botanica.client.modeles.ListeReferentielCommuneAsynchroneDAO;
import org.tela_botanica.client.modeles.ListeReferentielNom;
import org.tela_botanica.client.modeles.ListeReferentielNomAsynchroneDAO;
import org.tela_botanica.client.modeles.NombreObservationAsynchroneDAO;
import org.tela_botanica.client.modeles.ObservationAsynchroneDAO;
 
 
public class ObservationModele {
118,8 → 121,34
refDAO.obtenirListeDonnees(r, critere);
}
public void obtenirListeReferentielNom(Rafraichissable r, String critere) {
ListeReferentielNomAsynchroneDAO nomDAO=new ListeReferentielNomAsynchroneDAO(this);
nomDAO.obtenirListeDonnees(r, critere);
}
/**
*
* Lance la creation d'une observation
* @param r : la vue demandeuse de donnee
* @param critere : les criteres de selection
*/
public void ajouterObservation(Rafraichissable r) {
ObservationAsynchroneDAO obsDAO=new ObservationAsynchroneDAO(this);
obsDAO.ajouter();
}
 
 
 
/**
* Accesseur pour la configuration en cours d'utilisation
*
/trunk/src/org/tela_botanica/client/observation/ObservationMediateur.java
469,10 → 469,38
 
}
/**
*
* Lance un appel de recherche d'une liste de nom scientifique correspondant aux criteres de selectionne
* @param r : la vue demandeuse de donnee
* @param critere : les criteres de selection
*/
public void obtenirListeReferentielNom(Rafraichissable r, String critere) {
observationModele.obtenirListeReferentielNom(r,critere) ;
 
}
 
/**
*
* Lance la creation d'une observation
* @param r : la vue demandeuse de donnee
* @param critere : les criteres de selection
*/
public void ajouterObservation(Rafraichissable r) {
observationModele.ajouterObservation(r) ;
}
 
 
}
/trunk/src/org/tela_botanica/client/vues/FormulaireSaisieObservationVue.java
6,11 → 6,12
 
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ListeReferentielCommune;
import org.tela_botanica.client.modeles.ListeReferentielNom;
import org.tela_botanica.client.modeles.ReferentielCommune;
import org.tela_botanica.client.modeles.ReferentielNom;
import org.tela_botanica.client.observation.ObservationMediateur;
 
 
import com.google.gwt.user.client.Window;
import com.gwtext.client.core.EventCallback;
import com.gwtext.client.core.EventObject;
import com.gwtext.client.core.ListenerConfig;
23,6 → 24,7
import com.gwtext.client.data.StringFieldDef;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.form.ComboBox;
import com.gwtext.client.widgets.form.DateField;
import com.gwtext.client.widgets.form.FormPanel;
47,7 → 49,7
private ObservationMediateur observationMediateur = null;
private TextField nameAssistant = null;
 
private DateField date = null;
private TextField lieudit = null;
private TextField station = null;
54,33 → 56,34
private TextField milieu = null;
private TextField comment = null;
private ComboBox commune = null;
private ComboBox espece = null;
 
private Button boutonOK = new Button("Ok");
private Button boutonAnnuler = new Button("Annuler");
 
private boolean selectionCommune=false;
private boolean selectionEspece=false;
public static final int KEY_ALT = 18;
public static final int KEY_BACKSPACE = 8;
public static final int KEY_CTRL = 17;
public static final int KEY_DELETE = 46;
public static final int KEY_DOWN = 40;
public static final int KEY_END = 35;
public static final int KEY_ENTER = 13;
public static final int KEY_ESCAPE = 27;
public static final int KEY_HOME = 36;
public static final int KEY_LEFT = 37;
public static final int KEY_PAGEDOWN = 34;
public static final int KEY_PAGEUP = 33;
public static final int KEY_RIGHT = 39;
public static final int KEY_SHIFT = 16;
public static final int KEY_TAB = 9;
public static final int KEY_UP = 38;
/**
* Store combobox communes
*/
private Store store = null;
private final int KEY_ALT = 18;
private final int KEY_BACKSPACE = 8;
private final int KEY_CTRL = 17;
private final int KEY_DELETE = 46;
private final int KEY_DOWN = 40;
private final int KEY_END = 35;
private final int KEY_ENTER = 13;
private final int KEY_ESCAPE = 27;
private final int KEY_HOME = 36;
private final int KEY_LEFT = 37;
private final int KEY_PAGEDOWN = 34;
private final int KEY_PAGEUP = 33;
private final int KEY_RIGHT = 39;
private final int KEY_SHIFT = 16;
private final int KEY_TAB = 9;
private final int KEY_UP = 38;
 
 
/**
* Booleen d'instanciation
146,22 → 149,17
//store.load();*/
 
commune=new ComboBox("Commune","commune",275 );
//commune.setStore(store);
final String resultTpl = "<div class=\"search-item\">{commune}</div>";
final String resultTplCommune = "<div class=\"search-item-commune\">{commune}</div>";
 
commune.setTpl(resultTpl);
commune.setTpl(resultTplCommune);
commune.setMode(ComboBox.REMOTE);
// commune.setPageSize(10); // Ne fonctionne pas
commune.setItemSelector("div.search-item");
//commune.setDisplayField("title");
commune.setItemSelector("div.search-item-commune");
commune.setTypeAhead(true);
commune.setLoadingText("Recherche...");
168,99 → 166,9
commune.setHideTrigger(true);
/*
final String resultTpl = "<div class=\"search-item\"><h3><span>{lastPost:date(\"M j, Y\")}"
+ "<br/>by {author}</span>{title}</h3>{excerpt}</div>";
commune.setTpl(resultTpl);
*/
//commune.setMode(ComboBox.REMOTE);
/*
commune.setTitle("ExtJS Forums");
commune.setHideLabel(true);
commune.setItemSelector("div.search-item");
*/
commune.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
commune.setValue(record.getAsString("commune"));
selectionCommune=true;
}
});
// Selection parmi la liste déroulante
ListenerConfig listenerConfig=new ListenerConfig();
listenerConfig.setDelay(10);
listenerConfig.setStopPropagation(false);
listenerConfig.setStopEvent(false);
 
commune.addKeyPressListener(new EventCallback() {
public void execute(EventObject e) {
switch(e.getKey()) {
case KEY_ALT:
case KEY_CTRL:
case KEY_DOWN:
case KEY_END:
case KEY_ESCAPE:
case KEY_HOME:
case KEY_LEFT:
case KEY_PAGEDOWN:
case KEY_PAGEUP:
case KEY_RIGHT:
case KEY_SHIFT:
case KEY_TAB:
case KEY_UP:
break;
case KEY_ENTER:
if (selectionCommune) {
selectionCommune=false;
}
else {
// lancer mise a jour
}
break;
default:
obtenirListeReferentielCommune();
break;
}
 
}
}, listenerConfig
);
 
 
 
panneauPremierColonne.add(commune);
 
271,13 → 179,29
date = new DateField("Date", "date", 100);
date.setAllowBlank(true);
date.setFormat("d/m/yyyy") ;
date.setFormat("d/m/Y") ;
panneauPremierColonne.add(date);
nameAssistant = new TextField("Espèce", "espece", 275);
nameAssistant.setAllowBlank(false);
panneauPremierColonne.add(nameAssistant);
 
espece=new ComboBox("Espèce","nom",275 );
final String resultTplEspece = "<div class=\"search-item-espece\">{nom}</div>";
 
espece.setTpl(resultTplEspece);
espece.setMode(ComboBox.REMOTE);
// commune.setPageSize(10); // Ne fonctionne pas
espece.setItemSelector("div.search-item-espece");
espece.setTypeAhead(true);
espece.setLoadingText("Recherche...");
espece.setHideTrigger(true);
 
 
panneauPremierColonne.add(espece);
comment = new TextField("Notes", "comment", 275);
comment.setAllowBlank(true);
panneauPremierColonne.add(comment);
299,10 → 223,10
panneauFormulaire.add(panneauIntermediaire);
Button boutonOK = new Button("Ok");
panneauFormulaire.addButton(boutonOK);
Button boutonAnnuler = new Button("Annuler");
panneauFormulaire.addButton(boutonAnnuler);
311,7 → 235,6
this.setAutoHeight(true);
// on ajoute les listeners
ajouterListeners() ;
322,6 → 245,154
private void ajouterListeners()
{
// Listener completion communne
commune.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
commune.setValue(record.getAsString("commune"));
selectionCommune=true;
}
});
ListenerConfig listenerConfigCommune=new ListenerConfig();
listenerConfigCommune.setDelay(10);
listenerConfigCommune.setStopPropagation(false);
listenerConfigCommune.setStopEvent(false);
 
commune.addKeyPressListener(new EventCallback() {
public void execute(EventObject e) {
switch(e.getKey()) {
case KEY_ALT:
case KEY_CTRL:
case KEY_DOWN:
case KEY_END:
case KEY_ESCAPE:
case KEY_HOME:
case KEY_LEFT:
case KEY_PAGEDOWN:
case KEY_PAGEUP:
case KEY_RIGHT:
case KEY_SHIFT:
case KEY_TAB:
case KEY_UP:
break;
case KEY_ENTER:
if (selectionCommune) {
selectionCommune=false;
}
else {
// lancer mise a jour
}
break;
default:
obtenirListeReferentielCommune();
break;
}
 
}
}, listenerConfigCommune
);
// Listener completion espece
 
espece.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
espece.setValue(record.getAsString("nom"));
selectionEspece=true;
}
});
 
ListenerConfig listenerConfigEspece=new ListenerConfig();
listenerConfigEspece.setDelay(10);
listenerConfigEspece.setStopPropagation(false);
listenerConfigEspece.setStopEvent(false);
 
espece.addKeyPressListener(new EventCallback() {
public void execute(EventObject e) {
switch(e.getKey()) {
case KEY_ALT:
case KEY_CTRL:
case KEY_DOWN:
case KEY_END:
case KEY_ESCAPE:
case KEY_HOME:
case KEY_LEFT:
case KEY_PAGEDOWN:
case KEY_PAGEUP:
case KEY_RIGHT:
case KEY_SHIFT:
case KEY_TAB:
case KEY_UP:
break;
case KEY_ENTER:
if (selectionEspece) {
selectionEspece=false;
}
else {
// lancer mise a jour
}
break;
default:
obtenirListeReferentielNom();
break;
}
 
}
}, listenerConfigEspece
);
 
 
boutonOK.addListener(new ButtonListenerAdapter() {
public void onClick(Button button, EventObject e) {
observationMediateur.ajouterObservation(this);
}
});
 
// on ajoute un écouteur
/*validerInfo.addListener(new ButtonListenerAdapter() {
 
392,7 → 463,7
final MemoryProxy dataProxy = new MemoryProxy(communeData);
final ArrayReader reader = new ArrayReader(rd);
store=new Store(dataProxy,reader);
Store store=new Store(dataProxy,reader);
store.load() ;
commune.setStore(store);
400,13 → 471,73
}
// si l'on a reçu une liste de nom
if(nouvelleDonnees instanceof ListeReferentielNom)
{
ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
Object[][] nomData = new Object[data.size()][2];
int i = 0 ;
// on la parse et on récupère les informations quiç nous interessent
for (Iterator it = data.keySet().iterator(); it.hasNext();)
{
ReferentielNom ref=(ReferentielNom) data.get(it.next());
nomData[i][0]= ref.getNom();
nomData[i][1]= ref.getNumeroNom();
i++ ;
}
// creation du store
FieldDef defNom = new StringFieldDef("nom");
FieldDef defNumeroNom = new StringFieldDef("numeroNom");
FieldDef[] defTab = { defNom, defNumeroNom};
RecordDef rd = new RecordDef(defTab);
final MemoryProxy dataProxy = new MemoryProxy(nomData);
final ArrayReader reader = new ArrayReader(rd);
Store store=new Store(dataProxy,reader);
store.load() ;
espece.setStore(store);
}
 
}
 
public void obtenirListeReferentielCommune() {
observationMediateur.obtenirListeReferentielCommune(this,commune.getText());
String com=commune.getText().replaceAll(" ","/");
com=com.replaceAll("%","");
observationMediateur.obtenirListeReferentielCommune(this,com);
}
 
public void obtenirListeReferentielNom() {
String esp=espece.getText().replaceAll(" ","/");
esp=esp.replaceAll("%","");
observationMediateur.obtenirListeReferentielNom(this,esp);
}