Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 708 → Rev 728

/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
18,6 → 18,7
import org.tela_botanica.client.modeles.ReferentielNom;
import org.tela_botanica.client.modeles.ListeReferentielPerso.TypesReferentiels;
import org.tela_botanica.client.observation.ObservationMediateur;
import org.tela_botanica.client.util.AutoCompletionRefComboBox;
import org.tela_botanica.client.util.Util;
 
import com.google.gwt.core.client.GWT;
148,9 → 149,6
private Button boutonAnnuler = new Button("Réinitialiser");
 
private boolean selectionCommune=false;
private boolean selectionStation=false;
private boolean selectionLieuDit=false;
private boolean selectionMilieu=false;
private boolean selectionEspece=false;
private boolean modification = false ;
319,16 → 317,16
 
panneauPremierColonne.add(htmlCommunePanel);
 
station = new ComboBox("Station", "station");
station.setTpl(resultTplRefPerso);
station.setMode(ComboBox.REMOTE);
// commune.setPageSize(10); // Ne fonctionne pas
station.setItemSelector("div.search-item-commune");
station.setTypeAhead(true);
station.setLoadingText("Recherche...");
station.setHideTrigger(true);
station.setAllowBlank(true);
station = new AutoCompletionRefComboBox("Station", "station", observationMediateur, TypesReferentiels.REFERENTIEL_STATION) {
 
public void onModificationValeur() {
stationModifiee = true;
}
 
public void onValidationSaisie() {
validerSaisie(Champs.STATION);
}
};
panneauPremierColonne.add(station, new AnchorLayoutData("95%"));
latitude = new TextField("Lat", "x");
467,25 → 465,29
 
panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));
lieudit = new ComboBox("Lieu-dit", "lieudit");
lieudit.setTpl(resultTplRefPerso);
lieudit.setMode(ComboBox.REMOTE);
lieudit.setItemSelector("div.search-item-commune");
lieudit.setTypeAhead(true);
lieudit.setLoadingText("Recherche...");
lieudit.setHideTrigger(true);
lieudit.setAllowBlank(true);
lieudit = new AutoCompletionRefComboBox("Lieu-dit", "lieudit",observationMediateur,TypesReferentiels.REFERENTIEL_LIEU_DIT) {
 
public void onModificationValeur() {
lieuDitModifie = true;
}
 
public void onValidationSaisie() {
validerSaisie(Champs.LIEUDIT);
}
};
panneauSecondeColonne.add(lieudit, new AnchorLayoutData("95%"));
milieu = new ComboBox("Milieu", "milieu");
milieu.setTpl(resultTplRefPerso);
milieu.setMode(ComboBox.REMOTE);
milieu.setItemSelector("div.search-item-commune");
milieu.setTypeAhead(true);
milieu.setLoadingText("Recherche...");
milieu.setHideTrigger(true);
milieu.setAllowBlank(true);
milieu = new AutoCompletionRefComboBox("Milieu","milieu",observationMediateur,TypesReferentiels.REFERENTIEL_MILIEU) {
 
public void onModificationValeur() {
milieuModifie = true;
}
 
public void onValidationSaisie() {
validerSaisie(Champs.MILIEU);
}
};
panneauSecondeColonne.add(milieu, new AnchorLayoutData("95%"));
comment = new TextArea("Notes", "comment");
697,59 → 699,8
listenerConfigAutocompletion.setDelay(200);
listenerConfigAutocompletion.setStopPropagation(false);
listenerConfigAutocompletion.setStopEvent(false);
station.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
station.setValue(record.getAsString("element_referentiel"));
selectionStation=true;
station.collapse();
}
public void onExpand(ComboBox comboBox) {
comboBox.focus();
}
});
station.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
// TODO Auto-generated method stub
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 (selectionStation) {
stationModifiee= true;
selectionStation=false;
}
else {
validerSaisie(Champs.STATION);
}
break;
default:
obtenirReferentielStation();
stationModifiee = true;
}
}
},listenerConfigAutocompletion);
// Listener completion espece
espece.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
820,102 → 771,6
);
// Listener completion lieudit
lieudit.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
lieudit.setValue(record.getAsString("element_referentiel"));
selectionLieuDit=true;
lieudit.collapse();
}
});
lieudit.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
// TODO Auto-generated method stub
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 (selectionLieuDit) {
lieuDitModifie= true;
selectionLieuDit=false;
}
else {
validerSaisie(Champs.LIEUDIT);
}
break;
default:
lieuDitModifie = true;
obtenirReferentielLieuDit();
}
}
},listenerConfigAutocompletion);
// Listener completion lieudit
milieu.addListener(new ComboBoxListenerAdapter() {
public void onSelect(ComboBox comboBox, Record record, int index) {
milieu.setValue(record.getAsString("element_referentiel"));
selectionMilieu=true;
milieu.collapse();
}
});
milieu.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
// TODO Auto-generated method stub
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 (selectionMilieu) {
milieuModifie= true;
selectionMilieu=false;
}
else {
validerSaisie(Champs.MILIEU);
}
break;
default:
milieuModifie = true;
obtenirListeReferentielMilieu();
}
}
},listenerConfigAutocompletion);
comment.addKeyPressListener(new EventCallback() {
 
public void execute(EventObject e) {
1188,58 → 1043,6
}
if(nouvelleDonnees instanceof ListeReferentielPerso)
{
ListeReferentielPerso referentielPerso = (ListeReferentielPerso)nouvelleDonnees;
int i = 0;
Object[][] refData = new Object[referentielPerso.size()][1];
// on la parse et on récupère les informations quiç nous interessent
for (Iterator it = referentielPerso.keySet().iterator(); it.hasNext();)
{
String ref= referentielPerso.get(it.next());
refData[i][0]= ref;
i++;
}
//creation du store
FieldDef defStation = new StringFieldDef("element_referentiel");
FieldDef[] defTab = {defStation};
RecordDef rd = new RecordDef(defTab);
final MemoryProxy dataProxy = new MemoryProxy(refData);
final ArrayReader reader = new ArrayReader(rd);
Store store=new Store(dataProxy,reader);
switch (referentielPerso.getTypeReferentiel()) {
case REFERENTIEL_STATION:
station.setStore(store);
store.load();
break;
case REFERENTIEL_LIEU_DIT:
lieudit.setStore(store);
store.load();
break;
case REFERENTIEL_MILIEU:
milieu.setStore(store);
store.load();
break;
default:
break;
}
}
// On recoit une observation dont on veut afficher le detail
if(nouvelleDonnees instanceof Observation)