Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

No changes between revisions

Ignore whitespace Rev 9 → Rev 10

/trunk/src/org/tela_botanica/client/InventoryList.java
File deleted
/trunk/src/org/tela_botanica/client/Shortcuts.java
File deleted
/trunk/src/org/tela_botanica/client/CenterPanel.java
15,32 → 15,61
 
public class CenterPanel extends Composite {
 
private TaxonList taxonList = new TaxonList();
private NameAssistant nameAssistant = new NameAssistant(taxonList);
private TaxonList taxonList = null;
private NameAssistant nameAssistant = null;
private LocationAssistant locationAssistant = null;
 
 
public CenterPanel() {
public CenterPanel(Mediator mediator) {
 
taxonList = new TaxonList(mediator);
nameAssistant = new NameAssistant(taxonList);
locationAssistant = new LocationAssistant(taxonList);
 
taxonList.setNameProvider(nameAssistant);
taxonList.setLocationProvider(locationAssistant);
VerticalPanel outer = new VerticalPanel();
DockPanel inner = new DockPanel();
DockPanel namePanel = new DockPanel();
DockPanel locationPanel = new DockPanel();
nameAssistant.setWidth("50%");
 
inner.add(new HTML("Nom: "),DockPanel.WEST);
inner.add (nameAssistant,DockPanel.CENTER);
namePanel.add(new HTML("Nom: "),DockPanel.WEST);
namePanel.add (nameAssistant,DockPanel.CENTER);
nameAssistant.setWidth("40%");
inner.setCellWidth(nameAssistant,"100%");
inner.setWidth("100%");
nameAssistant.setWidth("100%");
namePanel.setCellWidth(nameAssistant,"100%");
namePanel.setWidth("100%");
locationPanel.add(new HTML("Lieu: "),DockPanel.WEST);
locationPanel.add (locationAssistant,DockPanel.CENTER);
locationAssistant.setWidth("100%");
locationPanel.setCellWidth(locationAssistant,"100%");
locationPanel.setWidth("100%");
inner.add(namePanel,DockPanel.WEST);
inner.add(locationPanel,DockPanel.CENTER);
inner.setCellWidth(namePanel,"50%");
inner.setCellWidth(locationPanel,"50%");
 
outer.add(inner);
outer.add(taxonList);
inner.setWidth("100%");
taxonList.setWidth("100%");
 
initWidget(outer);
}
}
 
/trunk/src/org/tela_botanica/client/LocationAssistant.java
New file
0,0 → 1,81
package org.tela_botanica.client;
 
 
 
import java.util.EventListener;
 
 
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.json.client.JSONArray;
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.ResponseTextHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
 
 
import org.tela_botanica.client.AutoCompleteAsyncTextBox;
 
/**
* A composite that displays a list of locations that can be selected.
*/
 
public class LocationAssistant extends Composite implements EventListener, ResponseTextHandler {
 
private AutoCompleteAsyncTextBox autoCompletebox = new AutoCompleteAsyncTextBox(this);
private HorizontalPanel panel = new HorizontalPanel();
public LocationAssistant(AutoCompleteAsyncTextBoxListener listener) {
 
// autoCompletebox.setFocus(true);
autoCompletebox.setSearchUrl(getServiceBaseUrl()+"/LocationSearch/");
panel.add(autoCompletebox);
 
autoCompletebox.setWidth("100%");
initWidget(panel);
autoCompletebox.addAutoCompleteAsyncTextBoxListener(listener);
 
}
 
public void onCompletion(String str) {
JSONValue jsonValue= JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
 
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.displayList();
}
 
public String getText() {
return autoCompletebox.getText();
}
 
 
public String getValue() {
return autoCompletebox.getValue();
}
 
 
public String getServiceBaseUrl() {
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
}
/trunk/src/org/tela_botanica/client/Cel.java
1,7 → 1,6
package org.tela_botanica.client;
 
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel;
8,7 → 7,7
 
import org.tela_botanica.client.TopPanel;
import org.tela_botanica.client.CenterPanel;
import org.tela_botanica.client.Shortcuts;
import org.tela_botanica.client.LeftPanel;
 
 
 
17,17 → 16,36
*/
public class Cel implements EntryPoint {
 
private TopPanel topPanel = new TopPanel();
private CenterPanel centerPanel = new CenterPanel();
private Shortcuts shortcuts = new Shortcuts();
 
private TopPanel topPanel = null;
private CenterPanel centerPanel = null;
private LeftPanel leftPanel = null;
 
private Mediator mediator = null;
 
 
/**
* This is the entry point method.
*/
public void onModuleLoad() {
 
 
mediator= new Mediator();
mediator.registerCel(this);
mediator.initUser();
}
public void initAsync() {
 
topPanel = new TopPanel();
centerPanel = new CenterPanel(mediator);
leftPanel = new LeftPanel(mediator);
 
// Information haut de page (nom application, connexion ... etc).
// A regler
41,10 → 59,10
DockPanel outer = new DockPanel();
outer.add(topPanel, DockPanel.NORTH);
outer.add(centerPanel, DockPanel.CENTER);
outer.add(shortcuts, DockPanel.WEST);
outer.add(leftPanel, DockPanel.WEST);
centerPanel.setWidth("100%");
// Shortcuts :
// LeftPanel :
// Pour l'instant : relevés.
outer.setWidth("100%");
66,20 → 84,13
public void onWindowResized(int width, int height) {
// Adjust the shortcut panel and detail area to take up the available room
// in the window.
int shortcutHeight = height - shortcuts.getAbsoluteTop() - 8;
int shortcutHeight = height - leftPanel.getAbsoluteTop() - 8;
if (shortcutHeight < 1)
shortcutHeight = 1;
shortcuts.setHeight("" + shortcutHeight);
leftPanel.setHeight("" + shortcutHeight);
 
}
public String getServiceBaseUrl() {
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
 
}
/trunk/src/org/tela_botanica/client/LocationList.java
New file
0,0 → 1,264
/*
* 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.json.client.JSONArray;
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.Composite;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.SourcesTableEvents;
import com.google.gwt.user.client.ui.TableListener;
import com.google.gwt.user.client.ui.VerticalPanel;
 
/**
* A tree displaying a set of email folders.
*/
public class LocationList extends Composite {
 
 
private static final int VISIBLE_LOCATION_COUNT = 15;
private static final String VALUE_UNKNOWN = "Inconnues";
 
private Grid header = new Grid(1, 1);
private Grid selector = new Grid(1, 1);
 
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";
// Tous selectionné
private int selectedRow = -1;
private Mediator mediator = null;
 
public LocationList(Mediator med) {
mediator=med;
 
mediator.registerLocationList(this);
 
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
// Mise en forme du header
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
 
header.setStyleName("location-ListHeader");
 
header.setHTML(0, 0, "Localit&eacute;s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); // yeah !
 
header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme du selecteur
 
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, "location-SelectedRow");
mediator.onLocationSelected("all");
}
 
});
selector.setStyleName("location-ListElement");
 
// Mise en forme de la table.
 
table.setCellSpacing(0);
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
table.setStyleName("location-ListElement");
 
// Mise en forme barre navigation
 
outer.add(header);
inner.add(selector);
inner.add(table);
inner.setStyleName("location-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 loc=table.getText(row,cell);
if (loc.compareTo(VALUE_UNKNOWN)!=0) {
mediator.onLocationSelected(table.getText(row,cell));
}
else {
mediator.onLocationSelected("000null");
}
}
 
});
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "location-SelectedRow");
mediator.onLocationSelected("all");
update();
initWidget(outer);
 
 
}
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, "location-SelectedRow");
if (selected)
table.getRowFormatter().addStyleName(row, "location-SelectedRow");
else
if (row < table.getRowCount()) {
table.getRowFormatter().removeStyleName(row, "location-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() {
 
 
// TODO : ne pas recreer la table a chaque fois ... : parcouris le retour, le comparer au present
// et inserer ou supprimer s'il le faut.
 
// TODO : ou alors prevoir un update pour les ajouts (forcemment à la fin) et un update pour les suppressions ...
// Sauf qu'il y a les chgts de pages ... : oui, la un fait un update normal ...
// TODO : despaghettiser
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/"
+ startIndex + "/" + VISIBLE_LOCATION_COUNT,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
 
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
}
if (location.compareTo("all")==0) {
styleRow(selectedRow, false);
selector.getRowFormatter().addStyleName(0, "location-SelectedRow");
}
 
if ((jsonArray = jsonValue.isArray()) != null) {
int arraySize = jsonArray.size();
for (int i = 0; i < arraySize; ++i) {
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
int row = table.insertRow(table.getRowCount());
// Lieu
String loc=((JSONString)jsonArrayNested.get(0)).stringValue();
if (loc.compareTo("000null")!=0) {
table.setText(row, 0,loc);
}
else {
table.setText(row, 0,VALUE_UNKNOWN);
}
if (loc.compareTo(location)==0) {
styleRow(row, true);
}
 
table.getFlexCellFormatter().setWidth(row, 0, "100%");
}
 
}
}
 
}
});
 
}
 
public void setLocation(String location) {
this.location = location;
}
 
}
/trunk/src/org/tela_botanica/client/Mediator.java
New file
0,0 → 1,157
package org.tela_botanica.client;
 
 
// TODO : sortie User vers une classe ...
// TODO : sortie les boutons supprimer et exporter et inclure ici
 
import com.google.gwt.i18n.client.Dictionary;
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;
 
public class Mediator {
private String serviceBaseUrl = getServiceBaseUrlFromDictionnary();
private String user = null;
private TaxonList taxonlist = null;
private LocationList locationList = null;
private Cel cel = null;
 
Mediator() {
}
/**
* Recuperation information utilisateur
*
*/
public void initUser() {
getUserFromService();
}
/**
* Action sur selection d'un lieu
*
*/
public void onLocationSelected(String loc) {
taxonlist.setLocation(loc);
taxonlist.updateCount();
}
/**
* Action sur ajout d'un taxon
*/
public void onTaxonListUpdate(String loc) {
 
locationList.setLocation(loc);
locationList.update();
}
/**
* Enregistrement TaxonList
* @param taxonlist
*/
public void registerTaxonList(TaxonList taxonlist) {
this.taxonlist=taxonlist;
}
/**
* Enregistremnt LocationList
* @param locationList
*/
public void registerLocationList(LocationList locationList) {
this.locationList=locationList;
}
/**
* Enregistrement Cel
* @param cel
*/
 
public void registerCel(Cel cel) {
this.cel=cel;
}
 
 
/**
* Recherche distante et asynchrone de l'utilisateur connecté, en retour lancement methode initialisation
* de l'appellant Cel. (initAsunc)
*
*/
private void getUserFromService() {
 
 
HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONString jsonString;
if ((jsonString = jsonValue.isString()) != null) {
user = jsonString.stringValue();
}
cel.initAsync();
}
});
 
}
/**
* Accesseur Url de base
* @return Url de base
*/
public String getServiceBaseUrl() {
return serviceBaseUrl;
 
}
 
/**
* 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 connecté ou identifiant de session
*/
public String getUser() {
return user;
}
 
 
 
}
/trunk/src/org/tela_botanica/client/TaxonList.java
18,7 → 18,6
import java.util.Iterator;
import java.util.Vector;
 
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONParser;
42,7 → 41,7
import com.google.gwt.user.client.ui.Label;
 
/*
* Le retour de getUser appelle getCount qui appelle update pour veiller à une
* Le retour de getUser appelle updateCount qui appelle update pour veiller à une
* initialisation correcte
*
*/
193,7 → 192,7
}
}
}
update(true);
update();
}
 
}
212,7 → 211,7
 
private int startIndex = 0;
 
private String serviceBaseUrl = getServiceBaseUrl();
private String serviceBaseUrl = null;
 
private int count = 65000;
 
219,14 → 218,86
private String user;
 
private NavBar navBar=null;
 
private Mediator mediator = null;
// Optimization
int sizeChecked=0;
int itemDeleted=0;
public TaxonList() {
// Data provider
private NameAssistant nameProvider=null;
private LocationAssistant locationProvider=null;
// Data from provider
private String nameText=null;
private String nameValue=null;
private String locationText=null;
private String locationValue=null;
 
getUser(); // Appelle le reste des initialisations
private String location = "all";
public TaxonList(Mediator med) {
 
mediator=med;
mediator.registerTaxonList(this);
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
navBar = new NavBar();
 
// Information complementaire : un tableau associe au retour de
// l'assistant de saisie
 
// Mise en forme du header
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
 
header.setStyleName("taxon-ListHeader");
 
header.setText(0, 0, "");
header.setText(0, 1, "Nom saisi");
header.setText(0, 2, "Nom retenu");
header.setHTML(0, 3, "Code<br>Nomenclatural");
header.setHTML(0, 4, "Code<br>Taxonomique");
header.setText(0, 5, "Famille");
 
header.getCellFormatter().setWidth(0, 0, "2%");
header.getCellFormatter().setWidth(0, 1, "31%");
header.getCellFormatter().setWidth(0, 2, "31%");
header.getCellFormatter().setWidth(0, 3, "9%");
header.getCellFormatter().setWidth(0, 4, "9%");
header.getCellFormatter().setWidth(0, 5, "18%");
 
// Mise en forme de la table.
 
table.setCellSpacing(0);
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
// Mise en forme barre navigation
 
navBar.setWidth("100%");
 
table.setStyleName("taxon-List");
 
panel.add(navBar);
panel.add(header);
panel.add(table);
 
updateCount();
// update()
 
initWidget(panel);
 
 
240,59 → 311,75
* @return void
*/
public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
final String str,final String value) {
 
setStatusDisabled();
 
// On met a jour rapidement l'affichage puis on lance la requete ....
String str, String value) {
// Le nom de plante est requis
int row = table.insertRow(table.getRowCount());
// Case a cocher
table.setWidget(row, 0, new CheckBox());
// Nom saisi
table.setText(row, 1, str);
if (nameProvider.getText().compareTo("")==0) {
return;
}
nameText=nameProvider.getText();
nameValue=nameProvider.getValue();
locationValue=locationProvider.getValue();
locationText=locationProvider.getText();
// Suppresion indication departementale (on pourrait faire mieux !!)
int pos=locationText.indexOf("(" );
if (pos>=0) {
locationText=locationText.substring(0,pos);
}
setStatusDisabled();
table.getFlexCellFormatter().setWidth(row, 0, "2%");
table.getFlexCellFormatter()
.setWidth(row, 1, "31%");
// On met a jour rapidement l'affichage puis on lance la requete ....
int row = table.insertRow(table.getRowCount());
// Case a cocher
table.setWidget(row, 0, new CheckBox());
// Nom saisi
table.setText(row, 1, nameText);
table.getFlexCellFormatter().setWidth(row, 0, "2%");
table.getFlexCellFormatter()
.setWidth(row, 1, "31%");
// Recherche complement d'information
// Recherche complement d'information
 
if (value !=null) {
 
 
HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + value,
new ResponseTextHandler() {
 
public void onCompletion(String strcomplete) {
 
JSONValue jsonValue = JSONParser.parse(strcomplete);
JSONArray jsonArray;
 
if ((jsonArray = jsonValue.isArray()) != null) {
// Nom retenu, Num Nomen nom retenu, Num Taxon,
// Famille
addElement(str, value,
((JSONString) jsonArray.get(0))
.stringValue(),
((JSONString) jsonArray.get(1))
.stringValue(),
((JSONString) jsonArray.get(2))
.stringValue(),
((JSONString) jsonArray.get(3))
.stringValue());
}
}
 
});
}
// Saisie libre
else {
addElement(str, " ", " ", " ", " ", " ");
}
if (nameValue !=null) {
 
HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + nameValue,
new ResponseTextHandler() {
public void onCompletion(String strcomplete) {
JSONValue jsonValue = JSONParser.parse(strcomplete);
JSONArray jsonArray;
if ((jsonArray = jsonValue.isArray()) != null) {
// Nom retenu, Num Nomen nom retenu, Num Taxon,
// Famille
addElement(nameText, nameValue,
((JSONString) jsonArray.get(0))
.stringValue(),
((JSONString) jsonArray.get(1))
.stringValue(),
((JSONString) jsonArray.get(2))
.stringValue(),
((JSONString) jsonArray.get(3))
.stringValue(),
locationText,locationValue);
}
}
});
}
// Saisie libre
else {
addElement(nameText, " ", " ", " ", " ", " ",locationText,locationValue);
}
}
 
/**
313,7 → 400,7
*/
 
public void addElement(String nom_sel, String num_nom_sel, String nom_ret,
String num_nom_ret, String num_taxon, String famille) {
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location) {
 
// Calcul du nouveau numéro d'ordre
 
326,19 → 413,13
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,
+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
// (Optimisation) Si on reste sur la meme page : ajout à la fin
if (((count-2)/VISIBLE_TAXON_COUNT)==(count-1/VISIBLE_TAXON_COUNT)) {
update(false);
}
else {
gotoEnd();
update(true);
}
location=loc;
updateCount();
}
});
}
360,7 → 441,6
checked = true;
parseChecked.add(table.getText(i, 6));
count--;
}
}
sizeChecked=parseChecked.size();
372,10 → 452,9
new ResponseTextHandler() {
public void onCompletion(String str) {
// On ne lance la suppression qu'a la fin
// Optimisation : on ne lance la suppression qu'a la fin
if (itemDeleted==sizeChecked) {
gotoEnd();
update(true);
updateCount();
}
}
});
406,98 → 485,16
}
 
 
/**
*
* Lancement des initialisations dependantes de réponses asynchrones : le
* retour d'une demande d'initialisation declanche la demande
* d'initialisation suivantes user : resultat recherche nom d'utilisateur
* count : resultat nombre d'enregistrements d'inventaires affichage
* enregistrements trouvés
*
*/
private void initAsync() {
 
navBar = new NavBar();
 
// Information complementaire : un tableau associe au retour de
// l'assistant de saisie
 
// Mise en forme du header
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
 
header.setStyleName("taxon-ListHeader");
 
header.setText(0, 0, "");
header.setText(0, 1, "Nom saisi");
header.setText(0, 2, "Nom retenu");
header.setHTML(0, 3, "Code<br>Nomenclatural");
header.setHTML(0, 4, "Code<br>Taxonomique");
header.setText(0, 5, "Famille");
 
header.getCellFormatter().setWidth(0, 0, "2%");
header.getCellFormatter().setWidth(0, 1, "31%");
header.getCellFormatter().setWidth(0, 2, "31%");
header.getCellFormatter().setWidth(0, 3, "9%");
header.getCellFormatter().setWidth(0, 4, "9%");
header.getCellFormatter().setWidth(0, 5, "18%");
 
// Mise en forme de la table.
 
table.setCellSpacing(0);
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
// Mise en forme barre navigation
 
navBar.setWidth("100%");
 
table.setStyleName("taxon-List");
 
panel.add(navBar);
panel.add(header);
panel.add(table);
 
getCount();
// update()
 
}
 
/**
* Recherche utilisateur en cours
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
*
*/
private void getUser() {
 
 
HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
JSONValue jsonValue = JSONParser.parse(str);
JSONString jsonString;
if ((jsonString = jsonValue.isString()) != null) {
user = jsonString.stringValue();
}
initAsync();
}
});
 
}
 
/**
* Recherche nombre d'enregistrement pour l'utilisateur en cours
*
*/
private void getCount() {
public void updateCount() {
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/",
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryTaxonList/" + user + "/" + location,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
507,7 → 504,13
if ((jsonNumber = jsonValue.isNumber()) != null) {
count = (int) jsonNumber.getValue();
gotoEnd(); // Derniere page
update(true);
if (count==0) {
location="all";
}
if (location.compareTo("")==0)
location="000null";
mediator.onTaxonListUpdate(location);
update();
}
}
});
519,9 → 522,10
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
*
* @param deep : force une mise a jour totale
*/
 
private void update(final boolean deep) {
public void update() {
 
setStatusDisabled();
 
534,7 → 538,7
// TODO : ou alors prevoir un update pour les ajouts (forcemment à la fin) et un update pour les suppressions ...
// Sauf qu'il y a les chgts de pages ... : oui, la un fait un update normal ...
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryTaxonList/" + user + "/" + location +"/"
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
 
new ResponseTextHandler() {
545,22 → 549,13
JSONArray jsonArray;
JSONArray jsonArrayNested;
 
// Lifo ...
if (deep) {
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
}
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
}
else {
table.removeRow(table.getRowCount());
}
if ((jsonArray = jsonValue.isArray()) != null) {
int arraySize = jsonArray.size();
for (int i = 0; i < arraySize; ++i) {
if (!deep && i != arraySize -1) {
continue;
}
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) {
int row = table.insertRow(table.getRowCount());
// Case a cocher
600,23 → 595,13
}
}
setStatusEnabled();
 
}
});
 
}
 
/**
* Recuperation du prefixe d'appel des services
*/
 
private String getServiceBaseUrl() {
 
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
 
/**
* Affichage message d'attente et désactivation navigation
*
694,5 → 679,21
 
}
 
public void setNameProvider(NameAssistant nameAssistant) {
this.nameProvider = nameAssistant;
}
 
public void setLocationProvider(LocationAssistant locationAssistant) {
this.locationProvider = locationAssistant;
}
 
public void setLocation(String location) {
this.location = location;
}
 
 
}
/trunk/src/org/tela_botanica/client/LeftPanel.java
New file
0,0 → 1,41
/*
* 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.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel;
 
import org.tela_botanica.client.LocationList;
 
/**
*/
 
public class LeftPanel extends Composite {
 
private LocationList locationList = null;
private TaxonList taxonList = null;
 
public LeftPanel(Mediator mediator) {
 
locationList = new LocationList(mediator);
VerticalPanel outer = new VerticalPanel();
outer.add(locationList);
 
initWidget(outer);
}
 
}
/trunk/src/org/tela_botanica/client/NameAssistant.java
59,7 → 59,17
}
 
 
 
public String getText() {
return autoCompletebox.getText();
}
 
 
public String getValue() {
return autoCompletebox.getValue();
}
 
 
public String getServiceBaseUrl() {
Dictionary theme = Dictionary.getDictionary("Parameters");
/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java
60,6 → 60,10
protected Vector items = new Vector();
protected boolean popupAdded = false;
protected boolean visible = false;
/**
* Value linked to current text
*/
protected String currentValue = null;
340,6 → 344,12
{
return (Vector) cache.get(query.toLowerCase());
}
 
 
 
public String getValue() {
return currentValue;
}
 
 
/trunk/src/org/tela_botanica/public/Cel.css
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream