Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 6 → Rev 7

/trunk/src/org/tela_botanica/client/g
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/client/h
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/client/observation/ObservationMediateur.java
1,8 → 1,5
package org.tela_botanica.client.observation;
 
 
 
 
import org.tela_botanica.client.CarnetEnLigneMediateur;
import org.tela_botanica.client.interfaces.iMediateur;
import org.tela_botanica.client.interfaces.iRetourObservation;
12,55 → 9,55
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
 
public class ObservationMediateur implements iMediateur{
public class ObservationMediateur implements iMediateur {
 
 
// Evenenements
final static public int NOMBRE_OBSERVATION=1;
final static public int NOMBRE_OBSERVATION = 1;
 
final static public int LISTE_OBSERVATION=2;
private CarnetEnLigneMediateur carnetEnLigneMediateur=null; // Mediateur General
private final ObservationModele observationModele=new ObservationModele();
final static public int LISTE_OBSERVATION = 2;
 
private Observation observation=null;
private CarnetEnLigneMediateur carnetEnLigneMediateur = null; // Mediateur
// General
private final ObservationModele observationModele = new ObservationModele();
 
// Variable interne
private final String texteDeconnexion="Utilisez ce carnet en ligne pour saisir vos observations, <u>identifiez-vous</u> pour les transmettre à Tela Botanica";
private Observation observation = null;
 
// Variable interne
private final String texteDeconnexion = "Utilisez ce carnet en ligne pour saisir vos observations, <u>identifiez-vous</u> pour les transmettre à Tela Botanica";
 
// Composants graphiques
private EtatConnexionVue etatConnexionVue=null; // Vue Etat de la connexion utilisateur
private FormulaireDeConnexionVue formulaireDeConnexionVue=null; // Formulaire de connexion utilisateur
private ListeObservationsVue listeObservationsVue = null; // Liste de releves
 
//
private EtatConnexionVue etatConnexionVue = null; // Vue Etat de la
// connexion utilisateur
private FormulaireDeConnexionVue formulaireDeConnexionVue = null; // Formulaire
// de
// connexion
// utilisateur
private ListeObservationsVue listeObservationsVue = null; // Liste de
// releves
 
//
 
public ObservationMediateur(CarnetEnLigneMediateur carnetEnLigneMediateur) {
 
this.carnetEnLigneMediateur=carnetEnLigneMediateur;
etatConnexionVue=new EtatConnexionVue(this);
listeObservationsVue=new ListeObservationsVue(this);
VerticalPanel panel=new VerticalPanel();
this.carnetEnLigneMediateur = carnetEnLigneMediateur;
 
etatConnexionVue = new EtatConnexionVue(this);
listeObservationsVue = new ListeObservationsVue(this);
 
VerticalPanel panel = new VerticalPanel();
 
panel.add(etatConnexionVue);
 
panel.add(listeObservationsVue);
 
RootPanel.get().add(panel);
 
onInitialisation();
 
}
 
/// Methodes privees
// / Methodes privees
 
/**
*
67,24 → 64,24
* Initialisations
*
*/
 
private void onInitialisation() {
 
afficheEtatConnexion();
onFiltrageListeObservation("all","all","all");
onFiltrageListeObservation("all", "all", "all");
 
}
// Filtre selection lieu
 
// Filtre selection lieu
 
/**
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants au filtrage
* Action sur selection d'un lieu : affichage de la liste des taxons
* correspondants au filtrage
*/
public void onFiltrageListeObservation(String id_loc, String loc,String lieu) {
 
public void onFiltrageListeObservation(String id_loc, String loc,
String lieu) {
 
// Positionnement Filtre affichage
listeObservationsVue.setIdLocation(id_loc);
listeObservationsVue.setLocalite(loc);
94,163 → 91,132
// Affichage des filtres
listeObservationsVue.displayFilter();
 
}
 
// / UTILISATEUR
 
 
/// UTILISATEUR
 
/**
* Affichage etat de la connexion
* Affichage etat de la connexion
*/
 
private void afficheEtatConnexion() {
if (!carnetEnLigneMediateur.getUtilisateur().isIdentifie()) {
etatConnexionVue.setEtat(texteDeconnexion,false);
}
else {
etatConnexionVue.setEtat(carnetEnLigneMediateur.getUtilisateur().getIdentifiant()+ " (deconnexion)",true);
}
if (!carnetEnLigneMediateur.getUtilisateur().isIdentifie()) {
etatConnexionVue.setEtat(texteDeconnexion, false);
} else {
etatConnexionVue.setEtat(carnetEnLigneMediateur.getUtilisateur()
.getIdentifiant()
+ " (deconnexion)", true);
}
 
}
 
/**
*
* Affichage boite de connexion
*
*
*/
 
public void afficherDialogueConnexion() {
// TODO : singleton ?
formulaireDeConnexionVue = new FormulaireDeConnexionVue(this);
 
// Position it roughly in the middle of the screen.
int left = (Window.getClientWidth() - 512) / 2;
int top = (Window.getClientHeight() - 256) / 2;
formulaireDeConnexionVue.setPopupPosition(left, top);
formulaireDeConnexionVue.show();
// TODO : singleton ?
formulaireDeConnexionVue = new FormulaireDeConnexionVue(this);
 
// Position it roughly in the middle of the screen.
int left = (Window.getClientWidth() - 512) / 2;
int top = (Window.getClientHeight() - 256) / 2;
formulaireDeConnexionVue.setPopupPosition(left, top);
formulaireDeConnexionVue.show();
 
}
 
/**
* Deconnexion de l'utilisateur en cours
* Deconnexion de l'utilisateur en cours
*/
 
public void deconnecterUtilisateur() {
// carnetEnLigneMediateur.addListener(CarnetEnLigneMediateur.DECONNEXION,this);
 
// carnetEnLigneMediateur.addListener(CarnetEnLigneMediateur.DECONNEXION,this);
carnetEnLigneMediateur.deconnecterUtilisateur();
 
}
 
 
/**
* Tentative de connexion utilisateur
*
* @param login
* @param password
*/
 
public void connecterUtilisateur(String login, String password) {
// carnetEnLigneMediateur.addListener(CarnetEnLigneMediateur.CONNEXION,this);
 
// carnetEnLigneMediateur.addListener(CarnetEnLigneMediateur.CONNEXION,this);
carnetEnLigneMediateur.connecterUtilisateur(login, password);
 
}
 
// / OBSERVATION
 
/// OBSERVATION
/**
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en
* cours
*
*/
public void getNombreObservation (String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre ) {
 
observationModele.getNombreObservation(
new iRetourObservation() {
public void onRetour(Observation obs) {
observation=obs;
//fireEvent(NOMBRE_OBSERVATION);
}
public void getNombreObservation(String identifiantLocalite,
String localite, String annee, String mois, String jour,
String lieudit, String rechercheLibre) {
 
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(), identifiantLocalite, localite , annee, mois, jour, lieudit ,rechercheLibre
);
}
observationModele.getNombreObservation(new iRetourObservation() {
public void onRetour(Observation obs) {
observation = obs;
// fireEvent(NOMBRE_OBSERVATION);
}
 
public void getListeObservation (String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre, int debut, int longueur) {
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(),
identifiantLocalite, localite, annee, mois, jour, lieudit,
rechercheLibre
 
observationModele.getListeObservation(
new iRetourObservation() {
public void onRetour(Observation obs) {
observation=obs;
//fireEvent(LISTE_OBSERVATION);
}
);
 
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(), identifiantLocalite, localite , annee, mois, jour, lieudit ,rechercheLibre, debut, longueur
);
 
}
 
public void getListeObservation(String identifiantLocalite,
String localite, String annee, String mois, String jour,
String lieudit, String rechercheLibre, int debut, int longueur) {
 
public Observation getObservation() {
return observation;
}
observationModele.getListeObservation(new iRetourObservation() {
public void onRetour(Observation obs) {
observation = obs;
// fireEvent(LISTE_OBSERVATION);
}
 
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(),
identifiantLocalite, localite, annee, mois, jour, lieudit,
rechercheLibre, debut, longueur
 
);
 
/// EVENEMENTS
/**
* Evenements
*
*/
/*
public void handleEvent(BaseEvent be) {
switch (be.type) {
case CarnetEnLigneMediateur.DECONNEXION:
afficheEtatConnexion();
break;
case CarnetEnLigneMediateur.CONNEXION:
if (carnetEnLigneMediateur.getUtilisateur().isIdentifie()) {
formulaireDeConnexionVue.hide();
afficheEtatConnexion();
}
else {
formulaireDeConnexionVue.afficherMessageAlerte(); // Erreur identification
}
break;
}
}
 
*/
public Observation getObservation() {
return observation;
}
 
// / EVENEMENTS
 
/**
* Evenements
*
*/
/*
* public void handleEvent(BaseEvent be) { switch (be.type) { case
* CarnetEnLigneMediateur.DECONNEXION: afficheEtatConnexion(); break; case
* CarnetEnLigneMediateur.CONNEXION: if
* (carnetEnLigneMediateur.getUtilisateur().isIdentifie()) {
* formulaireDeConnexionVue.hide(); afficheEtatConnexion(); } else {
* formulaireDeConnexionVue.afficherMessageAlerte(); // Erreur
* identification } break; } }
*
*/
 
 
 
 
}
/trunk/src/org/tela_botanica/client/observation/EtatConnexionVue.java
14,7 → 14,6
*/
package org.tela_botanica.client.observation;
 
 
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
22,86 → 21,73
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class EtatConnexionVue extends Composite {
 
public class EtatConnexionVue extends Composite {
private ObservationMediateur observationMediateur = null;
 
private HTML signLabel = new HTML();
private boolean connecte = false;
 
private ObservationMediateur observationMediateur=null;
private HTML signLabel = new HTML() ;
private boolean connecte = false ;
public EtatConnexionVue(final ObservationMediateur med) {
public EtatConnexionVue(final ObservationMediateur med) {
 
observationMediateur=med;
observationMediateur = med;
 
HorizontalPanel outer = new HorizontalPanel();
HorizontalPanel inner = new HorizontalPanel();
outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
HorizontalPanel outer = new HorizontalPanel();
HorizontalPanel inner = new HorizontalPanel();
 
inner.add(signLabel);
inner.setSpacing(3);
outer.add(inner);
outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
 
initWidget(outer);
inner.add(signLabel);
 
signLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// Non connecte ? Lien vers boite de connection
if (!connecte) {
observationMediateur.afficherDialogueConnexion();
}
else {
observationMediateur.deconnecterUtilisateur();
inner.setSpacing(3);
outer.add(inner);
 
}
}
}
);
initWidget(outer);
 
}
signLabel.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
 
// Non connecte ? Lien vers boite de connection
 
public void setEtat(String text, boolean connecte) {
signLabel.setHTML(text);
this.connecte=connecte;
}
if (!connecte) {
 
observationMediateur.afficherDialogueConnexion();
}
 
else {
 
observationMediateur.deconnecterUtilisateur();
 
}
 
}
});
 
}
 
public void setEtat(String text, boolean connecte) {
signLabel.setHTML(text);
this.connecte = connecte;
}
 
}
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.1 2008-06-09 14:19:37 ddelon
* Initialisation observation
*
* Revision 1.2 2008-04-28 13:10:44 ddelon
* Integration MyGwt
*
* Revision 1.1 2008-01-02 21:26:04 ddelon
* mise en place mygwt
*
* Revision 1.6 2007-12-22 14:48:53 ddelon
* Documentation et refactorisation
*
* Revision 1.5 2007-09-17 19:25:34 ddelon
* Documentation
*
*
*/
/*
* +--Fin du code
* ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $ Revision 1.1 2008-09-19 10:27:18 aperonnet
* Carnet en ligne, utilisant gwt 1.5 et la nouvelle version de gwt-ext (plus de
* bugs au demarrage dans firefox, plus rapide et annotations java)
*
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.2 2008-04-28 13:10:44 ddelon Integration MyGwt
*
* Revision 1.1 2008-01-02 21:26:04 ddelon mise en place mygwt
*
* Revision 1.6 2007-12-22 14:48:53 ddelon Documentation et refactorisation
*
* Revision 1.5 2007-09-17 19:25:34 ddelon Documentation
*
*
*/
/trunk/src/org/tela_botanica/client/observation/FormulaireDeConnexionVue.java
32,177 → 32,162
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
public class FormulaireDeConnexionVue extends DialogBox {
public class FormulaireDeConnexionVue extends DialogBox {
 
private ObservationMediateur observationMediateur = null;
private TextBox login = new TextBox();
private PasswordTextBox password = new PasswordTextBox();
private Grid inner = new Grid(4, 2);
 
private ObservationMediateur observationMediateur=null;
private TextBox login = new TextBox();
private PasswordTextBox password = new PasswordTextBox();
private Grid inner = new Grid(4,2);
public FormulaireDeConnexionVue(final ObservationMediateur carnetEnLigneMediateur) {
setText("Connexion");
public FormulaireDeConnexionVue(
final ObservationMediateur carnetEnLigneMediateur) {
 
this.observationMediateur=carnetEnLigneMediateur;
setText("Connexion");
 
VerticalPanel outer = new VerticalPanel();
this.observationMediateur = carnetEnLigneMediateur;
 
/*
* E-Mail : Zone_saisie_email
* Mot-de-passe : Zone_saisie_mot_de_passe
* Message d'information
* Bouton_Ok Bouton_Annuler
*/
// Validation bouton
HTML okButton=new HTML("Ok");
okButton.setStyleName("html_button");
okButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
VerticalPanel outer = new VerticalPanel();
 
/*
* E-Mail : Zone_saisie_email Mot-de-passe : Zone_saisie_mot_de_passe
* Message d'information Bouton_Ok Bouton_Annuler
*/
 
// Validation bouton
HTML okButton = new HTML("Ok");
okButton.setStyleName("html_button");
okButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
connecteUtilisateur();
}
});
 
// Annulation
 
HTML cancelButton = new HTML("Annuler");
cancelButton.setStyleName("html_button");
cancelButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
hide();
}
});
 
// Validation utilisateur sans utilisation des boutons :
 
login.addKeyboardListener(new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if (arg1 == KEY_ENTER) {
connecteUtilisateur();
}
}
);
}
}
 
// Annulation
HTML cancelButton=new HTML("Annuler");
cancelButton.setStyleName("html_button");
cancelButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
hide();
}
}
);
public void onKeyUp(Widget arg0, char arg1, int arg2) {
}
 
//Validation utilisateur sans utilisation des boutons :
public void onKeyPress(Widget arg0, char arg1, int arg2) {
}
 
login.addKeyboardListener( new KeyboardListener() {
});
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
connecteUtilisateur();
}
}
public void onKeyUp(Widget arg0, char arg1, int arg2) { }
public void onKeyPress(Widget arg0, char arg1, int arg2) { }
}
);
// Validation utilisateur sans utilisation des boutons :
 
// Validation utilisateur sans utilisation des boutons :
password.addKeyboardListener( new KeyboardListener() {
password.addKeyboardListener(new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
connecteUtilisateur();
}
}
public void onKeyUp(Widget arg0, char arg1, int arg2) { }
public void onKeyPress(Widget arg0, char arg1, int arg2) { }
}
);
public void onKeyDown(Widget arg0, char arg1, int arg2) {
 
inner.setHTML(0,0,"E-mail:");
inner.setWidget(0,1,login);
inner.setHTML(1,0,"Mot de passe:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
inner.setWidget(1,1,password);
inner.setWidget(3,0,okButton);
inner.setWidget(3,1,cancelButton);
inner.setCellPadding(10);
outer.add(inner);
setWidget(outer);
}
if (arg1 == KEY_ENTER) {
connecteUtilisateur();
}
}
 
/**
* Appel du service d'identification et positionnement de l'etat de connection en fonction du resultat.
*
* @param login : identifiant saisi
* @param password : mot de passe saisi
*
*/
public void onKeyUp(Widget arg0, char arg1, int arg2) {
}
 
public void onKeyPress(Widget arg0, char arg1, int arg2) {
}
 
});
 
inner.setHTML(0, 0, "E-mail:");
inner.setWidget(0, 1, login);
inner
.setHTML(
1,
0,
"Mot de passe:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
inner.setWidget(1, 1, password);
inner.setWidget(3, 0, okButton);
inner.setWidget(3, 1, cancelButton);
 
inner.setCellPadding(10);
outer.add(inner);
setWidget(outer);
 
}
 
/**
* Appel du service d'identification et positionnement de l'etat de
* connection en fonction du resultat.
*
* @param login :
* identifiant saisi
* @param password :
* mot de passe saisi
*
*/
 
private void connecteUtilisateur() {
final String login=this.login.getText();
String password=this.password.getText();
 
observationMediateur.connecterUtilisateur(login,password);
final String login = this.login.getText();
String password = this.password.getText();
 
observationMediateur.connecterUtilisateur(login, password);
 
}
public boolean onKeyDownPreview(char key, int modifiers) {
// Use the popup's key preview hooks to close the dialog when either
// escape is pressed.
switch (key) {
case KeyboardListener.KEY_ESCAPE:
hide();
break;
}
 
return true;
}
public boolean onKeyDownPreview(char key, int modifiers) {
// Use the popup's key preview hooks to close the dialog when either
// escape is pressed.
switch (key) {
case KeyboardListener.KEY_ESCAPE:
hide();
break;
}
 
public void afficherMessageAlerte() {
inner.setHTML(2,0,"Identification incorrecte !");
}
return true;
}
 
public void afficherMessageAlerte() {
inner.setHTML(2, 0, "Identification incorrecte !");
}
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.1 2008-06-09 14:19:37 ddelon
* Initialisation observation
*
* Revision 1.10 2007-09-17 19:25:34 ddelon
* Documentation
*
* Revision 1.9 2007-05-21 21:03:44 ddelon
* nettoyage de code
*
* Revision 1.8 2007-05-21 18:14:06 ddelon
* Gestion importation releve locaux
*
* Revision 1.7 2007-05-21 11:47:30 ddelon
* meta cvs
*
* Revision 1.6 2007-05-21 11:39:48 ddelon
* meta cvs
*
* Revision 1.5 2007-05-21 11:39:12 ddelon
* meta cvs
*
* Revision 1.4 2007-05-21 11:37:35 ddelon
* meta cvs
*
* Revision 1.3 2007-05-21 11:36:51 ddelon
* meta cvs
*
*/
/*
* +--Fin du code
* ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $ Revision 1.1 2008-09-19 10:27:18
* aperonnet Carnet en ligne, utilisant gwt 1.5 et la nouvelle version de
* gwt-ext (plus de bugs au demarrage dans firefox, plus rapide et annotations
* java)
*
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.10 2007-09-17 19:25:34 ddelon Documentation
*
* Revision 1.9 2007-05-21 21:03:44 ddelon nettoyage de code
*
* Revision 1.8 2007-05-21 18:14:06 ddelon Gestion importation releve locaux
*
* Revision 1.7 2007-05-21 11:47:30 ddelon meta cvs
*
* Revision 1.6 2007-05-21 11:39:48 ddelon meta cvs
*
* Revision 1.5 2007-05-21 11:39:12 ddelon meta cvs
*
* Revision 1.4 2007-05-21 11:37:35 ddelon meta cvs
*
* Revision 1.3 2007-05-21 11:36:51 ddelon meta cvs
*
*/
/trunk/src/org/tela_botanica/client/observation/ListeObservationsVue.java
3,7 → 3,6
*/
 
 
/*
* ListeObservationsVue.java (Composite de Panel)
*
29,7 → 28,6
* Suppression d'une liste d'element
*/
 
 
/* Actions declenchees :
*
* onInventoryItemSelected(numero d'ordre de la ligne selectionne) : selection d'une ligne
38,9 → 36,8
*
*/
 
package org.tela_botanica.client.observation;
 
package org.tela_botanica.client.observation;
 
import org.tela_botanica.client.modeles.Observation;
 
import com.google.gwt.user.client.ui.Button;
53,17 → 50,13
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
 
public class ListeObservationsVue extends Composite {
 
public class ListeObservationsVue extends Composite
{
 
// Debut Barre de navigation
 
private class NavBar extends Composite implements ClickListener {
 
public final DockPanel bar = new DockPanel();
 
public final Button gotoFirst = new Button("&lt;&lt;", this);
public final Button gotoNext = new Button("&gt;", this);
70,31 → 63,29
public final Button gotoPrev = new Button("&lt;", this);
public final Button gotoEnd = new Button("&gt;&gt;", this);
public final Label status = new Label();
 
public NavBar() {
 
initWidget(bar);
 
status.setWordWrap(false);
 
HorizontalPanel buttons = new HorizontalPanel();
 
buttons.add(status);
buttons.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
buttons.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
buttons.setCellHorizontalAlignment(status,
HasHorizontalAlignment.ALIGN_RIGHT);
buttons.setCellVerticalAlignment(status,
HasVerticalAlignment.ALIGN_MIDDLE);
 
 
buttons.add(gotoFirst);
buttons.add(gotoPrev);
buttons.add(gotoNext);
buttons.add(gotoEnd);
 
bar.add(buttons, DockPanel.EAST);
 
}
 
public void onClick(Widget sender) {
if (sender == gotoNext) {
126,10 → 117,10
// Fin Barre de navigation
 
// Conteneur (header et table sont dans panel)
// private ContentPanel panel =null;
// private Table table = null;
// Services
// private ContentPanel panel =null;
// private Table table = null;
 
// Services
private String serviceBaseUrl = null;
private String user;
private ObservationMediateur observationMediateur = null;
138,10 → 129,10
private int startIndex = 0;
private int count = 0;
private static final int VISIBLE_TAXON_COUNT = 15;
private NavBar navBar=null;
private NavBar navBar = null;
 
// Filtre par defaut :
 
private String identifiantLocalite = "all";
private String localite = "all";
private String annee = "all";
149,183 → 140,150
private String jour = "all";
private String rechercheLibre = "all";
private String lieudit = "all";
private String ordre= null;
private String ordre = null;
 
public ListeObservationsVue(ObservationMediateur observationMediateur) {
 
public ListeObservationsVue(ObservationMediateur observationMediateur) {
// Traitement contexte utilisateur et service
 
this.observationMediateur=observationMediateur;
this.observationMediateur = observationMediateur;
 
// panel= new ContentPanel(Style.HEADER);
// panel.setLayout(new FillLayout());
// Barre navigation integree au header
navBar = new NavBar();
// panel.getHeader().addWidget(navBar);
// panel= new ContentPanel(Style.HEADER);
// panel.setLayout(new FillLayout());
 
// Contenu :
// Colonnes :
// TableColumn[] columns = new TableColumn[6];
// TODO : renderer date, alignement etc
/*
columns[0] = new TableColumn("etat","Aransmis", 50);
// Barre navigation integree au header
 
columns[1] = new TableColumn("nom","Nom saisi", 250);
columns[2] = new TableColumn("nomr","Nom retenu", 250);
navBar = new NavBar();
// panel.getHeader().addWidget(navBar);
 
columns[3] = new TableColumn("lieu","Lieu", 350);
// Contenu :
 
columns[4] = new TableColumn("date","Date", 75);
// Colonnes :
 
columns[5] = new TableColumn("ordre","Ordre", 50);
TableColumnModel cm = new TableColumnModel(columns);
// Table :
table = new Table(Style.MULTI | Style.HORIZONTAL, cm);
table.setBorders(false);
panel.add(table);
// TableColumn[] columns = new TableColumn[6];
 
// Selection d'une ligne
table.addListener(Events.RowClick, new Listener() {
// TODO : renderer date, alignement etc
/*
* columns[0] = new TableColumn("etat","Aransmis", 50);
*
* columns[1] = new TableColumn("nom","Nom saisi", 250);
*
* columns[2] = new TableColumn("nomr","Nom retenu", 250);
*
* columns[3] = new TableColumn("lieu","Lieu", 350);
*
* columns[4] = new TableColumn("date","Date", 75);
*
* columns[5] = new TableColumn("ordre","Ordre", 50);
*
*
* TableColumnModel cm = new TableColumnModel(columns);
* // Table :
*
* table = new Table(Style.MULTI | Style.HORIZONTAL, cm);
* table.setBorders(false);
*
*
* panel.add(table);
*
*
* // Selection d'une ligne table.addListener(Events.RowClick, new
* Listener() {
*
* public void handleEvent(BaseEvent be) { TableItem item=(TableItem)
* be.item; if (item!=null) { if (ordre==null) { // Affichage de la
* ligne selectionne ordre= (String) item.getValue(5); //
* observationMediateur.onInventoryItemSelected(ordre); } else { // Si
* une ligne etait deja selectionne if (ordre.compareTo((String)
* item.getValue(5))==0) { // C'est la meme, on la deselectionne
* ordre=null; table.deselect(be.rowIndex); //
* observationMediateur.onInventoryItemUnselected(); } else { ordre=
* (String) item.getValue(5); // C'est une autre, on la selectionne //
* observationMediateur.onInventoryItemSelected(ordre); }
* } } } });
*/
 
public void handleEvent(BaseEvent be) {
TableItem item=(TableItem) be.item;
if (item!=null) {
if (ordre==null) { // Affichage de la ligne selectionne
ordre= (String) item.getValue(5);
// observationMediateur.onInventoryItemSelected(ordre);
}
else {
// Si une ligne etait deja selectionne
if (ordre.compareTo((String) item.getValue(5))==0) { // C'est la meme, on la deselectionne
ordre=null;
table.deselect(be.rowIndex);
// observationMediateur.onInventoryItemUnselected();
}
else {
ordre= (String) item.getValue(5); // C'est une autre, on la selectionne
// observationMediateur.onInventoryItemSelected(ordre);
}
}
}
}
});
*/
// initWidget(panel);
// initWidget(panel);
 
}
 
}
/**
* Suppression d'un ensemble d'element de la liste d'inventaire, on garde ici car s'applique a plusieurs elements
* Suppression d'un ensemble d'element de la liste d'inventaire, on garde
* ici car s'applique a plusieurs elements
*
*/
 
public void deleteElement() {
/*
setStatusDisabled();
TableItem[] selection=table.getSelection();
/*
* setStatusDisabled(); TableItem[] selection=table.getSelection();
*
* StringBuffer ids=new StringBuffer(); for (int i = 0; i <
* selection.length; i++) { ids.append((String)(((TableItem)
* selection[i]).getValue(5))); if (i<(selection.length-1))
* ids.append(","); }
*
* if (ids.length()>0) {
*
* HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +
* ids.toString(), "action=DELETE",
*
* new ResponseTextHandler() { public void onCompletion(String str) { //
* observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all"); //
* observationMediateur.getEntryView().clear(); } }); }
*
* setStatusEnabled();
*/
}
 
StringBuffer ids=new StringBuffer();
for (int i = 0; i < selection.length; i++) {
ids.append((String)(((TableItem) selection[i]).getValue(5)));
if (i<(selection.length-1)) ids.append(",");
}
if (ids.length()>0) {
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
+ "/" + ids.toString(), "action=DELETE",
new ResponseTextHandler() {
public void onCompletion(String str) {
// observationMediateur.onInventoryUpdated(identifiantLocalite,"all","all");
// observationMediateur.getEntryView().clear();
}
});
}
setStatusEnabled();
*/
}
/**
* Transmission de releve a Tela, on garde ici car s'applique a plusieurs elements
* Transmission de releve a Tela, on garde ici car s'applique a plusieurs
* elements
*/
 
public void transmitElement() {
 
setStatusDisabled();
/* TableItem[] selection=table.getSelection();
 
StringBuffer ids=new StringBuffer();
for (int i = 0; i < selection.length; i++) {
ids.append((String)(((TableItem) selection[i]).getValue(5)));
if (i<(selection.length-1)) ids.append(",");
}
if (ids.length()>0) {
HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user
+ "/" + ids.toString(), "transmission=1",
new ResponseTextHandler() {
public void onCompletion(String str) {
getListeObservation(); // Pour affichage logo
}
});
}
setStatusEnabled();
/*
* TableItem[] selection=table.getSelection();
*
* StringBuffer ids=new StringBuffer(); for (int i = 0; i <
* selection.length; i++) { ids.append((String)(((TableItem)
* selection[i]).getValue(5))); if (i<(selection.length-1))
* ids.append(","); }
*
* if (ids.length()>0) {
*
* HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user +
* "/" + ids.toString(), "transmission=1",
*
* new ResponseTextHandler() { public void onCompletion(String str) {
* getListeObservation(); // Pour affichage logo } }); }
*
* setStatusEnabled();
*
*/
}
 
*/
}
/**
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en
* cours
*
*/
 
public void initialiser() {
 
setStatusDisabled();
 
// observationMediateur.addListener(ObservationMediateur.NOMBRE_OBSERVATION,this);
observationMediateur.getNombreObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre); // Retour dans handlevent() NOMBRE_OBSERVATION
// observationMediateur.addListener(ObservationMediateur.NOMBRE_OBSERVATION,this);
observationMediateur.getNombreObservation(identifiantLocalite,
localite, annee, mois, jour, lieudit, rechercheLibre); // Retour
// dans
// handlevent()
// NOMBRE_OBSERVATION
 
}
 
/**
* Mise a jour de l'affichage, a partir des donnaes d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
335,264 → 293,189
 
public void getListeObservation() {
 
// observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
observationMediateur.getListeObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre, startIndex, VISIBLE_TAXON_COUNT); // Retour dans handlevent() LISTE_OBSERVATION
// observationMediateur.addListener(ObservationMediateur.LISTE_OBSERVATION,this);
observationMediateur.getListeObservation(identifiantLocalite, localite,
annee, mois, jour, lieudit, rechercheLibre, startIndex,
VISIBLE_TAXON_COUNT); // Retour dans handlevent()
// LISTE_OBSERVATION
 
}
 
public void afficherListeObservation() {
 
Observation[] listeObservation =observationMediateur.getObservation().getListeObservation();
for (int i=0;i<listeObservation.length;i++) {
Object[] values = new Object[6];
values[0]="0";
values[2]="2";
values[3]="3";
values[4]="4";
values[5]="5";
values[1]=listeObservation[i].getNomSaisi();
// table.add(new TableItem(values));
}
// Ligne d'information
Observation[] listeObservation = observationMediateur.getObservation()
.getListeObservation();
 
// Toutes date par defaut
/*
for (int i = 0; i < listeObservation.length; i++) {
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" + annee + "/" + mois + "/" + jour + "/" + URL.encodeComponent(rechercheLibre) + "/" + URL.encodeComponent(lieudit) + "/"
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
Object[] values = new Object[6];
values[0] = "0";
values[2] = "2";
values[3] = "3";
values[4] = "4";
values[5] = "5";
values[1] = listeObservation[i].getNomSaisi();
 
new ResponseTextHandler() {
// table.add(new TableItem(values));
 
public void onCompletion(String str) {
}
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
int i=0;
// Ligne d'information
 
if ((jsonArray = jsonValue.isArray()) != null) {
StringBuffer lieu=null;
 
int arraySize = jsonArray.size();
for (i = 0; i < arraySize; ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
 
Object[] values = new Object[6];
// Statut Observation transmise ?
String atransmit=((JSONString) jsonArrayNested .get(13)).stringValue();
if (atransmit.compareTo("1")==0) {
values[0] = new Image("tela.gif");
}
else {
values[0] = new HTML("&nbsp;");
}
// Nom saisi
values[1] = new HTML("<b>"+Util.toCelString(((JSONString) jsonArrayNested .get(0)).toString())+"</b>");
 
// Nom retenu
String aname=Util.toCelString(((JSONString) jsonArrayNested .get(2)).toString());
if (aname.compareTo("null")==0) {
values[2] = new HTML("&nbsp;");
}
else {
values[2] = new HTML(aname);
}
/*
/*
// Num nomenclatural
String ann=((JSONString) jsonArrayNested .get(3)).stringValue();
if (ann.compareTo("0")!=0) {
observationText.append(""+ann+"-");
}
else {
observationText.append("0-");
}
// Num Taxonomique
String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
if (ant.compareTo("0")!=0) {
observationText.append(ant+", ");
}
else {
observationText.append("0, ");
}
// Famille
String afamily=Util.toCelString(((JSONString) jsonArrayNested .get(5)).toString());
if (afamily.compareTo("null")==0) {
//
}
else {
observationText.append(afamily+", ");
}
*/
// Toutes date par defaut
/*
// Localisation - Lieu
*
* HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user +
* "/" + identifiantLocalite + "/" + URL.encodeComponent(localite) +"/" +
* annee + "/" + mois + "/" + jour + "/" +
* URL.encodeComponent(rechercheLibre) + "/" +
* URL.encodeComponent(lieudit) + "/" + startIndex + "/" +
* VISIBLE_TAXON_COUNT,
*
* new ResponseTextHandler() {
*
* public void onCompletion(String str) {
*
* JSONValue jsonValue = JSONParser.parse(str); JSONArray jsonArray;
* JSONArray jsonArrayNested;
*
* int i=0;
*
* if ((jsonArray = jsonValue.isArray()) != null) {
*
* StringBuffer lieu=null;
*
* int arraySize = jsonArray.size();
*
* for (i = 0; i < arraySize; ++i) { if ((jsonArrayNested =
* jsonArray.get(i).isArray()) != null) {
*
*
* Object[] values = new Object[6];
*
* // Statut Observation transmise ?
*
* String atransmit=((JSONString) jsonArrayNested
* .get(13)).stringValue();
*
* if (atransmit.compareTo("1")==0) { values[0] = new Image("tela.gif"); }
* else { values[0] = new HTML("&nbsp;"); }
*
* // Nom saisi
*
* values[1] = new HTML("<b>"+Util.toCelString(((JSONString)
* jsonArrayNested .get(0)).toString())+"</b>");
*
*
* // Nom retenu String aname=Util.toCelString(((JSONString)
* jsonArrayNested .get(2)).toString());
*
* if (aname.compareTo("null")==0) { values[2] = new HTML("&nbsp;"); }
* else { values[2] = new HTML(aname); } /*
* /* // Num nomenclatural String ann=((JSONString) jsonArrayNested
* .get(3)).stringValue();
*
* if (ann.compareTo("0")!=0) { observationText.append(""+ann+"-"); }
* else { observationText.append("0-"); }
*
* // Num Taxonomique
*
* String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
*
* if (ant.compareTo("0")!=0) { observationText.append(ant+", "); } else {
* observationText.append("0, "); }
* // Famille
*
*
* String afamily=Util.toCelString(((JSONString) jsonArrayNested
* .get(5)).toString());
*
* if (afamily.compareTo("null")==0) { // } else {
* observationText.append(afamily+", "); }
*/
/*
* // Localisation - Lieu
*
* lieu=new StringBuffer();
*
* String aloc=Util.toCelString(((JSONString) jsonArrayNested
* .get(6)).toString());
*
* if (aloc.compareTo("000null")==0) { if (lieu.length()==0) {
* lieu.append("Commune absente"); } else { lieu.append("commune
* absente"); } } else { if (lieu.length()==0) { lieu.append("Commune de
* "+aloc); } else { lieu.append("commune de "+aloc); }
* }
*
*
* String alieudit=Util.toCelString(((JSONString) jsonArrayNested
* .get(9)).toString());
* // Localisation - Lieu dit
*
* if (alieudit.compareTo("000null")!=0) { lieu.append(", "+alieudit); }
*
* // Station -
*
* String astation=Util.toCelString(((JSONString) jsonArrayNested
* .get(10)).toString());
*
*
* if (astation.compareTo("000null")!=0) { lieu.append(", "+astation); }
*
* // Milieu
*
* String amilieu=Util.toCelString(((JSONString) jsonArrayNested
* .get(11)).toString());
*
*
* if (amilieu.compareTo("000null")!=0) { lieu.append(", "+amilieu); }
*
* String acomment=Util.toCelString(((JSONString) jsonArrayNested
* .get(12)).toString()); // Commentaire
*
* if (acomment.compareTo("null")!=0) { lieu.append(", "+acomment); }
*
*
* if (lieu.toString().compareTo("")==0) { values[3] = new
* HTML("&nbsp;"); } else { values[3] = new HTML(lieu.toString()); }
*
*
* String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
* // Date if (adate.compareTo("0000-00-00 00:00:00")!=0) {
* values[4]=new HTML("<b>"+adate+"</b>"); } else { values[4] = new
* HTML("&nbsp;"); }
*
*
*
* String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
* // Numero d'ordre (cache)
*
* values[5] = aordre;
*
*
*
*
* if (i>=table.getItemCount()) { TableItem item = new
* TableItem(values); table.add(item); } else { TableItem
* item=table.getItem(i); item.setValue(0,values[0]);
* item.setValue(1,values[1]); item.setValue(2,values[2]);
* item.setValue(3,values[3]); item.setValue(4,values[4]);
* item.setValue(5,values[5]); }
* // Spagetti if (ordre!=null) { if (aordre.compareTo(ordre)==0) {
* table.select(i); } else { table.deselect(i); } }
* }
* } }
* // Suppression fin ancien affichage if (i<table.getItemCount()) {
* for (int j = table.getItemCount() -1 ; j >= i; j--) { TableItem
* item=table.getItem(j); table.remove(item); } }
*
* setStatusEnabled();
*
* } });
*/
 
lieu=new StringBuffer();
 
String aloc=Util.toCelString(((JSONString) jsonArrayNested .get(6)).toString());
if (aloc.compareTo("000null")==0) {
if (lieu.length()==0) {
lieu.append("Commune absente");
}
else {
lieu.append("commune absente");
}
}
else {
if (lieu.length()==0) {
lieu.append("Commune de "+aloc);
}
else {
lieu.append("commune de "+aloc);
}
}
String alieudit=Util.toCelString(((JSONString) jsonArrayNested .get(9)).toString());
// Localisation - Lieu dit
if (alieudit.compareTo("000null")!=0) {
lieu.append(", "+alieudit);
}
// Station -
String astation=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString());
 
if (astation.compareTo("000null")!=0) {
lieu.append(", "+astation);
}
 
// Milieu
String amilieu=Util.toCelString(((JSONString) jsonArrayNested .get(11)).toString());
 
if (amilieu.compareTo("000null")!=0) {
lieu.append(", "+amilieu);
}
String acomment=Util.toCelString(((JSONString) jsonArrayNested .get(12)).toString());
// Commentaire
if (acomment.compareTo("null")!=0) {
lieu.append(", "+acomment);
}
 
if (lieu.toString().compareTo("")==0) {
values[3] = new HTML("&nbsp;");
}
else {
values[3] = new HTML(lieu.toString());
}
 
String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
// Date
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
values[4]=new HTML("<b>"+adate+"</b>");
}
else {
values[4] = new HTML("&nbsp;");
}
 
String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
// Numero d'ordre (cache)
values[5] = aordre;
if (i>=table.getItemCount()) {
TableItem item = new TableItem(values);
table.add(item);
}
else {
TableItem item=table.getItem(i);
item.setValue(0,values[0]);
item.setValue(1,values[1]);
item.setValue(2,values[2]);
item.setValue(3,values[3]);
item.setValue(4,values[4]);
item.setValue(5,values[5]);
}
// Spagetti
if (ordre!=null) {
if (aordre.compareTo(ordre)==0) {
table.select(i);
}
else {
table.deselect(i);
}
}
}
 
}
}
 
// Suppression fin ancien affichage
if (i<table.getItemCount()) {
for (int j = table.getItemCount() -1 ; j >= i; j--) {
TableItem item=table.getItem(j);
table.remove(item);
}
}
setStatusEnabled();
}
});
*/
 
}
 
 
/**
* Affichage message d'attente et desactivation navigation
*
622,18 → 505,20
if (count > 0) {
 
if (startIndex >= VISIBLE_TAXON_COUNT) { // Au dela de la
// premiere page
// premiere page
navBar.gotoPrev.setEnabled(true);
navBar.gotoFirst.setEnabled(true);
if (startIndex < (count - VISIBLE_TAXON_COUNT)) { // Pas la
// derniere
// page
// derniere
// page
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count );
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
+ count);
} else { // Derniere page
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count );
navBar.status.setText((startIndex + 1) + " - " + count
+ " sur " + count);
}
} else { // Premiere page
if (count > VISIBLE_TAXON_COUNT) { // Des pages derrieres
640,9 → 525,11
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur " + count);
+ (startIndex + VISIBLE_TAXON_COUNT) + " sur "
+ count);
} else {
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count);
navBar.status.setText((startIndex + 1) + " - " + count
+ " sur " + count);
}
}
}
656,8 → 543,7
* Positionnement index de parcours (this.startIndex) pour affichage de la
* derniere page
*
* @param
* @return void
* @param @return void
*/
 
private void gotoEnd() {
674,37 → 560,31
* Recherche en cours
*
*/
 
public void setRechercheLibre(String search) {
this.rechercheLibre = search;
}
 
 
/*
* Departement en cours
* Departement en cours
*
*/
 
public void setIdLocation(String id_location) {
this.identifiantLocalite = id_location;
}
 
 
/*
* Localite en cours
* Localite en cours
*
*/
 
public void setLocalite(String location) {
this.localite = location;
}
 
 
/*
* Lieudit en cours
* Lieudit en cours
*
*/
 
712,19 → 592,15
this.lieudit = lieudit;
}
 
/*
* Date en cours
* Date en cours
*
*/
 
public void setAnnee(String year) {
this.annee = year;
}
 
 
public void setMois(String month) {
this.mois = month;
}
733,184 → 609,144
this.jour = day;
}
 
/*
* Utilisateur en cours
* Utilisateur en cours
*
*/
 
public void setUser(String user) {
this.user = user;
}
 
 
public void displayFilter() {
// Mise a jour boutton export feuille de calcul
 
// Mise a jour boutton export feuille de calcul
 
/*
observationMediateur.getActionView().getExportButton().setHTML("<a href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/"
+ user + "/"
+ URL.encodeComponent(identifiantLocalite) + "/"
+ URL.encodeComponent(localite) + "/"
+ URL.encodeComponent(lieudit)+ "/"
+ annee + "/"
+ mois + "/"
+ jour
+ "\">"+"Export&nbsp;tableur</a>");
* observationMediateur.getActionView().getExportButton().setHTML("<a
* href=\""+observationMediateur.getServiceBaseUrl()+"/InventoryExport/" +
* user + "/" + URL.encodeComponent(identifiantLocalite) + "/" +
* URL.encodeComponent(localite) + "/" + URL.encodeComponent(lieudit)+
* "/" + annee + "/" + mois + "/" + jour + "\">"+"Export&nbsp;tableur</a>");
*
*/
// Mise a jour ligne de selection
 
*/
// Mise a jour ligne de selection
String dep;
if (identifiantLocalite.compareTo("all")==0) {
dep="Tous d&eacute;partements";
}
else {
if (identifiantLocalite.compareTo("000null")==0) {
dep="D&eacute;partements non renseign&eacute;es ";
String dep;
if (identifiantLocalite.compareTo("all") == 0) {
dep = "Tous d&eacute;partements";
} else {
if (identifiantLocalite.compareTo("000null") == 0) {
dep = "D&eacute;partements non renseign&eacute;es ";
} else {
dep = "Département " + identifiantLocalite;
}
}
else {
dep="Département "+identifiantLocalite;
 
String com;
if (localite.compareTo("all") == 0) {
com = ", toutes communes";
} else {
if (localite.compareTo("000null") == 0) {
com = ", communes non renseign&eacute;es";
} else {
com = ", commune de " + localite;
}
}
}
String com;
if (localite.compareTo("all")==0) {
com=", toutes communes";
}
else {
if (localite.compareTo("000null")==0) {
com=", communes non renseign&eacute;es";
 
String lieu;
 
if (lieudit.compareTo("all") == 0) {
lieu = ", tous lieux dits";
} else {
if (lieudit.compareTo("000null") == 0) {
lieu = ", lieu-dit non renseign&eacute;es";
} else {
lieu = ", lieu-dit " + lieudit;
}
}
else {
com=", commune de "+localite;
 
String dat;
 
if ((annee.compareTo("all") == 0) && (mois.compareTo("all") == 0)
&& (jour.compareTo("all") == 0)) {
dat = ", toutes periodes";
}
}
 
String lieu;
if (lieudit.compareTo("all")==0) {
lieu=", tous lieux dits";
}
else {
if (lieudit.compareTo("000null")==0) {
lieu=", lieu-dit non renseign&eacute;es";
}
else {
lieu=", lieu-dit "+ lieudit;
}
}
String dat;
if ((annee.compareTo("all")==0) && (mois.compareTo("all")==0) && (jour.compareTo("all")==0)) {
dat=", toutes periodes";
}
else {
String yea="";
String da="";
String mont="";
if (annee.compareTo("all")==0) {
yea=", toutes ann&eacute;es";
}
else {
if (annee.compareTo("0")==0) {
yea=", periode non renseign&eacute;e";
}
else {
yea=", "+ annee;
if (mois.compareTo("all")==0) {
mont=", tous mois";
}
else {
mont="/"+ mois;
}
if (jour.compareTo("all")==0) {
da=", tous jours";
}
else {
da="/"+ jour;
}
}
}
dat=yea + mont + da;
}
 
//panel.getHeader().setText(dep + com + lieu + dat);
String yea = "";
String da = "";
String mont = "";
 
if (annee.compareTo("all") == 0) {
yea = ", toutes ann&eacute;es";
} else {
if (annee.compareTo("0") == 0) {
yea = ", periode non renseign&eacute;e";
} else {
yea = ", " + annee;
 
}
if (mois.compareTo("all") == 0) {
mont = ", tous mois";
} else {
mont = "/" + mois;
}
 
if (jour.compareTo("all") == 0) {
da = ", tous jours";
} else {
da = "/" + jour;
}
}
}
 
dat = yea + mont + da;
 
/// EVENEMENTS
/**
* Evenements
*
*/
/*
public void handleEvent(BaseEvent be) {
switch (be.type) {
case ObservationMediateur.NOMBRE_OBSERVATION:
gotoEnd();
getListeObservation();
break;
case ObservationMediateur.LISTE_OBSERVATION:
afficherListeObservation();
break;
}
 
// panel.getHeader().setText(dep + com + lieu + dat);
 
}
*/
 
// / EVENEMENTS
 
/**
* Evenements
*
*/
/*
* public void handleEvent(BaseEvent be) { switch (be.type) { case
* ObservationMediateur.NOMBRE_OBSERVATION: gotoEnd();
* getListeObservation(); break; case
* ObservationMediateur.LISTE_OBSERVATION: afficherListeObservation();
* break; } }
*/
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.3 2008-06-17 14:16:16 aperonnet
* *** empty log message ***
*
* Revision 1.2 2008-06-09 16:29:01 ddelon
* import branche observation
*
* Revision 1.1 2008-06-09 14:19:37 ddelon
* Initialisation observation
*
* Revision 1.3 2008-04-28 13:10:43 ddelon
* Integration MyGwt
*
* Revision 1.2 2008-01-30 08:55:40 ddelon
* fin mise en place mygwt
*
* Revision 1.1 2008-01-02 21:26:04 ddelon
* mise en place mygwt
*
* Revision 1.8 2007-12-22 14:48:53 ddelon
* Documentation et refactorisation
*
* Revision 1.7 2007-09-17 19:25:34 ddelon
* Documentation
*
*/
/*
* +--Fin du code
* ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $ Revision 1.1 2008-09-19 10:27:18
* aperonnet Carnet en ligne, utilisant gwt 1.5 et la nouvelle version de
* gwt-ext (plus de bugs au demarrage dans firefox, plus rapide et annotations
* java)
*
* Revision 1.3 2008-06-17 14:16:16 aperonnet *** empty log message ***
*
* Revision 1.2 2008-06-09 16:29:01 ddelon import branche observation
*
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.3 2008-04-28 13:10:43 ddelon Integration MyGwt
*
* Revision 1.2 2008-01-30 08:55:40 ddelon fin mise en place mygwt
*
* Revision 1.1 2008-01-02 21:26:04 ddelon mise en place mygwt
*
* Revision 1.8 2007-12-22 14:48:53 ddelon Documentation et refactorisation
*
* Revision 1.7 2007-09-17 19:25:34 ddelon Documentation
*
*/
/trunk/src/org/tela_botanica/client/observation/ObservationModele.java
1,6 → 1,5
package org.tela_botanica.client.observation;
 
 
import org.tela_botanica.client.interfaces.iRetourObservation;
import org.tela_botanica.client.modeles.ObservationAsynchroneDAO;
 
8,30 → 7,34
 
public class ObservationModele {
 
private final String baseURL;
 
public ObservationModele() {
baseURL=Dictionary.getDictionary("Parameters").get("serviceBaseUrl");
 
baseURL = Dictionary.getDictionary("Parameters").get("serviceBaseUrl");
 
}
 
public void getNombreObservation(final iRetourObservation retour,
String identifiant, String identifiantLocalite, String localite,
String annee, String mois, String jour, String lieudit,
String rechercheLibre) {
 
public void getNombreObservation(final iRetourObservation retour, String identifiant, String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre) {
new ObservationAsynchroneDAO().getNombreObservation(baseURL, retour,
identifiant, identifiantLocalite, localite, annee, mois, jour,
lieudit, rechercheLibre);
 
new ObservationAsynchroneDAO().getNombreObservation(baseURL, retour, identifiant, identifiantLocalite, localite, annee, mois, jour, lieudit, rechercheLibre );
}
 
public void getListeObservation(iRetourObservation retour,
String identifiant, String identifiantLocalite, String localite,
String annee, String mois, String jour, String lieudit,
String rechercheLibre, int debut, int longueur) {
 
public void getListeObservation(iRetourObservation retour, String identifiant, String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre, int debut, int longueur) {
new ObservationAsynchroneDAO().getListeObservation(baseURL, retour, identifiant, identifiantLocalite, localite, annee, mois, jour, lieudit, rechercheLibre, debut, longueur );
new ObservationAsynchroneDAO().getListeObservation(baseURL, retour,
identifiant, identifiantLocalite, localite, annee, mois, jour,
lieudit, rechercheLibre, debut, longueur);
 
}
 
 
}
/trunk/src/org/tela_botanica/client/Util.java
6,7 → 6,7
}
 
public static String toCelString(String str) {
return str.substring(1,str.length()-1);
return str.substring(1, str.length() - 1);
//
}
}
/trunk/src/org/tela_botanica/client/CarnetEnLigne.java
14,11 → 14,8
 
package org.tela_botanica.client;
 
 
import com.google.gwt.core.client.EntryPoint;
 
 
 
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
25,30 → 22,29
 
public class CarnetEnLigne implements EntryPoint {
 
public void onModuleLoad() {
public void onModuleLoad() {
 
// new Mediator();
new CarnetEnLigneMediateur();
// new Mediator();
new CarnetEnLigneMediateur();
 
}
}
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $
* Revision 1.1 2008-06-09 16:33:17 ddelon
* import branche observation
*
* Revision 1.1 2008-06-04 16:47:56 ddelon
* modele mvc+mediateur
*
* Revision 1.11 2008-01-02 21:26:04 ddelon
* mise en place mygwt
*
* Revision 1.10 2007-09-17 19:25:34 ddelon
* Documentation
*
*
*/
/*
* +--Fin du code
* ---------------------------------------------------------------------------------------+
* $Log: not supported by cvs2svn $ Revision 1.1 2008-09-19 10:27:18 aperonnet
* Carnet en ligne, utilisant gwt 1.5 et la nouvelle version de gwt-ext (plus de
* bugs au demarrage dans firefox, plus rapide et annotations java)
*
* Revision 1.1 2008-06-09 16:33:17 ddelon import branche observation
*
* Revision 1.1 2008-06-04 16:47:56 ddelon modele mvc+mediateur
*
* Revision 1.11 2008-01-02 21:26:04 ddelon mise en place mygwt
*
* Revision 1.10 2007-09-17 19:25:34 ddelon Documentation
*
*
*/
/trunk/src/org/tela_botanica/client/CarnetEnLigneMediateur.java
5,98 → 5,87
import org.tela_botanica.client.modeles.Utilisateur;
import org.tela_botanica.client.observation.ObservationMediateur;
 
public class CarnetEnLigneMediateur {
 
public class CarnetEnLigneMediateur {
// Evenenements
final static public int ETAT_CONNEXION=1;
final static public int DECONNEXION=2;
final static public int CONNEXION = 3;
final static public int ETAT_CONNEXION = 1;
final static public int DECONNEXION = 2;
final static public int CONNEXION = 3;
 
private final CarnetEnLigneModele carnetEnLigneModele;
private Utilisateur utilisateur=null;
private Utilisateur utilisateur = null;
 
// Fonctionnement servicecs
private boolean async=true;
private boolean async = true;
 
public CarnetEnLigneMediateur() {
carnetEnLigneModele=new CarnetEnLigneModele();
//addListener(ETAT_CONNEXION,this);
getEtatUtilisateur(); // Alimente Objet Utilisateur
 
carnetEnLigneModele = new CarnetEnLigneModele();
// addListener(ETAT_CONNEXION,this);
getEtatUtilisateur(); // Alimente Objet Utilisateur
 
}
 
/**
* Fin construction (est appelle sur reception evenement Applicatif ETAT_CONNEXION)
*
* Fin construction (est appelle sur reception evenement Applicatif
* ETAT_CONNEXION)
*
*/
 
private void _CarnetEnLigneMediateur() {
ImageMediateur.Instance() ;
new ObservationMediateur(this);
 
ImageMediateur.Instance();
new ObservationMediateur(this);
 
}
private void getEtatUtilisateur() { // Pourrait devenir publique ...
// TODO : utiliser une factory ici : Avec Modele synchrone ou non, ou au niveau methode comme dans cette exemple
// Pas possible de traiter dans Modele car retour asynchrone devant etre traité ici.
// if asynchrone
 
private void getEtatUtilisateur() { // Pourrait devenir publique ...
 
// TODO : utiliser une factory ici : Avec Modele synchrone ou non, ou au
// niveau methode comme dans cette exemple
 
// Pas possible de traiter dans Modele car retour asynchrone devant etre
// traité ici.
 
// if asynchrone
 
if (async) {
carnetEnLigneModele.getUtilisateurAsynchroneDAO(
new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur=uti;
// fireEvent(ETAT_CONNEXION);
carnetEnLigneModele
.getUtilisateurAsynchroneDAO(new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur = uti;
// fireEvent(ETAT_CONNEXION);
}
 
}
 
}
);
);
 
}
// else if synchrone
// else if synchrone
else {
 
utilisateur= carnetEnLigneModele.getUtilisateurSynchroneDAO();
_CarnetEnLigneMediateur();
utilisateur = carnetEnLigneModele.getUtilisateurSynchroneDAO();
_CarnetEnLigneMediateur();
 
}
 
 
}
 
 
// Evenenements Applicatifs
/*
public void handleEvent(BaseEvent be) {
if (be.type==CarnetEnLigneMediateur.ETAT_CONNEXION) {
_CarnetEnLigneMediateur(); // Fin initialisation
}
}
*/
* public void handleEvent(BaseEvent be) { if
* (be.type==CarnetEnLigneMediateur.ETAT_CONNEXION) {
* _CarnetEnLigneMediateur(); // Fin initialisation } }
*/
 
// Methode publiques
/**
* Recherche Identifiant utilisateur en cours et etat de connection
*
* @return Utilisateur
*/
 
public Utilisateur getUtilisateur() {
return utilisateur;
}
104,42 → 93,32
/**
* Deconnecte l'utilisateur passe en parametre
*/
public void deconnecterUtilisateur() {
public void deconnecterUtilisateur() {
 
carnetEnLigneModele.deconnecterUtilisateur(
new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur=uti;
//fireEvent(DECONNEXION);
}
carnetEnLigneModele.deconnecterUtilisateur(new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur = uti;
// fireEvent(DECONNEXION);
}
 
}, utilisateur.getIdentifiant()
);
}, utilisateur.getIdentifiant()
 
);
 
}
 
public void connecterUtilisateur(String login, String password) {
carnetEnLigneModele.connecterUtilisateur(
new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur=uti;
//fireEvent(CONNEXION);
}
 
}, login, password
carnetEnLigneModele.connecterUtilisateur(new iRetourUtilisateur() {
public void onRetour(Utilisateur uti) {
utilisateur = uti;
// fireEvent(CONNEXION);
}
 
}, login, password
 
);
 
}
 
 
}
 
/trunk/src/org/tela_botanica/client/image/ImageMediateur.java
382,8 → 382,7
* Retourne une instance de manière unique en lui associant un médiateur
* pour les observations
*
* @param le
* médiateur des observations à associer
* @param om le médiateur des observations à associer
* @return l'instance unique du médiateur
*/
public static ImageMediateur Instance(ObservationMediateur om) {
/trunk/src/org/tela_botanica/client/vues/BarreNotationVue.java
214,7 → 214,7
/**
* Accesseur pour la note en cours sous forme de string
*
* @return
* @return la note en cours sous forme d'une chaine de charactères
*/
public String getNote() {
return "" + noteEnCours;
/trunk/src/org/tela_botanica/client/vues/DateFiltreVue.java
9,7 → 9,7
import com.gwtext.client.widgets.form.DateField;
 
/**
* Classe implémentant un filtre qui permet de rechercher une aimge par rapport
* Classe implémentant un filtre qui permet de rechercher une image par rapport
* à la date associée, des critères plus fins viendront compléter cela
*
* @author aurelien
/trunk/src/org/tela_botanica/client/vues/ZoomImageVue.java
413,9 → 413,9
/**
* Setter pour la taille de l'image
*
* @param X
* @param x
* la largeur en pixels
* @param Y
* @param y
* la hauteur en pixels
*/
public void setTailleImage(int x, int y) {
/trunk/src/org/tela_botanica/client/CarnetEnLigneModele.java
5,7 → 5,6
* Ne previent pas les vues. Est appelle par le mediateur qui traite le resultat.
*/
 
 
import org.tela_botanica.client.interfaces.iRetourUtilisateur;
import org.tela_botanica.client.modeles.Utilisateur;
import org.tela_botanica.client.modeles.UtilisateurAsynchroneDAO;
14,17 → 13,16
 
public class CarnetEnLigneModele {
 
private final String baseURL; // Url d'appel aux services
 
/**
* Constructeur
*/
public CarnetEnLigneModele() {
baseURL=Dictionary.getDictionary("Parameters").get("serviceBaseUrl");
 
public CarnetEnLigneModele() {
 
baseURL = Dictionary.getDictionary("Parameters").get("serviceBaseUrl");
 
}
 
/**
31,14 → 29,13
*
*
*/
 
public void getUtilisateurAsynchroneDAO(final iRetourUtilisateur retour) {
 
new UtilisateurAsynchroneDAO().getUtilisateur(baseURL,retour );
new UtilisateurAsynchroneDAO().getUtilisateur(baseURL, retour);
 
}
 
/**
*
*
45,21 → 42,23
*/
public Utilisateur getUtilisateurSynchroneDAO() {
 
return new Utilisateur("David Delon synchrone",true);
return new Utilisateur("David Delon synchrone", true);
 
}
 
public void deconnecterUtilisateur(final iRetourUtilisateur retour, String user) {
public void deconnecterUtilisateur(final iRetourUtilisateur retour,
String user) {
 
new UtilisateurAsynchroneDAO().deconnecterUtilisateur(baseURL,retour,user );
new UtilisateurAsynchroneDAO().deconnecterUtilisateur(baseURL, retour,
user);
 
 
}
 
public void connecterUtilisateur(final iRetourUtilisateur retour, String login , String password) {
new UtilisateurAsynchroneDAO().connecteUtilisateur(baseURL,retour,login, password );
public void connecterUtilisateur(final iRetourUtilisateur retour,
String login, String password) {
 
new UtilisateurAsynchroneDAO().connecteUtilisateur(baseURL, retour,
login, password);
}
 
}
/trunk/src/org/tela_botanica/client/cel2.java
10,13 → 10,13
*/
public class cel2 implements EntryPoint {
 
/**
* This is the entry point method.
*/
public void onModuleLoad() {
ImageMediateur im = ImageMediateur.Instance() ;
new Viewport(im.getPanneauPrincipalImage());
}
/**
* This is the entry point method.
*/
public void onModuleLoad() {
 
ImageMediateur im = ImageMediateur.Instance();
 
new Viewport(im.getPanneauPrincipalImage());
}
}