Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 1671 → Rev 1672

/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java
819,10 → 819,7
selecteurReferentielTaxo.addListener(new ComboBoxListenerAdapter() {
@Override
public void onSelect(ComboBox comboBox, Record record, int index) {
espece.setValue("");
numeroNom = "";
especeModifiee = true;
public void onSelect(ComboBox comboBox, Record record, int index) {
referentielTaxo = record.getAsString("valeur");
observationMediateur.setRefTaxSelectionne(index);
referentielTaxoModifie = true;
1078,119 → 1075,118
public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
if(nouvelleDonnees instanceof ListeReferentielCommune)
{
ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
Object[][] communeData = new Object[data.size()][3];
int i = 0 ;
// on la parse et on récupère les informations quiç nous interessent
for (Iterator it = data.keySet().iterator(); it.hasNext();)
{
ReferentielCommune ref=data.get(it.next());
communeData[i][0]= ref.getCommune();
communeData[i][1]= ref.getDepartement();
communeData[i][2]= ref.getCodeInsee();
i++ ;
}
if(nouvelleDonnees instanceof ListeReferentielCommune)
{
ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
Object[][] communeData = new Object[data.size()][3];
int i = 0 ;
// on la parse et on récupère les informations quiç nous interessent
for (Iterator it = data.keySet().iterator(); it.hasNext();)
{
ReferentielCommune ref=data.get(it.next());
// creation du store
FieldDef defCommune = new StringFieldDef("commune");
FieldDef defDepartement = new StringFieldDef("departement");
FieldDef defCodeInsee = new StringFieldDef("codeInsee");
FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee};
RecordDef rd = new RecordDef(defTab);
final MemoryProxy dataProxy = new MemoryProxy(communeData);
final ArrayReader reader = new ArrayReader(rd);
Store store=new Store(dataProxy,reader);
commune.setStore(store);
store.load();
communeData[i][0]= ref.getCommune();
communeData[i][1]= ref.getDepartement();
communeData[i][2]= ref.getCodeInsee();
i++ ;
}
// si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
if(nouvelleDonnees instanceof ListeReferentielNom)
{
ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
Object[][] nomData = new Object[data.size()][3];
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=data.get(it.next());
nomData[i][0]= ref.getNom();
nomData[i][1]= ref.getNumeroNom();
if (ref.getStatut().equals("3")) {
nomData[i][2]="nom_retenu";
}
else {
nomData[i][2]="";
}
i++ ;
}
 
FieldDef defNom = new StringFieldDef("nom");
FieldDef defNumeroNom = new StringFieldDef("numeroNom");
FieldDef indicateurNomRetenu = new StringFieldDef("indicateurNomRetenu");
// creation du store
FieldDef defCommune = new StringFieldDef("commune");
FieldDef defDepartement = new StringFieldDef("departement");
FieldDef defCodeInsee = new StringFieldDef("codeInsee");
FieldDef[] defTab = { defNom, defNumeroNom, indicateurNomRetenu};
RecordDef rd = new RecordDef(defTab);
final MemoryProxy dataProxy = new MemoryProxy(nomData);
final ArrayReader reader = new ArrayReader(rd);
Store store=new Store(dataProxy,reader);
espece.setStore(store);
store.load() ;
}
FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee};
// On recoit une observation dont on veut afficher le detail
RecordDef rd = new RecordDef(defTab);
if(nouvelleDonnees instanceof Observation)
final MemoryProxy dataProxy = new MemoryProxy(communeData);
final ArrayReader reader = new ArrayReader(rd);
Store store=new Store(dataProxy,reader);
commune.setStore(store);
store.load();
}
// si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
if(nouvelleDonnees instanceof ListeReferentielNom)
{
ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
Object[][] nomData = new Object[data.size()][3];
int i = 0 ;
 
// on la parse et on récupère les informations qui nous interessent
for (Iterator it = data.keySet().iterator(); it.hasNext();)
{
Observation obs = (Observation)nouvelleDonnees ;
setSelectionMultiple(false);
afficherDetailsObservation(obs) ;
}
if(nouvelleDonnees instanceof ListeObservation) {
ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
setSelectionMultiple(true);
calculerAfficherDifferences(listeObs);
ReferentielNom ref=data.get(it.next());
nomData[i][0]= ref.getNom();
nomData[i][1]= ref.getNumeroNom();
if (ref.getStatut().equals("3")) {
nomData[i][2]="nom_retenu";
}
else {
nomData[i][2]="";
}
i++ ;
}
 
FieldDef defNom = new StringFieldDef("nom");
FieldDef defNumeroNom = new StringFieldDef("numeroNom");
FieldDef indicateurNomRetenu = new StringFieldDef("indicateurNomRetenu");
FieldDef[] defTab = { defNom, defNumeroNom, indicateurNomRetenu};
if(nouvelleDonnees instanceof String)
{
String str = (String)nouvelleDonnees ;
observationMediateur.obtenirNombreObservation() ;
}
RecordDef rd = new RecordDef(defTab);
if(nouvelleDonnees instanceof String[]) {
String[] anumNom = (String[])nouvelleDonnees ;
numeroNom = anumNom[1];
espece.setValue(anumNom[0]);
}
final MemoryProxy dataProxy = new MemoryProxy(nomData);
final ArrayReader reader = new ArrayReader(rd);
if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
{
EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
if(rechercheCommuneEnCours) {
afficherIndicationCommune(infosComm);
} else {
rafraichirCommuneEtCoord(infosComm);
}
Store store=new Store(dataProxy,reader);
espece.setStore(store);
store.load() ;
}
// On recoit une observation dont on veut afficher le detail
if(nouvelleDonnees instanceof Observation)
{
Observation obs = (Observation)nouvelleDonnees ;
setSelectionMultiple(false);
afficherDetailsObservation(obs) ;
}
if(nouvelleDonnees instanceof ListeObservation) {
ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
setSelectionMultiple(true);
calculerAfficherDifferences(listeObs);
}
if(nouvelleDonnees instanceof String)
{
String str = (String)nouvelleDonnees ;
observationMediateur.obtenirNombreObservation() ;
}
if(nouvelleDonnees instanceof String[]) {
String[] anumNom = (String[])nouvelleDonnees ;
numeroNom = anumNom[1];
espece.setValue(anumNom[0]);
}
if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
{
EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ;
if(rechercheCommuneEnCours) {
afficherIndicationCommune(infosComm);
} else {
rafraichirCommuneEtCoord(infosComm);
}
 
}
}
private void afficherIndicationCommune(
1314,7 → 1310,7
public void ajouterObservation() {
if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
date.setInvalidText("Date invalide");
return;
1366,7 → 1362,11
 
private void modifierObservation() {
if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
if(!Window.confirm("Êtes-vous sur de vouloir modifier l'observation sélectionnée ?")) {
return;
}
if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
date.setInvalidText("Date invalide");
return;
1399,7 → 1399,7
Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
obs.setNumeroOrdre(numeroOrdre);
String[] coords = getValeurCoordonnees();
obs.setLatitude(coords[0]);
1716,7 → 1716,7
conteneurChampEtenduGauche = new FormPanel();
conteneurChampEtenduDroite = new FormPanel();
if(obs.getChampsEtendus().size() > 0) {
if(obs.getChampsEtendus() != null && obs.getChampsEtendus().size() > 0) {
lienAfficherChampsEtendus.setVisible(true);
conteneurChampEtenduGauche.setAutoWidth(true);
conteneurChampEtenduGauche.setStyle("conteneurChampsEtendus");