Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

No changes between revisions

Ignore whitespace Rev 26 → Rev 27

/trunk/src/org/tela_botanica/client/ActionPanel.java
1,18 → 1,21
/**
David Delon david.delon@clapas.net 2007
*/
 
/*
* Copyright 2006 Google Inc.
* ActionPanel.java : affichage actions sur releves saisie ou affiches (suppression, export etc...)
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
* TODO : appel de fonction du mediator, au lieu de passer par les methode de la classe de gestion d'affichage des releves (voir les TODO dans le
* corps de ce programme)
*
* 1: Le programme affiche les boutons commandant les actions sur les releves et arme les actions correspondantes
* - Transmission d'elements (vers tela botanica)
* - Suppression d'elements selectionnes
* - Export vers tableur
* - Selection / Deselection des releves affiches
*/
 
package org.tela_botanica.client;
 
 
23,11 → 26,6
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.Widget;
 
/**
* Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
*/
 
public class ActionPanel extends Composite {
private Mediator mediator=null;
80,11 → 78,9
buttons.add(delButton);
 
// Export de la totalité
// Export (renseigne lors de l'affichage des releves )
exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/"
+ mediator.getUser() +
"\">"+"Export&nbsp;tableur</a>");
exportButton=new HTML();
buttons.add(exportButton);
exportButton.setStyleName("html_button");
 
138,7 → 134,17
}
 
 
public HTML getExportButton() {
return exportButton;
}
}
public HTML getExportButton() {
return exportButton;
}
}
 
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.5 2007-09-17 19:25:34 ddelon
* Documentation
*
*
*/
/trunk/src/org/tela_botanica/client/LocationList.java
149,7 → 149,7
 
private int count = 0;
// Tous selectionné
// Tous selectionn�
private int selectedRow = -1;
private Mediator mediator = null;
179,7 → 179,7
 
 
// Mise en forme de l'entree "Toutes localités"
// Mise en forme de l'entree "Toutes localit�s"
 
selector.setCellSpacing(0);
selector.setCellPadding(0);
218,7 → 218,7
navBar.setWidth("100%");
outer.add(header);
inner.add(selector); // Toutes localités
inner.add(selector); // Toutes localit�s
inner.add(table);
inner.setStyleName("location-List");
inner.setWidth("100%");
310,9 → 310,9
/**
*
* Mise a jour de l'affichage, à partir des données d'inventaire deja
* Mise a jour de l'affichage, � partir des donn�es d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
* donn�es seront affich�es
*
*/
 
348,7 → 348,7
}
// Lieu
String loc=((JSONString)jsonArrayNested.get(0)).stringValue();
String loc=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString());
if (loc.compareTo("000null")!=0) {
table.setText(row, 0,loc);
398,7 → 398,7
/*
* Positionnement index de parcours (this.startIndex) pour affichage de la
* dernière page
* derni�re page
*
* @param
* @return void
416,7 → 416,7
/**
* Affichage message d'attente et désactivation navigation
* Affichage message d'attente et d�sactivation navigation
*
* @param
* @return void
/trunk/src/org/tela_botanica/client/Mediator.java
12,34 → 12,50
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.TextBox;
 
public class Mediator implements AutoCompleteAsyncTextBoxListener {
private String serviceBaseUrl = getServiceBaseUrlFromDictionnary();
private String user = null;
private InventoryItemList inventoryItemList = null;
private LocationList locationList = null;
private DateList dateList = null;
private StationList stationList = null;
private NameAssistant nameAssistant=null;
private LocationAssistant locationAssistant=null;
private InventoryItem inventoryItem=null;
private EntryPanel entryPanel=null;
private ActionPanel actionPanel=null;
private TopPanel topPanel=null;
private LeftPanel leftPanel=null;
private InfoPopup infoPopup=null;
private String serviceBaseUrl = getServiceBaseUrlFromDictionnary(); // Recherche url de base des services distants
private TextBox date = null;
private TextBox complementLocation = null;
private TextBox comment = null;
// Utilisateur
private TopPanel topPanel=null; // Information de connexion
private String user = null; // Utilisateur connecte ou bien identifiant de session
private boolean connected=false;
 
boolean connected=false;
// Filtres
private LeftPanel leftPanel=null; // Containeur filtre date, lieu, lieu-dit ...
private LocationList locationList = null; // Filtre sur lieu de releve
private DateList dateList = null; // Filtre sur date d'observation
private StationList stationList = null; // Filtre sur station d'observation
// Saisie d'une observation
private EntryPanel entryPanel=null; // Formulaire de saisie observation
private NameAssistant nameAssistant=null; // Assistant de saisie nom scientifique
private LocationAssistant locationAssistant=null; // Assistant de saisie nom de commune
private TextBox date = null; // date observation
private TextBox milieu = null; // milieu observation
private TextBox lieudit = null; // lieu dit observation
private TextBox comment = null; // commentaire observation
private InventoryItem inventoryItem=null; // Une observation saisie
 
 
// Liste des observations
private InventoryItemList inventoryItemList = null; // Liste de releves saisis
private ActionPanel actionPanel=null; // Action sur les observations
// Informations
private InfoPopup infoPopup=null; // Information complementaire sur un taxon (photo, repartition)
 
// Point d'entree (pour fin d'initialisation)
 
private Cel cel = null;
 
46,8 → 62,63
Mediator() {
}
// Methodes Private
/**
* Recuperation du prefixe d'appel des services
* @return prefix appel des service
*/
 
private String getServiceBaseUrlFromDictionnary() {
 
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
 
 
// Appel aux services :
 
/**
* Recherche distante et asynchrone de l'utilisateur connecte, en retour lancement methode initialisation
* de l'appellant Cel. (initAsync)
*
*/
private void getUserFromService() {
 
 
HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
if ((jsonArray = jsonValue.isArray()) != null) {
user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur ou identifiant de session si non connecte
connected = ((JSONBoolean) jsonArray.get(1)).booleanValue(); // Drapeau leve si utilisateur identifie
}
cel.initAsync();
}
});
 
}
 
 
// Methodes Public
// Information sur Etat du systeme
/**
* Recuperation information utilisateur
*
*/
57,11 → 128,12
}
// Actions declanchee par le systeme
/**
* Action initialisation
* Action initialisation premier affichage
*/
public void onInit() {
 
73,10 → 145,12
}
// Actions sur formulaire de saisie
 
/**
* Action lancee par la completion d'un nom dans l'assistant de saisie
* Recherche d'information compl�mentaires ....
* Action lancee par la completion d'un nom dans un assistant de saisie
* Recherche d'information complementaires ....
*
* @return void
*/
90,42 → 164,107
}
/**
* Action suivant la completion d'un nom
*
*/
 
public void onNameCompleted(String value) {
if (infoPopup==null) {
infoPopup = new InfoPopup(this);
}
infoPopup.setImageUrl(value);
}
 
/**
* Action lancee par la selection d'un nom dans l'assistant de saisie. Lance
* la recherche d'informations compl�mentaires (famille, numero
* Action prealable a l'ajout d'une observation : controle presence champs requis et lancement mise a jour
*
*/
public void onAddInventoryItem() {
// Lazy instantiation
if (inventoryItem==null) {
registerInventoryItem(new InventoryItem());
}
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),"null");
inventoryItemList.addelement();
}
 
/**
* Action prealable a la modification d'une observation : controle presence champs requis et lancement mise a jour
*
*/
 
public void onModifyInventoryItem(String ordre) {
 
// Lazy instantiation
if (inventoryItem==null) {
registerInventoryItem(new InventoryItem());
}
 
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),ordre);
inventoryItemList.updateElement();
 
}
 
public boolean inventoryItemIsValid() {
// TODO : controle date
if (inventoryItem.getName().compareTo("")==0) {
return false;
}
else {
return true;
}
}
 
 
 
/**
* Action lancee par la selection d'un nom dans un assistant de saisie. Lance
* la recherche d'informations complementaires (famille, numero
* nomenclaturaux etc) et met a jour l'inventaire (addelement())
*
* @return void
*/
public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
String str, String value) {
if (getEntryPanel().getOrdre()==null) {
if (getEntryPanel().getOrdre()==null) { // Nouvelle observation
onAddInventoryItem();
}
else {
onModifyInventoryItem(getEntryPanel().getOrdre());
onModifyInventoryItem(getEntryPanel().getOrdre()); // Modification d'une observation
getEntryPanel().setOrdre(null);
}
 
}
 
// Action portant sur la liste des observations
/**
* Action suite ajout, modification, suppression element inventaire
* Action suite ajout, modification, suppression d'un element inventaire
*/
public void onInventoryUpdated(String location) {
 
locationList.setLocation(location);
locationList.updateCount();
locationList.setLocation(location); // Mise a jour filtre localite
locationList.updateCount();
 
this.onLocationSelected(location);
this.onLocationSelected(location); // Selection localite
}
136,66 → 275,32
public void onInventoryItemSelected(String ordre) {
entryPanel.setOrdre(ordre);
entryPanel.setOrdre(ordre); // Mise a jour du formulaire de saisie avec l'element selectionne
entryPanel.update();
}
 
/**
* Action sur deselection d'une observation : affichage du detail
* Action sur deselection d'une observation : remise a zero
*/
public void onInventoryItemUnselected(String ordre) {
entryPanel.setOrdre(null);
entryPanel.setOrdre(null); // Mise a jour du formulaire de saisie avec l'element selectionne
}
 
 
 
/**
* Action sur recherche : affichage de la liste des taxons correspondants
*/
public void onSearch(String search) {
if (search.trim().compareTo("")==0) {
search="all";
}
inventoryItemList.setSearch(search);
inventoryItemList.updateCount();
}
// Action sur Filtrage
 
 
// Filtre identification
/**
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants
* TODO : gerer asynchronicite ?
*/
public void onLocationSelected(String loc) {
inventoryItemList.setLocation(loc);
inventoryItemList.updateCount();
inventoryItemList.displayFilter();
 
dateList.setLocation(loc);
dateList.updateCount();
stationList.setLocation(loc);
stationList.updateCount();
}
/**
* Action sur login
* Action sur login : initialisation filtres pour cette utilisateur
* @param user
*/
231,99 → 336,90
entryPanel.setUser(user);
locationList.setUser(user);
this.onInit();
}
// Filtre recherche contenu
/**
* Action sur recherche : affichage de la liste des taxons correspondants
*/
public void onSearch(String search) {
if (search.trim().compareTo("")==0) {
search="all";
}
inventoryItemList.setSearch(search);
inventoryItemList.updateCount();
}
 
// Filtre selection lieu
/**
* Action sur selection d'une station : affichage de la liste des taxons correspondants
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants
* TODO : gerer asynchronicite ?
*/
public void onStationSelected(String station) {
 
inventoryItemList.setStation(station);
public void onLocationSelected(String loc) {
inventoryItemList.setLocation(loc);
inventoryItemList.updateCount();
inventoryItemList.displayFilter();
 
// nameAssistant.setValue(null);
 
 
dateList.setLocation(loc);
dateList.updateCount();
stationList.setLocation(loc);
stationList.updateCount();
}
 
 
 
// Filtre station
/**
* Action sur selection d'une date : affichage de la liste des taxons correspondants
* Action sur selection d'une station : affichage de la liste des taxons correspondants
*/
public void onDateSelected(String date) {
public void onStationSelected(String station) {
 
inventoryItemList.setDate(date);
inventoryItemList.setStation(station);
inventoryItemList.updateCount();
inventoryItemList.displayFilter();
 
// nameAssistant.setValue(null);
 
 
}
 
/**
* Action suivant la completion d'un nom
*
*/
// Filtre date d'observation
 
public void onNameCompleted(String value) {
if (infoPopup==null) {
infoPopup = new InfoPopup(this);
}
infoPopup.setImageUrl(value);
}
/**
* Action prealable a l'ajout d'une observation : controle presence champs requis et lancement mise a jour
*
* Action sur selection d'une date : affichage de la liste des taxons correspondants
*/
public void onAddInventoryItem() {
// TODO : singleton ?
registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText(),"null"));
inventoryItemList.addelement();
public void onDateSelected(String date) {
 
inventoryItemList.setDate(date);
inventoryItemList.updateCount();
}
inventoryItemList.displayFilter();
 
/**
* Action prealable a la modification d'une observation : controle presence champs requis et lancement mise a jour
*
*/
 
public void onModifyInventoryItem(String ordre) {
 
// TODO : singleton ?
registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText(),ordre));
inventoryItemList.updateElement();
 
}
 
public boolean inventoryItemIsValid() {
// TODO : controle date
if (inventoryItem.getName().compareTo("")==0) {
return false;
}
else {
return true;
}
}
// Declaration, enregistrement
 
/**
* Declaration InventoryItem
* Declaration InventoryItem : une observation
* @param cel
*/
 
334,9 → 430,8
 
 
/**
* Declaration InventoryItemList
* Declaration InventoryItemList : liste d'observation
* @param inventoryItemList
*/
347,7 → 442,7
}
/**
* Declaration LocationList
* Declaration LocationList : filtre lieu observation
* @param locationList
*/
359,7 → 454,7
/**
* Declaration DateList
* Declaration DateList : filtre date observation
* @param locationList
*/
370,7 → 465,7
 
/**
* Declaration InfoPopup
* Declaration InfoPopup : information complementaire taxon en cours
* @param infoPopup
*/
382,7 → 477,7
 
/**
* Declaration StationList
* Declaration StationList : filtre par station
* @param locationList
*/
394,7 → 489,7
/**
* Declaration Cel
* Declaration Cel : point d'entree
* @param cel
*/
 
405,7 → 500,7
 
/**
* Declaration NameAssistant
* Declaration NameAssistant : completion nom scientifique
* @param nameassistant
*/
415,7 → 510,7
}
/**
* Declaration LocationAssistant
* Declaration LocationAssistant : completion commune
* @param locationassistant
*/
424,10 → 519,10
}
 
/**
* Declaration date
* Declaration date : date observation
* @param date
*/
436,28 → 531,55
}
/**
* Declaration lieu dit : lieu dit d'observation
*
* @param milieu
*/
public void registerLieudit(TextBox lieudit) {
this.lieudit=lieudit;
}
 
 
/**
* Declaration complementLocation
* @param complementLocation
* Declaration milieu : milieu d'observation
*
* @param milieu
*/
public void registerComplementLocation(TextBox complementLocation) {
this.complementLocation=complementLocation;
public void registerMilieu(TextBox milieu) {
this.milieu=milieu;
}
 
/**
* Declaration Entry Panel : formulaire de saisie observation
*/
 
public void registerEntryPanel(EntryPanel entryPanel) {
this.entryPanel=entryPanel;
}
 
 
/**
* Declaration Action Panel : actions sur liste des observations
*/
 
public void registerActionPanel(ActionPanel actionPanel) {
this.actionPanel=actionPanel;
}
 
 
/**
* Declaration TopPanel : panneau de connexion
*/
 
public void registerTopPanel(TopPanel topPanel) {
477,7 → 599,8
}
 
/* Panneau gauche
/*
* Declaration LeftPanel Panneau gauche filtre sur liste d'observation
*
*/
487,33 → 610,9
}
// Accesseurs et setteurs
 
/**
* Recherche distante et asynchrone de l'utilisateur connecte, en retour lancement methode initialisation
* de l'appellant Cel. (initAsync)
*
*/
private void getUserFromService() {
 
 
HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
if ((jsonArray = jsonValue.isArray()) != null) {
user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur ou identifiant de session si non connecte
connected = ((JSONBoolean) jsonArray.get(1)).booleanValue(); // Drapeau leve si utilisateur identifie
}
cel.initAsync();
}
});
 
}
/**
* Accesseur Url de base
* @return Url de base
525,21 → 624,8
 
}
 
/**
* Recuperation du prefixe d'appel des services
* @return prefix appel des service
*/
 
private String getServiceBaseUrlFromDictionnary() {
 
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
 
 
/**
* Accesseur Utilisateur
* @return utilisateur connecte ou identifiant de session
*/
548,13 → 634,10
return user;
}
 
 
public void setUser(String user) {
this.user=user;
}
 
 
public InventoryItemList getInventoryItemList() {
return inventoryItemList;
/trunk/src/org/tela_botanica/client/InventoryItemList.java
291,15 → 291,15
if ((jsonArray = jsonValue.isArray()) != null) {
// Nom retenu, Num Nomen nom retenu, Num Taxon, Famille
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), inventoryItem.getNomenclaturalNumber(),
((JSONString) jsonArray.get(0))
.stringValue(),
Util.toCelString(((JSONString) jsonArray.get(0))
.toString()),
((JSONString) jsonArray.get(1))
.stringValue(),
((JSONString) jsonArray.get(2))
.stringValue(),
((JSONString) jsonArray.get(3))
.stringValue(),
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
Util.toCelString(((JSONString) jsonArray.get(3))
.toString()),
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getMilieu(),inventoryItem.getComment());
}
}
307,7 → 307,7
}
// Modification d'un nom ne faisant pas parti du referentiel (saisie libre)
else {
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getMilieu(),inventoryItem.getComment());
}
}
349,15 → 349,15
// Nom retenu, Num Nomen nom retenu, Num Taxon,
// Famille
addElement(inventoryItem.getName(), inventoryItem.getNomenclaturalNumber(),
((JSONString) jsonArray.get(0))
.stringValue(),
Util.toCelString(((JSONString) jsonArray.get(0))
.toString()),
((JSONString) jsonArray.get(1))
.stringValue(),
((JSONString) jsonArray.get(2))
.stringValue(),
((JSONString) jsonArray.get(3))
.stringValue(),
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
Util.toCelString(((JSONString) jsonArray.get(3))
.toString()),
inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getMilieu(),inventoryItem.getComment());
}
}
365,7 → 365,7
}
// Saisie libre
else {
addElement(inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
addElement(inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getMilieu(),inventoryItem.getComment());
}
}
395,15 → 395,15
*/
 
private void addElement(String nom_sel, String num_nom_sel, String nom_ret,
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String milieu, String comment) {
 
 
count++;
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/", "identifiant="
+ user + "&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
+ "&station="+ complementLocation + "&commentaire="+ comment,
+ user + "&nom_sel=" + URL.encodeComponent(nom_sel) + "&num_nom_sel=" + num_nom_sel
+ "&nom_ret=" + URL.encodeComponent(nom_ret) + "&num_nom_ret=" + num_nom_ret
+ "&num_taxon=" + num_taxon + "&famille=" + URL.encodeComponent(famille) + "&location=" + URL.encodeComponent(loc) + "&id_location=" + id_location + "&date_observation=" + dat
+ "&station="+ URL.encodeComponent(milieu) + "&commentaire="+ URL.encodeComponent(comment),
 
new ResponseTextHandler() {
 
438,14 → 438,14
*/
 
private void updateElement(String ordre, String nom_sel, String num_nom_sel, String nom_ret,
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String milieu, String comment) {
 
 
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +ordre + "/",
"&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
+ "&station="+ complementLocation + "&commentaire="+ comment,
"&nom_sel=" + URL.encodeComponent(nom_sel) + "&num_nom_sel=" + num_nom_sel
+ "&nom_ret=" + URL.encodeComponent(nom_ret) + "&num_nom_ret=" + num_nom_ret
+ "&num_taxon=" + num_taxon + "&famille=" + URL.encodeComponent(famille) + "&location=" + URL.encodeComponent(loc) + "&id_location=" + id_location + "&date_observation=" + dat
+ "&station="+ URL.encodeComponent(milieu) + "&commentaire="+ URL.encodeComponent(comment),
 
new ResponseTextHandler() {
 
631,7 → 631,7
adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
}
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + URL.encodeComponent(location) +"/" + adate + "/" + search + "/" + URL.encodeComponent(station) + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + URL.encodeComponent(location) +"/" + adate + "/" + URL.encodeComponent(search) + "/" + URL.encodeComponent(station) + "/"
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
 
new ResponseTextHandler() {
655,6 → 655,7
for (i = 0; i < arraySize; ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
// Optimisation
if (i>=table.getRowCount()) {
row = table.insertRow(table.getRowCount());
}
670,7 → 671,7
table.setWidget(row, 0, new CheckBox());
// Observation transmise
// Statut Observation transmise ?
String atransmit=((JSONString) jsonArrayNested .get(11)).stringValue();
681,11 → 682,13
else {
table.setWidget(row,1,new HTML("&nbsp;"));
}
// Nom saisi
left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>");
left.append("<b>"+Util.toCelString(((JSONString) jsonArrayNested .get(0)).toString())+"</b>");
// Nom retenu
String aname=((JSONString) jsonArrayNested .get(2)).stringValue();
String aname=Util.toCelString(((JSONString) jsonArrayNested .get(2)).toString());
if (aname.compareTo("null")==0) {
}
716,7 → 719,7
}
 
// Famille
String afamily=((JSONString) jsonArrayNested .get(5)).stringValue();
String afamily=Util.toCelString(((JSONString) jsonArrayNested .get(5)).toString());
if (afamily.compareTo("null")==0) {
//
726,7 → 729,7
}
 
String aloc=((JSONString) jsonArrayNested .get(6)).stringValue();
String aloc=Util.toCelString(((JSONString) jsonArrayNested .get(6)).toString());
// Localisation - Lieu
if (aloc.compareTo("000null")==0) {
748,7 → 751,7
}
String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue();
String alieudit=Util.toCelString(((JSONString) jsonArrayNested .get(9)).toString());
// Localisation - Lieu dit
756,7 → 759,7
center.append(", "+alieudit);
}
String acomment=((JSONString) jsonArrayNested .get(10)).stringValue();
String acomment=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString());
// Commentaire
if (acomment.compareTo("null")!=0) {
1057,5 → 1060,8
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* $Log$
* Revision 1.7 2007-09-17 19:25:34 ddelon
* Documentation
*
*/
/trunk/src/org/tela_botanica/client/DateList.java
1,484 → 1,501
/**
David Delon david.delon@clapas.net 2007
*/
 
/*
* DateList.java : filtrage des releves par date d'observation
*
*
* 1: Le programme initialise les filtres communes, lieu-dit et dates)
*/
 
 
package org.tela_botanica.client;
 
 
 
import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SourcesTableEvents;
import com.google.gwt.user.client.ui.TableListener;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
/**
* A tree displaying a set of email folders.
*/
public class DateList extends Composite {
// Debut Barre de navigation
 
private class NavBar extends Composite implements ClickListener {
 
public final Button gotoFirst = new Button("&lt;&lt;", this);
public final Button gotoNext = new Button("&gt;", this);
public final Button gotoPrev = new Button("&lt;", this);
public final Button gotoEnd = new Button("&gt;&gt;", this);
public final HTML status = new HTML();
 
public NavBar() {
HorizontalPanel bar = new HorizontalPanel();
bar.setStyleName("navbar");
status.setStyleName("status");
bar.add(status);
bar.setCellHorizontalAlignment(status, HasHorizontalAlignment.ALIGN_RIGHT);
bar.setCellVerticalAlignment(status, HasVerticalAlignment.ALIGN_MIDDLE);
bar.setCellWidth(status, "100%");
 
bar.add(gotoFirst);
bar.add(gotoPrev);
bar.add(gotoNext);
bar.add(gotoEnd);
initWidget(bar);
}
 
public void onClick(Widget sender) {
if (sender == gotoNext) {
// Move forward a page.
startIndex += VISIBLE_DATE_COUNT;
if (startIndex >= count)
startIndex -= VISIBLE_DATE_COUNT;
} else {
if (sender == gotoPrev) {
// Move back a page.
startIndex -= VISIBLE_DATE_COUNT;
if (startIndex < 0)
startIndex = 0;
} else {
if (sender == gotoEnd) {
gotoEnd();
} else {
if (sender == gotoFirst) {
startIndex = 0;
}
}
}
}
update();
}
 
}
 
// Fin Barre de navigation
 
 
private static final int VISIBLE_DATE_COUNT = 10;
private static final String VALUE_UNKNOWN = "Inconnues";
 
private Grid header = new Grid(1, 2);
private Grid selector = new Grid(1, 2);
 
private FlexTable table = new FlexTable();
 
private VerticalPanel outer = new VerticalPanel();
private VerticalPanel inner = new VerticalPanel();
 
private int startIndex = 0;
 
private String user;
 
private String serviceBaseUrl = null;
 
private String location = "all";
private String date = "all";
 
private NavBar navBar=null;
 
private int count = 0;
// Tous selectionne
private int selectedRow = -1;
private Mediator mediator = null;
 
public DateList(Mediator med) {
mediator=med;
 
mediator.registerDateList(this);
 
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
navBar = new NavBar();
// Mise en forme du header
 
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
 
header.setStyleName("date-ListHeader");
 
header.setWidget(0, 1,navBar);
 
// header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme de l'entree "Toutes localites"
 
selector.setCellSpacing(0);
selector.setCellPadding(0);
selector.setWidth("100%");
 
selector.setHTML(0, 0, "Toutes");
 
selector.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Hook up events.
selector.addTableListener(new TableListener () {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
mediator.onDateSelected("all");
date="all";
}
 
});
selector.setStyleName("date-ListElement");
 
// Mise en forme du contenu
 
table.setCellSpacing(0);
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
table.setStyleName("date-ListElement");
 
outer.add(header);
inner.add(selector); // Toutes localit�s
inner.add(table);
inner.setStyleName("date-List");
inner.setWidth("100%");
outer.setWidth("100%");
outer.add(inner);
// Hook up events.
table.addTableListener(new TableListener () {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
selectRow(row);
String adate=table.getText(row,cell);
if (adate.compareTo(VALUE_UNKNOWN)!=0) {
date=adate;
mediator.onDateSelected(adate);
}
else {
date="00/00/0000";
mediator.onDateSelected("00/00/0000");
}
}
 
});
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
initWidget(outer);
 
 
}
 
/**
* Recherche nombre d'enregistrement pour l'utilisateur en cours
*
*
*/
public void updateCount() {
setStatusDisabled();
 
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/"+ station,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONNumber jsonNumber;
if ((jsonNumber = jsonValue.isNumber()) != null) {
count = (int) jsonNumber.getValue();
update();
}
}
});
 
}
 
private void selectRow(int row) {
styleRow(selectedRow, false);
styleRow(row, true);
 
selectedRow = row;
}
private void styleRow(int row, boolean selected) {
if (row != -1) {
selector.getRowFormatter().removeStyleName(0, "date-SelectedRow");
if (selected)
table.getRowFormatter().addStyleName(row, "date-SelectedRow");
else
if (row < table.getRowCount()) {
table.getRowFormatter().removeStyleName(row, "date-SelectedRow");
}
}
}
 
/**
*
* Mise a jour de l'affichage, a partir des donnees d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
* donnees seront affichees
*
*/
 
public void update() {
 
setStatusDisabled();
 
// HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + location + "/" + station + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) + "/"
+ startIndex + "/" + VISIBLE_DATE_COUNT,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
int row=0;
int i=0;
if ((jsonArray = jsonValue.isArray()) != null) {
int arraySize = jsonArray.size();
for (i = 0; i < arraySize; ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
if (i>=table.getRowCount()) {
row = table.insertRow(table.getRowCount());
}
else {
row = i;
}
// Lieu
String adate=((JSONString)jsonArrayNested.get(0)).stringValue();
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
table.setText(row, 0,adate);
}
else {
table.setText(row, 0,VALUE_UNKNOWN);
}
if ((adate.compareTo(date)==0) || ( date.compareTo("00/00/0000")==0) && adate.compareTo("0000-00-00 00:00:00")==0 ) {
styleRow(row, true);
}
else {
styleRow(row, false);
}
 
table.getFlexCellFormatter().setWidth(row, 0, "100%");
}
 
}
}
if (date.compareTo("all")==0) {
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
}
 
// Suppression fin ancien affichage
if (i<table.getRowCount()) {
for (int j = table.getRowCount() -1 ; j >= i; j--) {
table.removeRow(j);
}
}
 
setStatusEnabled();
 
 
}
});
 
}
 
public void setLocation(String location) {
this.location = location;
}
/*
* Positionnement index de parcours (this.startIndex) pour affichage de la
* derni�re page
*
* @param
* @return void
*/
 
private void gotoEnd() {
 
if ((count == 0) || (count % VISIBLE_DATE_COUNT) > 0) {
startIndex = count - (count % VISIBLE_DATE_COUNT);
} else {
startIndex = count - VISIBLE_DATE_COUNT;
}
 
}
/**
* Affichage message d'attente et d�sactivation navigation
*
* @param
* @return void
*/
 
private void setStatusDisabled() {
 
navBar.gotoFirst.setEnabled(false);
navBar.gotoPrev.setEnabled(false);
navBar.gotoNext.setEnabled(false);
navBar.gotoEnd.setEnabled(false);
 
navBar.status.setText("Patientez ...");
}
 
/**
* Affichage numero de page et gestion de la navigation
*
*/
 
private void setStatusEnabled() {
 
// Il y a forcemment un disabled avant d'arriver ici
 
if (count > 0) {
 
if (startIndex >= VISIBLE_DATE_COUNT) { // Au dela de la
// premiere page
navBar.gotoPrev.setEnabled(true);
navBar.gotoFirst.setEnabled(true);
if (startIndex < (count - VISIBLE_DATE_COUNT)) { // Pas la
// derniere
// page
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count );
} else { // Derniere page
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count );
}
} else { // Premiere page
if (count > VISIBLE_DATE_COUNT) { // Des pages derrieres
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
navBar.status.setText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count);
} else {
navBar.status.setText((startIndex + 1) + " - " + count + " sur " + count);
}
}
}
 
else { // Pas d'inventaire, pas de navigation
navBar.status.setText("0 - 0 sur 0");
}
}
 
 
 
public void setUser(String user) {
this.user = user;
}
 
public void setDate(String date) {
this.date = date;
}
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
*
*/
/*
* Copyright 2006 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package org.tela_botanica.client;
 
 
import com.google.gwt.http.client.URL;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONParser;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.SourcesTableEvents;
import com.google.gwt.user.client.ui.TableListener;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
/**
* A tree displaying a set of email folders.
*/
public class DateList extends Composite {
// 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);
 
public final Button gotoPrev = new Button("&lt;", this);
 
public final Button gotoEnd = new Button("&gt;&gt;", this);
 
public final HTML status = new HTML();
 
public NavBar() {
initWidget(bar);
bar.setStyleName("navbar");
status.setStyleName("status");
status.setWordWrap(false);
HorizontalPanel buttons = new HorizontalPanel();
buttons.add(status);
buttons.setCellHorizontalAlignment(status,
HasHorizontalAlignment.ALIGN_RIGHT);
buttons.setCellVerticalAlignment(status,
HasVerticalAlignment.ALIGN_MIDDLE);
buttons.setCellWidth(status, "100%");
 
 
buttons.add(gotoFirst);
buttons.add(gotoPrev);
buttons.add(gotoNext);
buttons.add(gotoEnd);
bar.add(buttons, DockPanel.EAST);
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_RIGHT);
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
 
bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
}
 
public void onClick(Widget sender) {
if (sender == gotoNext) {
// Move forward a page.
startIndex += VISIBLE_DATE_COUNT;
if (startIndex >= count)
startIndex -= VISIBLE_DATE_COUNT;
} else {
if (sender == gotoPrev) {
// Move back a page.
startIndex -= VISIBLE_DATE_COUNT;
if (startIndex < 0)
startIndex = 0;
} else {
if (sender == gotoEnd) {
gotoEnd();
} else {
if (sender == gotoFirst) {
startIndex = 0;
}
}
}
}
update();
}
 
}
 
 
 
private static final int VISIBLE_DATE_COUNT = 10;
private static final String VALUE_UNKNOWN = "Inconnues";
 
private Grid header = new Grid(1, 2);
private Grid selector = new Grid(1, 2);
 
private FlexTable table = new FlexTable();
 
private VerticalPanel outer = new VerticalPanel();
private VerticalPanel inner = new VerticalPanel();
 
private int startIndex = 0;
 
private String user;
 
private String serviceBaseUrl = null;
 
private String location = "all";
private String date = "all";
 
private NavBar navBar=null;
 
private int count = 65000;
// Tous selectionné
private int selectedRow = -1;
private Mediator mediator = null;
 
public DateList(Mediator med) {
mediator=med;
 
mediator.registerDateList(this);
 
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
navBar = new NavBar();
// Mise en forme du header
 
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
 
header.setStyleName("date-ListHeader");
 
header.setWidget(0, 1,navBar);
 
// header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme de l'entree "Toutes localités"
 
selector.setCellSpacing(0);
selector.setCellPadding(0);
selector.setWidth("100%");
 
selector.setHTML(0, 0, "Toutes");
 
selector.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Hook up events.
selector.addTableListener(new TableListener () {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
mediator.onDateSelected("all");
date="all";
}
 
});
selector.setStyleName("date-ListElement");
 
// Mise en forme du contenu
 
table.setCellSpacing(0);
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
table.setStyleName("date-ListElement");
 
outer.add(header);
inner.add(selector); // Toutes localités
inner.add(table);
inner.setStyleName("date-List");
inner.setWidth("100%");
outer.setWidth("100%");
outer.add(inner);
// Hook up events.
table.addTableListener(new TableListener () {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
selectRow(row);
String adate=table.getText(row,cell);
if (adate.compareTo(VALUE_UNKNOWN)!=0) {
date=adate;
mediator.onDateSelected(adate);
}
else {
date="00/00/0000";
mediator.onDateSelected("00/00/0000");
}
}
 
});
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
//updateCount();
// update()
initWidget(outer);
 
 
}
 
/**
* Recherche nombre d'enregistrement pour l'utilisateur en cours
*
*
*/
public void updateCount() {
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) ,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONNumber jsonNumber;
if ((jsonNumber = jsonValue.isNumber()) != null) {
count = (int) jsonNumber.getValue();
update();
}
}
});
 
}
 
private void selectRow(int row) {
styleRow(selectedRow, false);
styleRow(row, true);
 
selectedRow = row;
}
private void styleRow(int row, boolean selected) {
if (row != -1) {
selector.getRowFormatter().removeStyleName(0, "date-SelectedRow");
if (selected)
table.getRowFormatter().addStyleName(row, "date-SelectedRow");
else
if (row < table.getRowCount()) {
table.getRowFormatter().removeStyleName(row, "date-SelectedRow");
}
}
}
 
/**
*
* Mise a jour de l'affichage, à partir des données d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
*
*/
 
public void update() {
 
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" + URL.encodeComponent(location) + "/"
+ startIndex + "/" + VISIBLE_DATE_COUNT,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
int row=0;
int i=0;
if ((jsonArray = jsonValue.isArray()) != null) {
int arraySize = jsonArray.size();
for (i = 0; i < arraySize; ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
if (i>=table.getRowCount()) {
row = table.insertRow(table.getRowCount());
}
else {
row = i;
}
// Lieu
String adate=((JSONString)jsonArrayNested.get(0)).stringValue();
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
table.setText(row, 0,adate);
}
else {
table.setText(row, 0,VALUE_UNKNOWN);
}
if ((adate.compareTo(date)==0) || ( date.compareTo("00/00/0000")==0) && adate.compareTo("0000-00-00 00:00:00")==0 ) {
styleRow(row, true);
}
else {
styleRow(row, false);
}
 
table.getFlexCellFormatter().setWidth(row, 0, "100%");
}
 
}
}
if (date.compareTo("all")==0) {
selector.getRowFormatter().addStyleName(0, "date-SelectedRow");
}
 
// Suppression fin ancien affichage
if (i<table.getRowCount()) {
for (int j = table.getRowCount() -1 ; j >= i; j--) {
table.removeRow(j);
}
}
 
setStatusEnabled();
 
 
}
});
 
}
 
public void setLocation(String location) {
this.location = location;
}
/*
* Positionnement index de parcours (this.startIndex) pour affichage de la
* dernière page
*
* @param
* @return void
*/
 
private void gotoEnd() {
 
if ((count == 0) || (count % VISIBLE_DATE_COUNT) > 0) {
startIndex = count - (count % VISIBLE_DATE_COUNT);
} else {
startIndex = count - VISIBLE_DATE_COUNT;
}
 
}
/**
* Affichage message d'attente et désactivation navigation
*
* @param
* @return void
*/
 
private void setStatusDisabled() {
 
navBar.gotoFirst.setEnabled(false);
navBar.gotoPrev.setEnabled(false);
navBar.gotoNext.setEnabled(false);
navBar.gotoEnd.setEnabled(false);
 
setStatusText("Patientez ...");
}
 
/**
* Affichage numero de page et gestion de la navigation
*
*/
 
private void setStatusEnabled() {
 
// Il y a forcemment un disabled avant d'arriver ici
 
if (count > 0) {
 
if (startIndex >= VISIBLE_DATE_COUNT) { // Au dela de la
// premiere page
navBar.gotoPrev.setEnabled(true);
navBar.gotoFirst.setEnabled(true);
if (startIndex < (count - VISIBLE_DATE_COUNT)) { // Pas la
// derniere
// page
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
setStatusText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count );
} else { // Derniere page
setStatusText((startIndex + 1) + " - " + count + " sur " + count );
}
} else { // Premiere page
if (count > VISIBLE_DATE_COUNT) { // Des pages derrieres
navBar.gotoNext.setEnabled(true);
navBar.gotoEnd.setEnabled(true);
setStatusText((startIndex + 1) + " - "
+ (startIndex + VISIBLE_DATE_COUNT) + " sur " + count);
} else {
setStatusText((startIndex + 1) + " - " + count + " sur " + count);
}
}
}
 
else { // Pas d'inventaire, pas de navigation
setStatusText("0 - 0 sur 0");
}
}
 
 
 
private void setStatusText(String text) {
navBar.status.setText(text);
}
public void setUser(String user) {
this.user = user;
}
 
public void setDate(String date) {
this.date = date;
}
 
}
/trunk/src/org/tela_botanica/client/NameAssistant.java
17,7 → 17,7
import org.tela_botanica.client.AutoCompleteAsyncTextBox;
 
/**
* Affiche une liste de nom pour selection. Son retournés le nom selectionné (gettext()) et un code associé (getvalue()).
* Affiche une liste de nom pour selection. Son retourn�s le nom selectionn� (gettext()) et un code associ� (getvalue()).
*/
 
public class NameAssistant extends Composite implements EventListener, ResponseTextHandler {
54,7 → 54,7
if ((jsonArray = jsonValue.isArray()) != null) {
for (int i = 0; i < jsonArray.size(); ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
autoCompletebox.addItem(((JSONString) jsonArrayNested.get(0)).stringValue(),((JSONString) jsonArrayNested.get(1)).stringValue());
autoCompletebox.addItem(Util.toCelString(((JSONString) jsonArrayNested.get(0)).toString()),Util.toCelString(((JSONString) jsonArrayNested.get(1)).toString()));
}
}
}
/trunk/src/org/tela_botanica/client/InventoryItem.java
2,6 → 2,7
 
public class InventoryItem {
 
// TODO : Singleton ?
private String name=null;
private String nomenclaturalNumber=null;
8,13 → 9,26
private String location=null;
private String location_id=null;
private String date=null;
private String complementlocation=null;
private String milieu=null;
private String comment=null;
private String ordre=null;
 
 
public InventoryItem(String name,String nomenclaturalNumber, String location, String location_id, String date, String complementlocation, String comment,String ordre) {
// Constructeur
// Constructeur sur saisie
public InventoryItem() {
 
}
 
// Alimentation contenu depuis saisie
public void setContent(String name,String nomenclaturalNumber, String location, String location_id, String date, String milieu, String comment,String ordre) {
 
this.name=name;
this.nomenclaturalNumber=nomenclaturalNumber;
30,7 → 44,7
this.location_id=location_id;
this.date=date;
this.complementlocation=complementlocation;
this.milieu=milieu;
this.comment=comment;
this.ordre=ordre;
37,6 → 51,7
}
 
 
 
public String getLocation() {
return location;
}
62,8 → 77,8
}
 
 
public String getComplementlocation() {
return complementlocation;
public String getMilieu() {
return milieu;
}
 
 
/trunk/src/org/tela_botanica/client/Util.java
New file
0,0 → 1,12
package org.tela_botanica.client;
 
public class Util {
 
public Util() {
}
 
static String toCelString(String str) {
return str.substring(1,str.length()-1);
//
}
}
/trunk/src/org/tela_botanica/client/StationList.java
136,7 → 136,7
private int count = 65000;
// Tous selectionné
// Tous selectionn�
private int selectedRow = -1;
private Mediator mediator = null;
287,9 → 287,9
/**
*
* Mise a jour de l'affichage, à partir des données d'inventaire deja
* Mise a jour de l'affichage, � partir des donn�es d'inventaire deja
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
* donn�es seront affich�es
*
*/
 
325,7 → 325,7
row = i;
}
String astation=((JSONString)jsonArrayNested.get(0)).stringValue();
String astation=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString());
if (astation.compareTo("000null")!=0) {
table.setText(row, 0,astation);
376,7 → 376,7
/*
* Positionnement index de parcours (this.startIndex) pour affichage de la
* dernière page
* derni�re page
*
* @param
* @return void
394,7 → 394,7
/**
* Affichage message d'attente et désactivation navigation
* Affichage message d'attente et d�sactivation navigation
*
* @param
* @return void
/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java
20,10 → 20,9
package org.tela_botanica.client;
 
 
// TODO : traiter latence (augmenter en fonction rapidité saisie + texte vide)
// TODO : traiter latence (augmenter en fonction rapidit� saisie + texte vide)
// TODO : traitement espace apres l'espece (%20)
 
import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.ui.KeyboardListener;
/trunk/src/org/tela_botanica/client/InfoPopup.java
22,8 → 22,6
import com.google.gwt.json.client.JSONValue;
import com.google.gwt.user.client.HTTPRequest;
import com.google.gwt.user.client.ResponseTextHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
99,7 → 97,7
if (url.compareTo("null")!=0) {
// setPopupPosition(3*(Window.getClientWidth()/4), mediator.getInventoryItemList().getAbsoluteTop()+50);
setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop() + (mediator.getLeftPanel().getOffsetHeight()/2));
setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop() + (mediator.getLeftPanel().getOffsetHeight()/2)+50);
show();
imageTop.setUrl(url);
}
113,7 → 111,7
public void setImageBottom(String url) {
if (url.compareTo("null")!=0) {
// setPopupPosition(3*(Window.getClientWidth()/4), mediator.getInventoryItemList().getAbsoluteTop()+50);
setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop() + (mediator.getLeftPanel().getOffsetHeight()/2));
setPopupPosition(mediator.getLeftPanel().getAbsoluteLeft()+10, mediator.getLeftPanel().getAbsoluteTop() + (mediator.getLeftPanel().getOffsetHeight()/2) + 50);
show();
imageBottom.setUrl(url);
}
/trunk/src/org/tela_botanica/client/EntryPanel.java
55,9 → 55,12
private NameAssistant nameAssistant = null;
private LocationAssistant locationAssistant = null;
private TextBox date = new TextBox();
private TextBox complementLocation = new TextBox();
private TextBox lieudit = new TextBox();
private TextBox milieu = new TextBox();
private TextBox comment = new TextBox();
private Button dateSelector = new Button("...");
private Button validButton = new Button("Ajouter");
 
boolean visible=false;
private Mediator mediator=null;
72,58 → 75,109
public EntryPanel(final Mediator med) {
Grid inner = new Grid(3,4);
Grid observation = new Grid(4,4);
// Formatage affichage
for (int i=0; i<4;i++) {
observation.getCellFormatter().setWidth(i, 0, "3%");
observation.getCellFormatter().setWidth(i, 1, "47%");
observation.getCellFormatter().setWidth(i, 2, "3%");
observation.getCellFormatter().setWidth(i, 3, "47%");
}
 
mediator=med;
user=mediator.getUser();
 
// Declaration des elements du dialogue de saisie aupres du mediator
mediator.registerEntryPanel(this);
mediator.registerDate(date);
mediator.registerComment(comment);
mediator.registerComplementLocation(complementLocation);
mediator.registerMilieu(milieu);
mediator.registerLieudit(lieudit);
 
VerticalPanel outer = new VerticalPanel();
// Name assistant et location assistant : widget auto-completion sur nom scientifique ou commune
 
outer.add(new HTML("<b>Saisir&nbsp;un&nbsp;relev&eacute;&nbsp;:</b>"));
nameAssistant = new NameAssistant(mediator);
locationAssistant = new LocationAssistant(mediator);
 
 
for (int i=0; i<3;i++) {
inner.getCellFormatter().setWidth(i, 0, "3%");
inner.getCellFormatter().setWidth(i, 1, "47%");
inner.getCellFormatter().setWidth(i, 2, "3%");
inner.getCellFormatter().setWidth(i, 3, "47%");
}
// Saisie Commune
observation.setHTML(2,0,"Commune:&nbsp;");
observation.setWidget(2,1,locationAssistant);
locationAssistant.setWidth("100%");
 
 
// Saisie lieu-dit
observation.setHTML(2,2,"Lieu-dit:&nbsp;");
observation.setWidget(2,3,lieudit);
lieudit.setWidth("100%");
 
nameAssistant = new NameAssistant(mediator);
locationAssistant = new LocationAssistant(mediator);
 
// Saisie Nom
inner.setHTML(0,0,"Esp&egrave;ce:&nbsp;");
inner.setWidget(0,1,nameAssistant);
nameAssistant.setWidth("100%");
lieudit.addKeyboardListener( new KeyboardListener() {
 
// Saisie lieu
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
onValidateTextBox(lieudit);
}
 
}
public void onKeyUp(Widget arg0, char arg1, int arg2) { }
 
public void onKeyPress(Widget arg0, char arg1, int arg2) { }
}
);
 
 
// Saisie (milieu)
inner.setHTML(1,0,"Commune:&nbsp;");
inner.setWidget(1,1,locationAssistant);
observation.setHTML(3,0,"Milieu:&nbsp;");
observation.setWidget(3,1,milieu);
 
locationAssistant.setWidth("100%");
// Saisie Date
milieu.setWidth("100%");
 
// Validation par entree sur cette zone de texte
milieu.addKeyboardListener( new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
onValidateTextBox(milieu);
}
 
}
public void onKeyUp(Widget arg0, char arg1, int arg2) { }
 
public void onKeyPress(Widget arg0, char arg1, int arg2) { }
}
);
 
// Selecteur de Date
// Releve
 
dateSelector.addClickListener(new ClickListener () {
public void onClick(Widget w) {
159,16 → 213,25
}
});
 
inner.setHTML(2,0,"Date:&nbsp;");
// Saisie Espece
observation.setHTML(0,0,"Esp&egrave;ce:&nbsp;");
observation.setWidget(0,1,nameAssistant);
nameAssistant.setWidth("100%");
 
observation.setHTML(0,2,"Date:&nbsp;");
HorizontalPanel datePanel = new HorizontalPanel();
datePanel.add(date);
datePanel.add(dateSelector);
inner.setWidget(2,1,datePanel);
observation.setWidget(0,3,datePanel);
// Saisie date
// Validation par entree sur cette zone de texte
 
date.addKeyboardListener( new KeyboardListener() {
 
175,14 → 238,7
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
if (ordre==null) {
mediator.onAddInventoryItem();
date.setText("");
}
else {
mediator.onModifyInventoryItem(ordre);
ordre=null;
}
onValidateTextBox(date);
}
}
194,60 → 250,23
 
// Saisie Complement de lieu (station)
inner.setHTML(1,2,"Station:&nbsp;");
inner.setWidget(1,3,complementLocation);
 
complementLocation.setWidth("100%");
 
complementLocation.addKeyboardListener( new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
if (ordre==null) {
mediator.onAddInventoryItem();
complementLocation.setText("");
}
else {
mediator.onModifyInventoryItem(ordre);
ordre=null;
}
}
 
}
public void onKeyUp(Widget arg0, char arg1, int arg2) { }
 
public void onKeyPress(Widget arg0, char arg1, int arg2) { }
}
);
 
// Saisie Commentaire
inner.setHTML(2,2,"Notes:&nbsp;");
inner.setWidget(2,3,comment);
observation.setHTML(1,0,"Notes:&nbsp;");
observation.setWidget(1,1,comment);
 
comment.setWidth("100%");
 
 
// Validation par entree sur cette zone de texte
 
comment.addKeyboardListener( new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
if (ordre==null) {
mediator.onAddInventoryItem();
comment.setText("");
}
else {
mediator.onModifyInventoryItem(ordre);
ordre=null;
}
onValidateTextBox(comment);
}
 
}
258,15 → 277,16
}
);
Button validButton = new Button("Valider");
 
// Validation par click sur bouton valider
 
 
validButton.addClickListener(
new ClickListener() {
public void onClick(Widget w) {
// Numero ordre vide : ajout d'une observation
if (ordre==null) {
mediator.onAddInventoryItem();
}
285,10 → 305,10
actionPanel.add(validButton);
 
inner.setWidth("100%");
observation.setWidth("100%");
 
outer.add(inner);
outer.setCellWidth(inner, "100%");
outer.add(observation);
outer.setCellWidth(observation, "100%");
outer.setSpacing(10);
outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
311,17 → 331,13
 
if ((jsonArray = jsonValue.isArray()) != null) {
String aname = ((JSONString) jsonArray.get(0)).stringValue();
String aname = Util.toCelString(((JSONString) jsonArray.get(0)).toString());
// Nom
if (aname.compareTo("null")!=0) {
nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
nameAssistant.setText(aname);
// Numero nomenclatural
nameAssistant.setValue(anum);
}
}
339,17 → 355,23
}
 
/*
* Numero d'ordre du relev� affich�
* Numero d'ordre du releve affiche + mise à jour bouton
*
*/
public void setOrdre(String ordre) {
this.ordre = ordre;
if (ordre==null) {
this.validButton.setText("Ajouter");
}
else {
this.validButton.setText("Modifier");
}
}
 
 
/*
* Numero d'ordre du relev� affich�
* Numero d'ordre du releve affiche
*
*/
358,9 → 380,26
}
 
 
// Validation par entree sur cette zone de texte
private void onValidateTextBox(TextBox textbox) {
if (ordre==null) {
// Numero ordre vide : ajout d'une observation
mediator.onAddInventoryItem();
textbox.setText("");
}
else {
mediator.onModifyInventoryItem(ordre);
ordre=null;
}
 
}
 
/**
* Mise a jour de l'affichage a partir de donn�es deja saisie
* Mise a jour de l'affichage a partir de donnees deja saisie
*
*/
 
377,9 → 416,11
if ((jsonArray = jsonValue.isArray()) != null) {
// Nom saisi
nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
nameAssistant.setText(Util.toCelString(((JSONString) jsonArray.get(0)).toString()));
// Numero nomenclatural
String ann=((JSONString) jsonArray .get(3)).stringValue();
393,7 → 434,7
}
// Commune
String aloc=((JSONString) jsonArray .get(6)).stringValue();
String aloc=Util.toCelString(((JSONString) jsonArray .get(6)).toString());
if (aloc.compareTo("000null")!=0) {
locationAssistant.setText(aloc);
413,18 → 454,18
}
 
 
String astation=((JSONString) jsonArray .get(9)).stringValue();
String astation=Util.toCelString(((JSONString) jsonArray .get(9)).toString());
// Station
if (astation.compareTo("000null")!=0) {
complementLocation.setText(astation);
milieu.setText(astation);
}
else {
complementLocation.setText("");
milieu.setText("");
}
 
String acomment=((JSONString) jsonArray .get(10)).stringValue();
String acomment=Util.toCelString(((JSONString) jsonArray .get(10)).toString());
// Notes
if (acomment.compareTo("null")!=0) {
comment.setText(acomment);
450,6 → 491,9
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.7 2007-09-17 19:25:34 ddelon
* Documentation
*
* Revision 1.6 2007-06-06 13:29:30 ddelon
* v0.09
*
/trunk/src/org/tela_botanica/client/TopPanel.java
100,7 → 100,7
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
if ((jsonArray = jsonValue.isArray()) != null) {
user = ((JSONString) jsonArray.get(0)).stringValue(); // Identifiant utilisateur : identifant de session
user = Util.toCelString(((JSONString) jsonArray.get(0)).toString()); // Identifiant utilisateur : identifant de session
mediator.setConnected(((JSONBoolean) jsonArray.get(1)).booleanValue());
}
 
132,6 → 132,9
 
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* $Log$
* Revision 1.5 2007-09-17 19:25:34 ddelon
* Documentation
*
*
*/
/trunk/src/org/tela_botanica/client/SearchPanel.java
1,18 → 1,16
/**
David Delon david.delon@clapas.net 2007
*/
 
/*
* Copyright 2006 Google Inc.
* SearchPanel.java : recherche parmi les releves
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
* 1: Le programme affiche une zone de saisie pour recherche
* 2: Le programme arme l'action liee a l'envoi d'une recherche
*/
 
package org.tela_botanica.client;
 
 
95,3 → 93,11
 
 
}
 
/* +--Fin du code ---------------------------------------------------------------------------------------+
* $Log$
* Revision 1.5 2007-09-17 19:25:34 ddelon
* Documentation
*
*
*/
/trunk/src/org/tela_botanica/public/Cel.html
1,15 → 1,14
<html>
<head>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<!-- -->
<!-- Any title is fine -->
<!-- -->
<title>Carnet en ligne</title>
 
<!-- -->
<!-- Use normal html, such as style -->
<!-- -->
<style>
<style type="text/css" >
body,td,a,div,.p{font-family:arial,sans-serif}
div,td{color:#000000}
a:link,.w,.w a:link{color:#0000cc}
17,40 → 16,19
a:active{color:#ff0000}
</style>
<script type="text/javascript">
var Parameters = {
serviceBaseUrl: "http://192.168.0.32/david/jrest"
};
</script>
<script type="text/javascript">
var Parameters = {
serviceBaseUrl: "http://localhost/david/jrest"
};
</script>
 
<script type="text/javascript" language='javascript' src='org.tela_botanica.Cel.nocache.js'>
</script>
</head>
<body>
<!-- OPTIONAL: include this if you want history support -->
<iframe src="javascript:''" id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
 
 
<!-- -->
<!-- The module reference below is the link -->
<!-- between html and your Web Toolkit module -->
<!-- -->
<meta name='gwt:module' content='org.tela_botanica.Cel'>
</head>
 
<!-- -->
<!-- The body can have arbitrary html, or -->
<!-- you can leave the body empty if you want -->
<!-- to create a completely dynamic ui -->
<!-- -->
<body>
 
<!-- -->
<!-- This script is required bootstrap stuff. -->
<!-- You can put it in the HEAD, but startup -->
<!-- is slightly faster if you include it here. -->
<!-- -->
<script language="javascript" src="gwt.js"></script>
 
<!-- OPTIONAL: include this if you want history support -->
<iframe id="__gwt_historyFrame" style="width:0;height:0;border:0"></iframe>
 
</body>
</body>
</html>
/trunk/src/org/tela_botanica/public/tela.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/public/tela.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/src/org/tela_botanica/public/Cel.css
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream