Subversion Repositories eFlore/Applications.cel

Compare Revisions

Regard whitespace Rev 2 → Rev 7

/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,11 → 21,8
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Widget;
 
 
public class EtatConnexionVue extends Composite {
 
 
private ObservationMediateur observationMediateur=null;
private HTML signLabel = new HTML() ;
36,11 → 32,9
 
observationMediateur=med;
 
HorizontalPanel outer = new HorizontalPanel();
HorizontalPanel inner = new HorizontalPanel();
outer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
 
inner.add(signLabel);
50,8 → 44,7
 
initWidget(outer);
 
signLabel.addClickListener(
new ClickListener() {
signLabel.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
// Non connecte ? Lien vers boite de connection
65,43 → 58,36
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
/*
* +--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.2 2008-04-28 13:10:44 ddelon
* Integration MyGwt
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.1 2008-01-02 21:26:04 ddelon
* mise en place mygwt
* Revision 1.2 2008-04-28 13:10:44 ddelon Integration MyGwt
*
* Revision 1.6 2007-12-22 14:48:53 ddelon
* Documentation et refactorisation
* Revision 1.1 2008-01-02 21:26:04 ddelon mise en place mygwt
*
* Revision 1.5 2007-09-17 19:25:34 ddelon
* Documentation
* 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
34,13 → 34,13
 
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);
public FormulaireDeConnexionVue(final ObservationMediateur carnetEnLigneMediateur) {
public FormulaireDeConnexionVue(
final ObservationMediateur carnetEnLigneMediateur) {
setText("Connexion");
 
49,56 → 49,46
VerticalPanel outer = new VerticalPanel();
 
/*
* E-Mail : Zone_saisie_email
* Mot-de-passe : Zone_saisie_mot_de_passe
* Message d'information
* Bouton_Ok Bouton_Annuler
* 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() {
okButton.addClickListener(new ClickListener() {
public void onClick(Widget sender) {
connecteUtilisateur();
}
}
);
});
 
// Annulation
HTML cancelButton=new HTML("Annuler");
cancelButton.setStyleName("html_button");
cancelButton.addClickListener(
new ClickListener() {
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)
{
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 onKeyUp(Widget arg0, char arg1, int arg2) {
}
public void onKeyPress(Widget arg0, char arg1, int arg2) {
}
);
});
 
// Validation utilisateur sans utilisation des boutons :
106,22 → 96,26
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
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 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:           ");
inner
.setHTML(
1,
0,
"Mot de passe:           ");
inner.setWidget(1,1,password);
inner.setWidget(3,0,okButton);
inner.setWidget(3,1,cancelButton);
132,13 → 126,14
}
 
/**
* Appel du service d'identification et positionnement de l'etat de connection en fonction du resultat.
* 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
* @param login :
* identifiant saisi
* @param password :
* mot de passe saisi
*
*/
149,14 → 144,8
 
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.
173,36 → 162,32
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
/*
* +--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.10 2007-09-17 19:25:34 ddelon
* Documentation
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.9 2007-05-21 21:03:44 ddelon
* nettoyage de code
* Revision 1.10 2007-09-17 19:25:34 ddelon Documentation
*
* Revision 1.8 2007-05-21 18:14:06 ddelon
* Gestion importation releve locaux
* Revision 1.9 2007-05-21 21:03:44 ddelon nettoyage de code
*
* Revision 1.7 2007-05-21 11:47:30 ddelon
* meta cvs
* Revision 1.8 2007-05-21 18:14:06 ddelon Gestion importation releve locaux
*
* Revision 1.6 2007-05-21 11:39:48 ddelon
* meta cvs
* Revision 1.7 2007-05-21 11:47:30 ddelon meta cvs
*
* Revision 1.5 2007-05-21 11:39:12 ddelon
* meta cvs
* Revision 1.6 2007-05-21 11:39:48 ddelon meta cvs
*
* Revision 1.4 2007-05-21 11:37:35 ddelon
* meta cvs
* Revision 1.5 2007-05-21 11:39:12 ddelon meta cvs
*
* Revision 1.3 2007-05-21 11:36:51 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,7 → 36,6
*
*/
 
 
package org.tela_botanica.client.observation;
 
import org.tela_botanica.client.modeles.Observation;
53,18 → 50,14
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("<<", this);
public final Button gotoNext = new Button(">", this);
public final Button gotoPrev = new Button("<", this);
71,7 → 64,6
public final Button gotoEnd = new Button(">>", this);
public final Label status = new Label();
 
public NavBar() {
initWidget(bar);
81,10 → 73,11
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);
92,10 → 85,8
bar.add(buttons, DockPanel.EAST);
 
}
 
public void onClick(Widget sender) {
if (sender == gotoNext) {
// Move forward a page.
151,30 → 142,22
private String lieudit = "all";
private String ordre= null;
 
 
public ListeObservationsVue(ObservationMediateur observationMediateur) {
// Traitement contexte utilisateur et service
 
this.observationMediateur=observationMediateur;
 
// panel= new ContentPanel(Style.HEADER);
// panel.setLayout(new FillLayout());
// Barre navigation integree au header
navBar = new NavBar();
// panel.getHeader().addWidget(navBar);
 
// Contenu :
// Colonnes :
// TableColumn[] columns = new TableColumn[6];
181,138 → 164,110
// 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);
}
}
}
}
});
* 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); }
* } } } });
*/
// 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();
 
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();
* 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();
*/
}
/**
* 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
*
*/
321,9 → 276,12
setStatusDisabled();
 
// observationMediateur.addListener(ObservationMediateur.NOMBRE_OBSERVATION,this);
observationMediateur.getNombreObservation(identifiantLocalite,localite,annee, mois, jour ,lieudit,rechercheLibre); // Retour dans handlevent() NOMBRE_OBSERVATION
observationMediateur.getNombreObservation(identifiantLocalite,
localite, annee, mois, jour, lieudit, rechercheLibre); // Retour
// dans
// handlevent()
// NOMBRE_OBSERVATION
 
}
/**
336,13 → 294,17
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.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();
Observation[] listeObservation = observationMediateur.getObservation()
.getListeObservation();
for (int i=0;i<listeObservation.length;i++) {
362,237 → 324,158
 
// Toutes date par defaut
/*
 
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+", ");
}
*
* 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();
}
});
* // 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();
*
* } });
*/
 
}
 
 
/**
* Affichage message d'attente et desactivation navigation
*
631,9 → 514,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 { // 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() {
679,8 → 565,6
this.rechercheLibre = search;
}
 
 
/*
* Departement en cours
*
690,8 → 574,6
this.identifiantLocalite = id_location;
}
 
 
/*
* Localite en cours
*
701,8 → 583,6
this.localite = location;
}
 
 
/*
* Lieudit en cours
*
712,19 → 592,15
this.lieudit = lieudit;
}
 
/*
* Date en cours
*
*/
 
public void setAnnee(String year) {
this.annee = year;
}
 
 
public void setMois(String month) {
this.mois = month;
}
733,81 → 609,59
this.jour = day;
}
 
/*
* Utilisateur en cours
*
*/
 
public void setUser(String user) {
this.user = user;
}
 
 
public void displayFilter() {
// 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
String dep;
if (identifiantLocalite.compareTo("all")==0) {
dep="Tous d&eacute;partements";
}
else {
} else {
if (identifiantLocalite.compareTo("000null")==0) {
dep="D&eacute;partements non renseign&eacute;es ";
}
else {
} else {
dep="Département "+identifiantLocalite;
}
}
String com;
if (localite.compareTo("all")==0) {
com=", toutes communes";
}
else {
} else {
if (localite.compareTo("000null")==0) {
com=", communes non renseign&eacute;es";
}
else {
} else {
com=", commune de "+localite;
}
}
 
String lieu;
if (lieudit.compareTo("all")==0) {
lieu=", tous lieux dits";
}
else {
} else {
if (lieudit.compareTo("000null")==0) {
lieu=", lieu-dit non renseign&eacute;es";
}
else {
} else {
lieu=", lieu-dit "+ lieudit;
}
}
814,7 → 668,8
String dat;
if ((annee.compareTo("all")==0) && (mois.compareTo("all")==0) && (jour.compareTo("all")==0)) {
if ((annee.compareTo("all") == 0) && (mois.compareTo("all") == 0)
&& (jour.compareTo("all") == 0)) {
dat=", toutes periodes";
}
826,26 → 681,21
if (annee.compareTo("all")==0) {
yea=", toutes ann&eacute;es";
}
else {
} else {
if (annee.compareTo("0")==0) {
yea=", periode non renseign&eacute;e";
}
else {
} else {
yea=", "+ annee;
if (mois.compareTo("all")==0) {
mont=", tous mois";
}
else {
} else {
mont="/"+ mois;
}
if (jour.compareTo("all")==0) {
da=", tous jours";
}
else {
} else {
da="/"+ jour;
}
}
855,15 → 705,10
}
 
//panel.getHeader().setText(dep + com + lieu + dat);
 
 
}
 
 
 
/// EVENEMENTS
/**
871,46 → 716,37
*
*/
/*
public void handleEvent(BaseEvent be) {
switch (be.type) {
case ObservationMediateur.NOMBRE_OBSERVATION:
gotoEnd();
getListeObservation();
break;
case ObservationMediateur.LISTE_OBSERVATION:
afficherListeObservation();
break;
}
}
* 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 ***
/*
* +--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.2 2008-06-09 16:29:01 ddelon
* import branche observation
* Revision 1.3 2008-06-17 14:16:16 aperonnet *** empty log message ***
*
* Revision 1.1 2008-06-09 14:19:37 ddelon
* Initialisation observation
* Revision 1.2 2008-06-09 16:29:01 ddelon import branche observation
*
* Revision 1.3 2008-04-28 13:10:43 ddelon
* Integration MyGwt
* Revision 1.1 2008-06-09 14:19:37 ddelon Initialisation observation
*
* Revision 1.2 2008-01-30 08:55:40 ddelon
* fin mise en place mygwt
* Revision 1.3 2008-04-28 13:10:43 ddelon Integration MyGwt
*
* Revision 1.1 2008-01-02 21:26:04 ddelon
* mise en place mygwt
* Revision 1.2 2008-01-30 08:55:40 ddelon fin mise en place mygwt
*
* Revision 1.8 2007-12-22 14:48:53 ddelon
* Documentation et refactorisation
* Revision 1.1 2008-01-02 21:26:04 ddelon mise en place mygwt
*
* Revision 1.7 2007-09-17 19:25:34 ddelon
* Documentation
* 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,10 → 7,8
 
public class ObservationModele {
 
private final String baseURL;
public ObservationModele() {
baseURL=Dictionary.getDictionary("Parameters").get("serviceBaseUrl");
18,20 → 15,26
}
 
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/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;
14,14 → 11,13
 
public class ObservationMediateur implements iMediateur{
 
 
// Evenenements
final static public int NOMBRE_OBSERVATION=1;
 
final static public int LISTE_OBSERVATION=2;
private CarnetEnLigneMediateur carnetEnLigneMediateur=null; // Mediateur General
private CarnetEnLigneMediateur carnetEnLigneMediateur = null; // Mediateur
// General
private final ObservationModele observationModele=new ObservationModele();
 
private Observation observation=null;
31,16 → 27,19
 
// 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);
52,7 → 51,6
panel.add(listeObservationsVue);
 
RootPanel.get().add(panel);
onInitialisation();
59,7 → 57,6
}
 
/// Methodes privees
 
/**
70,20 → 67,20
private void onInitialisation() {
afficheEtatConnexion();
onFiltrageListeObservation("all","all","all");
}
// 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);
94,32 → 91,25
// Affichage des filtres
listeObservationsVue.displayFilter();
 
}
 
 
 
/// UTILISATEUR
 
/**
* Affichage etat de la connexion
*/
private void afficheEtatConnexion() {
if (!carnetEnLigneMediateur.getUtilisateur().isIdentifie()) {
etatConnexionVue.setEtat(texteDeconnexion,false);
} else {
etatConnexionVue.setEtat(carnetEnLigneMediateur.getUtilisateur()
.getIdentifiant()
+ " (deconnexion)", true);
}
else {
etatConnexionVue.setEtat(carnetEnLigneMediateur.getUtilisateur().getIdentifiant()+ " (deconnexion)",true);
}
}
 
/**
*
* Affichage boite de connexion
139,7 → 129,6
}
 
/**
* Deconnexion de l'utilisateur en cours
*/
151,14 → 140,13
}
 
 
/**
* Tentative de connexion utilisateur
*
* @param login
* @param password
*/
public void connecterUtilisateur(String login, String password) {
// carnetEnLigneMediateur.addListener(CarnetEnLigneMediateur.CONNEXION,this);
166,61 → 154,54
 
}
 
 
/// 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) {
public void getNombreObservation (String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre ) {
 
observationModele.getNombreObservation(
new iRetourObservation() {
observationModele.getNombreObservation(new iRetourObservation() {
public void onRetour(Observation obs) {
observation=obs;
//fireEvent(NOMBRE_OBSERVATION);
}
 
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(),
identifiantLocalite, localite, annee, mois, jour, lieudit,
rechercheLibre
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(), identifiantLocalite, localite , annee, mois, jour, lieudit ,rechercheLibre
);
}
 
public void getListeObservation (String identifiantLocalite, String localite, String annee, String mois, String jour, String lieudit, String rechercheLibre, int debut, int longueur) {
public void getListeObservation(String identifiantLocalite,
String localite, String annee, String mois, String jour,
String lieudit, String rechercheLibre, int debut, int longueur) {
 
observationModele.getListeObservation(
new iRetourObservation() {
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
}, carnetEnLigneMediateur.getUtilisateur().getIdentifiant(), identifiantLocalite, localite , annee, mois, jour, lieudit ,rechercheLibre, debut, longueur
);
 
}
 
 
public Observation getObservation() {
return observation;
}
 
 
 
/// EVENEMENTS
/**
228,29 → 209,14
*
*/
/*
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 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; } }
*
*/
 
 
 
 
 
 
}