Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

Ignore whitespace Rev 8 → Rev 9

/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java
104,10 → 104,12
* Here we fetch the URL and call the handler
*/
String rematch=match.replaceFirst(" ","/");
String rematch=match.replaceAll(" ","/");
rematch=rematch.replaceAll("%","");
if (this.searchUrl!=null && searching==false) {
searching=true;
// HTTPRequest.asyncGet(URL.encodeComponent(this.searchUrl) + rematch, responseTextHandler );
HTTPRequest.asyncGet(this.searchUrl + rematch, responseTextHandler );
 
}
/trunk/src/org/tela_botanica/client/TaxonList.java
15,6 → 15,9
*/
package org.tela_botanica.client;
 
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;
37,7 → 40,6
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.Window;
 
/*
* Le retour de getUser appelle getCount qui appelle update pour veiller à une
89,9 → 91,6
 
 
 
VerticalPanel actions = new VerticalPanel();
HorizontalPanel actionButton = new HorizontalPanel();
106,24 → 105,25
));
 
*/
actionButton.add(new Button("Suppression",
HTML delButton=new HTML("Suppression");
delButton.setStyleName("html_button");
delButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
deleteElement();
}
}
));
);
actionButton.add(delButton);
HTML exportButton=new HTML("<a href=\""+serviceBaseUrl+"/InventoryExport/" +user+"\">"+"Tout exporter</a>");
actionButton.add(exportButton);
exportButton.setStyleName("html_button");
 
actionButton.add(new Button("Tout exporter",
new ClickListener() {
public void onClick(Widget sender) {
exportAll();
}
}
));
actionButton.setSpacing(5);
 
actions.add(actionButton);
HorizontalPanel selections = new HorizontalPanel();
134,11 → 134,15
 
selections.add(new HTML("S&eacute;lection : "));
Label all = new Label("Tous,");
Label none = new Label("Aucun");
Label allLabel = new Label("Tous");
Label separatorLabel = new Label(",");
Label noneLabel = new Label("Aucun");
selections.add(all);
all.addClickListener(
allLabel.setStyleName("selection_label");
noneLabel.setStyleName("selection_label");
selections.add(allLabel);
allLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
selectAll();
146,8 → 150,10
}
);
selections.add(none);
none.addClickListener(
selections.add(separatorLabel);
selections.add(noneLabel);
noneLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
deselectAll();
154,7 → 160,8
}
}
);
bar.add(actions, DockPanel.WEST);
bar.setCellHorizontalAlignment(buttons, DockPanel.ALIGN_LEFT);
 
186,7 → 193,7
}
}
}
update();
update(true);
}
 
}
211,56 → 218,18
 
private String user;
 
private NavBar navBar = new NavBar();
private NavBar navBar=null;
 
int sizeChecked=0;
int itemDeleted=0;
public TaxonList() {
 
initAsync();
getUser(); // Appelle le reste des initialisations
initWidget(panel);
 
// 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);
 
initWidget(panel);
 
}
 
/**
275,7 → 244,19
 
setStatusDisabled();
 
// Saisie assistée
// 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, str);
table.getFlexCellFormatter().setWidth(row, 0, "2%");
table.getFlexCellFormatter()
.setWidth(row, 1, "31%");
// Recherche complement d'information
 
if (value !=null) {
 
309,6 → 290,9
else {
addElement(str, " ", " ", " ", " ", " ");
}
 
}
 
/**
347,8 → 331,14
new ResponseTextHandler() {
 
public void onCompletion(String str) {
gotoEnd();
update();
// (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);
}
}
});
}
362,24 → 352,34
 
setStatusDisabled();
boolean checked = false;
Vector parseChecked = new Vector();
 
// Lifo ...
for (int i = table.getRowCount() - 1; i >= 0; i--) {
if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
checked = true;
String str = table.getText(i, 6);
parseChecked.add(table.getText(i, 6));
count--;
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
+ "/" + str, "action=DELETE",
}
}
sizeChecked=parseChecked.size();
itemDeleted=0;
for (Iterator it = parseChecked.iterator(); it.hasNext();) {
itemDeleted++;
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
+ "/" + (String) it.next(), "action=DELETE",
new ResponseTextHandler() {
 
public void onCompletion(String str) {
gotoEnd();
update();
// On ne lance la suppression qu'a la fin
if (itemDeleted==sizeChecked) {
gotoEnd();
update(true);
}
}
});
 
}
}
if (!checked) {
setStatusEnabled();
417,8 → 417,52
*/
private void initAsync() {
 
getUser();
// getCount()
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()
 
}
429,7 → 473,6
*/
private void getUser() {
 
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/User/",
new ResponseTextHandler() {
440,7 → 483,7
if ((jsonString = jsonValue.isString()) != null) {
user = jsonString.stringValue();
}
getCount();
initAsync();
}
});
 
451,6 → 494,8
*
*/
private void getCount() {
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/",
new ResponseTextHandler() {
462,7 → 507,7
if ((jsonNumber = jsonValue.isNumber()) != null) {
count = (int) jsonNumber.getValue();
gotoEnd(); // Derniere page
update();
update(true);
}
}
});
476,13 → 521,19
*
*/
 
private void update() {
private void update(final boolean deep) {
 
setStatusDisabled();
 
// TODO : optimisation : ne supprimer que les lignes qui ne seront pas
// alimentes .
// 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 ...
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryList/" + user + "/"
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
 
495,13 → 546,21
JSONArray jsonArrayNested;
 
// Lifo ...
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
if (deep) {
for (int i = table.getRowCount() - 1; i >= 0; i--) {
table.removeRow(i);
}
}
 
int j = 0;
else {
table.removeRow(table.getRowCount());
}
if ((jsonArray = jsonValue.isArray()) != null) {
for (int i = 0; i < jsonArray.size(); ++i) {
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
536,7 → 595,6
table.getFlexCellFormatter().setWidth(row, 4, "9%");
table.getFlexCellFormatter()
.setWidth(row, 5, "18%");
j++;
}
 
}
636,17 → 694,5
 
}
 
/*
* Export du releve affiche dans un format tableur
*
* @param
* @return void
*/
 
private void exportAll() {
Window.open(serviceBaseUrl+"/InventoryExport/" +user + "/","_self","");
}
 
}
/trunk/src/org/tela_botanica/public/Cel.css
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/Cel.gwt.xml
2,8 → 2,12
 
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Parsing JSON -->
<inherits name='com.google.gwt.json.JSON' />
<!-- Passage de parametres -->
<inherits name="com.google.gwt.i18n.I18N"/>
<!-- URL encode et decode -->
<inherits name="com.google.gwt.http.HTTP"/>
 
<!-- Specify the app entry point class. -->
<entry-point class='org.tela_botanica.client.Cel'/>