Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 131 → Rev 132

/trunk/src/org/tela_botanica/client/vues/FormulaireSaisieObservationVue.java
11,6 → 11,8
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;
22,10 → 24,16
import com.gwtext.client.data.SimpleStore;
import com.gwtext.client.data.Store;
import com.gwtext.client.data.StringFieldDef;
import com.gwtext.client.widgets.BoxComponent;
import com.gwtext.client.widgets.Button;
import com.gwtext.client.widgets.Component;
import com.gwtext.client.widgets.Container;
import com.gwtext.client.widgets.Panel;
import com.gwtext.client.widgets.Toolbar;
import com.gwtext.client.widgets.event.BoxComponentListener;
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
import com.gwtext.client.widgets.form.ComboBox;
import com.gwtext.client.widgets.form.DateField;
import com.gwtext.client.widgets.form.FormPanel;
171,17 → 179,13
commune.setLoadingText("Recherche...");
commune.setHideTrigger(true);
commune.setTabIndex(1);
 
 
panneauPremierColonne.add(commune);
 
station = new TextField("Station", "station", tailleChamps);
station.setAllowBlank(true);
station.setAllowBlank(true);
station.setTabIndex(3);
panneauPremierColonne.add(station);
date = new DateField("Date", "date", 100);
188,6 → 192,7
date.setAllowBlank(true);
formatDate = "d/m/Y";
date.setFormat(formatDate) ;
date.setTabIndex(5);
panneauPremierColonne.add(date);
 
205,18 → 210,19
espece.setLoadingText("Recherche...");
espece.setHideTrigger(true);
espece.setTabIndex(6);
 
 
panneauPremierColonne.add(espece);
lieudit = new TextField("Lieu-dit", "lieudit", tailleChamps);
lieudit.setAllowBlank(true);
lieudit.setAllowBlank(true);
lieudit.setTabIndex(2);
panneauSecondeColonne.add(lieudit);
milieu = new TextField("Milieu", "milieu", tailleChamps);
milieu.setAllowBlank(true);
milieu.setAllowBlank(true);
milieu.setTabIndex(4);
panneauSecondeColonne.add(milieu);
comment = new TextArea("Notes", "comment");
223,6 → 229,7
comment.setAllowBlank(true);
comment.setHeight(50);
comment.setWidth(tailleChamps);
comment.setTabIndex(7);
panneauSecondeColonne.add(comment);
panneauIntermediaire.add(panneauPremierColonne, new ColumnLayoutData(.5));
247,9 → 254,9
bt.addText("Mode de saisie ") ;
bt.addField(selecteurMode) ;
boutonOK.setTabIndex(8);
boutonAnnuler.setTabIndex(9);
panneauFormulaire.addButton(boutonOK);
panneauFormulaire.addButton(boutonAnnuler);
275,8 → 282,6
// on ajoute les listeners
ajouterListeners() ;
 
}
private void ajouterListeners()
297,8 → 302,6
listenerConfigCommune.setStopPropagation(false);
listenerConfigCommune.setStopEvent(false);
 
commune.addKeyPressListener(new EventCallback() {
public void execute(EventObject e) {
306,6 → 309,22
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) {
510,6 → 529,21
}
});
this.addListener(new ContainerListenerAdapter() {
public void onAfterLayout(Container self) {
ajusterTailleChamps();
commune.focus();
}
});
this.addListener(new BoxComponentListenerAdapter() {
public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
ajusterTailleChamps();
}
});
}
/**
582,8 → 616,7
Store store=new Store(dataProxy,reader);
store.load() ;
commune.setStore(store);
commune.setStore(store);
}
// si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
776,6 → 809,7
break;
case TOUT:
commune.reset();
date.reset() ;
lieudit.reset() ;
station.reset() ;
814,11 → 848,9
selecteurMode.removeClass("x-selec-modif") ;
selecteurMode.setCls("x-selec-crea") ;
}
}
}
/**
* renvoie vrai si on est en mode modification, faux si on est en mode création
* @return
830,7 → 862,7
public boolean verifierFormatDate(String date) {
String regex = "[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]" ;
String regex = "[1-9][0-9]{3}-[0-9]{2}-[0-9]{2}" ;
if(date.matches(regex) && !date.equals("0000-00-00")) {
return true ;
}
838,5 → 870,20
return false;
}
}
private void ajusterTailleChamps() {
int tailleChamps = (this.getInnerWidth()/100)*40;
this.tailleChamps = tailleChamps ;
commune.setWidth(tailleChamps);
station.setWidth(tailleChamps);
espece.setWidth(tailleChamps);
lieudit.setWidth(tailleChamps);
milieu.setWidth(tailleChamps);
comment.setWidth(tailleChamps);
 
}
 
}