Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

No changes between revisions

Ignore whitespace Rev 10 → Rev 9

/trunk/src/org/tela_botanica/client/LocationAssistant.java
File deleted
\ No newline at end of file
/trunk/src/org/tela_botanica/client/LocationList.java
File deleted
/trunk/src/org/tela_botanica/client/Mediator.java
File deleted
/trunk/src/org/tela_botanica/client/LeftPanel.java
File deleted
/trunk/src/org/tela_botanica/client/TaxonList.java
18,6 → 18,7
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;
41,7 → 42,7
import com.google.gwt.user.client.ui.Label;
 
/*
* Le retour de getUser appelle updateCount qui appelle update pour veiller à une
* Le retour de getUser appelle getCount qui appelle update pour veiller à une
* initialisation correcte
*
*/
192,7 → 193,7
}
}
}
update();
update(true);
}
 
}
211,7 → 212,7
 
private int startIndex = 0;
 
private String serviceBaseUrl = null;
private String serviceBaseUrl = getServiceBaseUrl();
 
private int count = 65000;
 
218,86 → 219,14
private String user;
 
private NavBar navBar=null;
private Mediator mediator = null;
// Optimization
 
int sizeChecked=0;
int itemDeleted=0;
// 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;
public TaxonList() {
 
private String location = "all";
public TaxonList(Mediator med) {
 
mediator=med;
getUser(); // Appelle le reste des initialisations
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);
 
 
311,75 → 240,59
* @return void
*/
public void onValidate(SourcesAutoCompleteAsyncTextBoxEvents sender,
String str, String value) {
// Le nom de plante est requis
final String str,final String value) {
 
setStatusDisabled();
 
// On met a jour rapidement l'affichage puis on lance la requete ....
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();
int row = table.insertRow(table.getRowCount());
// Case a cocher
table.setWidget(row, 0, new CheckBox());
// Nom saisi
table.setText(row, 1, str);
// 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
table.getFlexCellFormatter().setWidth(row, 0, "2%");
table.getFlexCellFormatter()
.setWidth(row, 1, "31%");
if (nameValue !=null) {
// 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, " ", " ", " ", " ", " ");
}
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);
}
}
 
/**
400,7 → 313,7
*/
 
public 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 num_nom_ret, String num_taxon, String famille) {
 
// Calcul du nouveau numéro d'ordre
 
413,13 → 326,19
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,
+ "&num_taxon=" + num_taxon + "&famille=" + famille,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
location=loc;
updateCount();
// (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);
}
}
});
}
441,6 → 360,7
checked = true;
parseChecked.add(table.getText(i, 6));
count--;
}
}
sizeChecked=parseChecked.size();
452,9 → 372,10
new ResponseTextHandler() {
public void onCompletion(String str) {
// Optimisation : on ne lance la suppression qu'a la fin
// On ne lance la suppression qu'a la fin
if (itemDeleted==sizeChecked) {
updateCount();
gotoEnd();
update(true);
}
}
});
485,16 → 406,98
}
 
 
/**
*
* 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 nombre d'enregistrement pour l'utilisateur et la localite en cours
* Recherche utilisateur en cours
*
*/
public void updateCount() {
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() {
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryTaxonList/" + user + "/" + location,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
504,13 → 507,7
if ((jsonNumber = jsonValue.isNumber()) != null) {
count = (int) jsonNumber.getValue();
gotoEnd(); // Derniere page
if (count==0) {
location="all";
}
if (location.compareTo("")==0)
location="000null";
mediator.onTaxonListUpdate(location);
update();
update(true);
}
}
});
522,10 → 519,9
* saisies. La valeur de this.startIndex permet de determiner quelles
* données seront affichées
*
* @param deep : force une mise a jour totale
*/
 
public void update() {
private void update(final boolean deep) {
 
setStatusDisabled();
 
538,7 → 534,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 + "/InventoryTaxonList/" + user + "/" + location +"/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/"
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
 
new ResponseTextHandler() {
549,13 → 545,22
JSONArray jsonArray;
JSONArray jsonArrayNested;
 
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
// Lifo ...
if (deep) {
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
595,13 → 600,23
}
}
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
*
679,21 → 694,5
 
}
 
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/InventoryList.java
New file
0,0 → 1,38
/*
* 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.Tree;
import com.google.gwt.user.client.ui.TreeItem;
 
/**
* A tree displaying a set of email folders.
*/
public class InventoryList extends Composite {
 
private Tree tree = new Tree();
 
public InventoryList() {
TreeItem root = new TreeItem("G&eacute;n&eacute;ral");
tree.addItem(root);
 
root.setState(true);
initWidget(tree);
}
 
}
/trunk/src/org/tela_botanica/client/NameAssistant.java
59,17 → 59,7
}
 
 
 
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,10 → 60,6
protected Vector items = new Vector();
protected boolean popupAdded = false;
protected boolean visible = false;
/**
* Value linked to current text
*/
protected String currentValue = null;
344,12 → 340,6
{
return (Vector) cache.get(query.toLowerCase());
}
 
 
 
public String getValue() {
return currentValue;
}
 
 
/trunk/src/org/tela_botanica/client/Shortcuts.java
New file
0,0 → 1,44
/*
* 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.StackPanel;
 
import org.tela_botanica.client.InventoryList;
 
/**
* A composite that contains the shortcut stack panel on the left side. The
* mailbox tree and shortcut lists don't actually do anything, but serve to show
* how you can construct an interface using
* {@link com.google.gwt.user.client.ui.StackPanel},
* {@link com.google.gwt.user.client.ui.Tree}, and other custom widgets.
*/
public class Shortcuts extends Composite {
 
private StackPanel stackPanel = new StackPanel();
 
public Shortcuts() {
// Create the groups within the stack panel.
stackPanel.add(new InventoryList(), "Relev&eacute;s", true);
 
// Show the mailboxes group by default.
stackPanel.showStack(0);
 
initWidget(stackPanel);
}
 
}
/trunk/src/org/tela_botanica/client/CenterPanel.java
15,61 → 15,32
 
public class CenterPanel extends Composite {
 
private TaxonList taxonList = null;
private NameAssistant nameAssistant = null;
private LocationAssistant locationAssistant = null;
private TaxonList taxonList = new TaxonList();
private NameAssistant nameAssistant = new NameAssistant(taxonList);
 
 
public CenterPanel(Mediator mediator) {
 
taxonList = new TaxonList(mediator);
nameAssistant = new NameAssistant(taxonList);
locationAssistant = new LocationAssistant(taxonList);
 
public CenterPanel() {
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%");
 
namePanel.add(new HTML("Nom:&nbsp;"),DockPanel.WEST);
namePanel.add (nameAssistant,DockPanel.CENTER);
inner.add(new HTML("Nom:&nbsp;"),DockPanel.WEST);
inner.add (nameAssistant,DockPanel.CENTER);
nameAssistant.setWidth("100%");
namePanel.setCellWidth(nameAssistant,"100%");
namePanel.setWidth("100%");
locationPanel.add(new HTML("Lieu:&nbsp;"),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%");
 
nameAssistant.setWidth("40%");
inner.setCellWidth(nameAssistant,"100%");
inner.setWidth("100%");
outer.add(inner);
outer.add(taxonList);
inner.setWidth("100%");
taxonList.setWidth("100%");
 
initWidget(outer);
}
}
 
/trunk/src/org/tela_botanica/client/Cel.java
1,6 → 1,7
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;
7,7 → 8,7
 
import org.tela_botanica.client.TopPanel;
import org.tela_botanica.client.CenterPanel;
import org.tela_botanica.client.LeftPanel;
import org.tela_botanica.client.Shortcuts;
 
 
 
16,36 → 17,17
*/
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
59,10 → 41,10
DockPanel outer = new DockPanel();
outer.add(topPanel, DockPanel.NORTH);
outer.add(centerPanel, DockPanel.CENTER);
outer.add(leftPanel, DockPanel.WEST);
outer.add(shortcuts, DockPanel.WEST);
centerPanel.setWidth("100%");
// LeftPanel :
// Shortcuts :
// Pour l'instant : relevés.
outer.setWidth("100%");
84,13 → 66,20
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 - leftPanel.getAbsoluteTop() - 8;
int shortcutHeight = height - shortcuts.getAbsoluteTop() - 8;
if (shortcutHeight < 1)
shortcutHeight = 1;
leftPanel.setHeight("" + shortcutHeight);
shortcuts.setHeight("" + shortcutHeight);
 
}
public String getServiceBaseUrl() {
Dictionary theme = Dictionary.getDictionary("Parameters");
return theme.get("serviceBaseUrl");
 
}
 
}
/trunk/src/org/tela_botanica/public/Cel.css
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream