Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

No changes between revisions

Ignore whitespace Rev 12 → Rev 13

/trunk/src/org/tela_botanica/client/InventoryItemList.java
30,6 → 30,8
import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
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.DockPanel;
import com.google.gwt.user.client.ui.Button;
38,7 → 40,6
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Label;
 
/*
* Le retour de getUser appelle updateCount qui appelle update pour veiller à une
97,108 → 98,10
bar.setVerticalAlignment(DockPanel.ALIGN_MIDDLE);
VerticalPanel actions = new VerticalPanel();
HorizontalPanel actionButton = new HorizontalPanel();
HTML addButton = new HTML("Nouvelle observation");
addButton.setStyleName("html_button");
addButton.addClickListener(
new ClickListener() {
public void onClick(Widget w) {
openEntryPanel();
}
}
);
 
actionButton.add(addButton);
HTML delButton=new HTML("Suppression");
delButton.setStyleName("html_button");
delButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
mediator.getInventoryItemList().deleteElement();
}
}
);
actionButton.add(delButton);
HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout exporter</a>");
actionButton.add(exportButton);
exportButton.setStyleName("html_button");
 
actionButton.setSpacing(5);
 
actions.add(actionButton);
 
HorizontalPanel selections = new HorizontalPanel();
selections.setSpacing(3);
 
selections.add(new HTML("S&eacute;lection : "));
Label allLabel = new Label("Tous");
Label separatorLabel = new Label(",");
Label noneLabel = new Label("Aucun");
allLabel.setStyleName("selection_label");
noneLabel.setStyleName("selection_label");
selections.add(allLabel);
allLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
selectAll();
}
}
);
selections.add(separatorLabel);
selections.add(noneLabel);
noneLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
deselectAll();
}
}
);
 
actionButton.add(selections);
 
 
bar.add(actions, DockPanel.WEST);
 
}
private void openEntryPanel() {
 
mediator.onEntryClick();
 
}
 
 
public void onClick(Widget sender) {
if (sender == gotoNext) {
// Move forward a page.
232,7 → 135,7
 
private static final int VISIBLE_TAXON_COUNT = 15;
 
private Grid header = new Grid(1, 7);
private Grid header = new Grid(1, 3);
 
private FlexTable table = new FlexTable();
 
250,8 → 153,13
private Mediator mediator = null;
 
private int selectedRow = -1;
private String location = "all";
private String date = "all";
private String search = "all";
 
private boolean add=false;
public InventoryItemList(Mediator med) {
 
276,22 → 184,8
 
header.setStyleName("inventoryItem-ListHeader");
 
header.setText(0, 0, "");
header.setHTML(0, 1, "Plante observ&eacute;e");
header.setHTML(0, 2, "R&eacute;f&eacute;rence retenue");
header.setHTML(0, 3, "R&eacute;f&eacute;rence<br>Nomenclaturale");
header.setHTML(0, 4, "R&eacute;f&eacute;rence<br>Taxonomique");
header.setText(0, 5, "Famille");
header.setText(0, 6, "Commune");
header.setWidget(0, 2, navBar);
 
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, "9%");
header.getCellFormatter().setWidth(0, 6, "9%");
 
// Mise en forme de la table.
 
table.setCellSpacing(0);
298,6 → 192,7
table.setBorderWidth(0);
table.setCellPadding(2);
table.setWidth("100%");
 
// Mise en forme barre navigation
 
305,11 → 200,26
 
table.setStyleName("inventoryItem-List");
 
panel.add(navBar);
//panel.add(navBar);
panel.add(header);
panel.add(table);
 
// Hook up events.
table.addTableListener(new TableListener () {
public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
if (table.getWidget(row, 0)!=null) {
selectRow(row);
// Numero d'ordre
mediator.onInventoryItemSelected(table.getText(row, 4));
}
}
 
});
//updateCount();
// update()
 
320,8 → 230,29
}
private void selectRow(int row) {
styleRow(selectedRow, false);
styleRow(row, true);
 
selectedRow = row;
}
private void styleRow(int row, boolean selected) {
if (row != -1) {
if (selected)
table.getRowFormatter().addStyleName(row, "inventoryItem-SelectedRow");
else
if (row < table.getRowCount()) {
table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
}
}
}
 
 
 
/**
339,7 → 270,63
}
 
// Action sur modification d'un element
public void updateElement() {
if (mediator.inventoryItemIsValid()) {
final InventoryItem inventoryItem=mediator.getInventoryItem();
setStatusDisabled();
if (inventoryItem.getNomenclaturalNumber() !=null) {
HTTPRequest.asyncGet(serviceBaseUrl + "/NameValid/" + inventoryItem.getNomenclaturalNumber(),
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
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), inventoryItem.getNomenclaturalNumber(),
((JSONString) jsonArray.get(0))
.stringValue(),
((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());
}
}
});
}
// Saisie libre
else {
updateElement(inventoryItem.getOrdre(),inventoryItem.getName(), " ", " ", " ", " ", " ",inventoryItem.getLocation(),inventoryItem.getLocation_id(),inventoryItem.getDate(),inventoryItem.getComplementlocation(),inventoryItem.getComment());
}
}
else {
return;
}
}
 
// Action sur ajout d'un element
public void addelement() {
422,7 → 409,6
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) {
 
// Calcul du nouveau numéro d'ordre
 
count++;
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/", "identifiant="
438,12 → 424,53
if (location.compareTo("")==0) {
location="000null";
}
add=true;
updateCount();
}
});
}
 
 
/**
* Modifie un element de l'inventaire
*
* @param ordre : numero d'ordre
* @param nom_sel :
* nom selectionne
* @param num_nom_sel :
* numero nomenclatural nom selectionne
* @param nom_ret :
* nom retenu
* @param num_nom_ret :
* numero nomenclaturel nom retenu
* @param num_taxon :
* numero taxonomique
* @param famille :
* famille
*/
 
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) {
 
 
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" +ordre + "/", "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,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
add=false;
update();
}
});
}
 
/**
* Suppression d'un element lde l'inventaire, a partir de son numero d'ordre
*
*/
461,7 → 488,7
if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
checked = true;
// Numero ordre
parseChecked.add(table.getText(i, 7));
parseChecked.add(table.getText(i, 4));
count--;
}
}
514,7 → 541,7
* Recherche nombre d'enregistrement pour l'utilisateur et la localite en cours
*
*/
public void updateCount() {
public void updateCount () {
setStatusDisabled();
523,7 → 550,7
adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
}
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location + "/" + adate ,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location + "/" + adate + "/" + search,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
547,6 → 574,11
});
 
}
private String subLeft(String text, int length) {
return (text.length() < length) ? text : text.substring(0, length)+ " ...";
}
 
/**
* Mise a jour de l'affichage, à partir des données d'inventaire deja
558,6 → 590,8
 
public void update() {
 
// table.setBorderWidth(1);
setStatusDisabled();
 
String adate="all";
564,8 → 598,39
if (date.compareTo("all")!=0) {
adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
}
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location +"/" + adate + "/"+
String com;
if (location.compareTo("all")==0) {
com="Toutes communes";
}
else {
if (location.compareTo("000null")==0) {
com="Communes non pr&eacute;cis&eacute;es";
}
else {
com="Commune de "+location;
}
}
 
String dat;
if (date.compareTo("all")==0) {
dat=", toute p&eacute;riode";
}
else {
if (date.compareTo("00/00/0000")==0) {
dat=", p&eacute;riode non pr&eacute;cis&eacute;";
}
else {
dat=", le "+ date;
}
}
header.setHTML(0, 0, com + dat );
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location +"/" + adate + "/" + search + "/" +
+ startIndex + "/" + VISIBLE_TAXON_COUNT,
 
new ResponseTextHandler() {
575,6 → 640,10
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
StringBuffer left=new StringBuffer();
StringBuffer center=new StringBuffer();
StringBuffer right=new StringBuffer();
 
int row=0;
590,31 → 659,33
row = i;
}
 
left=new StringBuffer();
center=new StringBuffer();
right=new StringBuffer();
// Case a cocher
table.setWidget(row, 0, new CheckBox());
// Nom saisi
 
left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>");
table.setText(row, 1, ((JSONString) jsonArrayNested
.get(0)).stringValue());
// Nom retenu
String aname=((JSONString) jsonArrayNested .get(2)).stringValue();
if (aname.compareTo("null")==0) {
table.setText(row, 2, "");
}
else {
table.setText(row, 2, aname);
center.append(aname+", ");
}
// Num nomenclatural
String ann=((JSONString) jsonArrayNested .get(3)).stringValue();
if (ann.compareTo("0")==0) {
table.setText(row, 3, "");
if (ann.compareTo("0")!=0) {
center.append(""+ann+"-");
}
else {
table.setText(row, 3, ann);
center.append("0-");
}
 
622,11 → 693,11
String ant=((JSONString) jsonArrayNested .get(4)).stringValue();
if (ant.compareTo("0")==0) {
table.setText(row, 4, "");
if (ant.compareTo("0")!=0) {
center.append(ant+", ");
}
else {
table.setText(row, 4, ann);
center.append("0, ");
}
 
// Famille
633,67 → 704,103
String afamily=((JSONString) jsonArrayNested .get(5)).stringValue();
if (afamily.compareTo("null")==0) {
table.setText(row, 5, "");
//
}
else {
table.setText(row, 5, afamily);
center.append(afamily+", ");
}
 
table.getFlexCellFormatter().setWidth(row, 0, "2%");
table.getFlexCellFormatter()
.setWidth(row, 1, "31%");
table.getFlexCellFormatter()
.setWidth(row, 2, "31%");
String aloc=((JSONString) jsonArrayNested .get(6)).stringValue();
// Localisation - Lieu
if (aloc.compareTo("000null")==0) {
if (center.length()==0) {
center.append("Commune absente");
}
else {
center.append("commune absente");
}
}
else {
if (center.length()==0) {
center.append("Commune de "+aloc);
}
else {
center.append("commune de "+aloc);
}
}
// TODO : Bool ici non ?
String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue();
// Affichage contenu commune si tout demandé.
// Localisation - Lieu dit
if (alieudit.compareTo("null")!=0) {
center.append(", "+alieudit);
}
String aloc=((JSONString) jsonArrayNested .get(6)).stringValue();
String acomment=((JSONString) jsonArrayNested .get(10)).stringValue();
// Commentaire
if (acomment.compareTo("null")!=0) {
center.append(", "+acomment);
}
if (location.compareTo("all")==0) {
 
// Localisation - Lieu
if (aloc.compareTo("000null")==0) {
table.setText(row, 6, "Inconnu");
String adate=((JSONString) jsonArrayNested .get(8)).stringValue();
// Date
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
right.append("<b>"+adate+"</b>");
}
else {
table.setText(row, 6, aloc );
// right.append("<b>00/00/0000</b>");
}
 
header.getCellFormatter().setVisible(0, 6,true);
table.getFlexCellFormatter().setWidth(row, 1, "31%");
table.getFlexCellFormatter().setWidth(row, 2, "31%");
 
table.getFlexCellFormatter().setWidth(row, 3, "9%");
table.getFlexCellFormatter().setWidth(row, 4, "9%");
table.getFlexCellFormatter().setWidth(row, 5, "9%");
table.getFlexCellFormatter().setWidth(row, 6, "9%");
 
}
else {
header.getCellFormatter().setVisible(0, 6,false);
table.getCellFormatter().setVisible(row, 6,false);
table.getFlexCellFormatter().setWidth(row, 1, "36%");
table.getFlexCellFormatter().setWidth(row, 2, "36%");
 
table.getFlexCellFormatter().setWidth(row, 3, "9%");
table.getFlexCellFormatter().setWidth(row, 4, "9%");
table.getFlexCellFormatter().setWidth(row, 5, "8%");
}
table.setHTML(row, 1, subLeft("&nbsp;"+left,40));
table.setHTML(row, 2, subLeft("&nbsp;"+center,120));
table.setHTML(row, 3, subLeft("&nbsp;"+right,25));
table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
table.getCellFormatter().setWordWrap(row,1,false);
table.getCellFormatter().setWidth(row,1,"10%");
table.getCellFormatter().setWordWrap(row,2,false);
table.getCellFormatter().setWordWrap(row,3,false);
table.getCellFormatter().setWidth(row,3,"7%");
String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
// Numero d'ordre (caché)
table.setText(row, 7, ((JSONString) jsonArrayNested
.get(7)).stringValue());
table.setText(row, 4, aordre);
 
table.getCellFormatter().setVisible(row, 7, false);
if (add){
if (i ==(arraySize -1)) {
selectRow(row);
mediator.getEntryPanel().setOrdre(aordre);
}
}
else {
if ((mediator.getEntryPanel().getOrdre()!=null) && (mediator.getEntryPanel().getOrdre().compareTo(aordre)==0)) {
selectRow(row);
}
}
 
table.getCellFormatter().setVisible(row, 4, false);
 
}
 
702,16 → 809,24
 
// Suppression fin ancien affichage
if (i<table.getRowCount()-1) {
for (int j = table.getRowCount() - 1; j > i-1; j--) {
table.removeRow(j);
}
for (int j=i;j<VISIBLE_TAXON_COUNT;j++) {
table.setHTML(j,0,"&nbsp;");
table.setHTML(j,1,"&nbsp;");
table.setHTML(j,2,"&nbsp;");
table.setHTML(j,3,"&nbsp;");
table.setHTML(j,4,"&nbsp;");
table.getCellFormatter().setVisible(j, 4, false);
table.getRowFormatter().removeStyleName(j, "inventoryItem-SelectedRow");
}
add=false;
 
setStatusEnabled();
}
});
 
}
 
794,6 → 909,17
}
 
/*
* Recherche en cours
*
*/
public void setSearch(String search) {
this.search = search;
}
 
 
/*
* Localite en cours
*
*/
/trunk/src/org/tela_botanica/client/DateList.java
128,9 → 128,9
private static final int VISIBLE_DATE_COUNT = 10;
private static final String VALUE_UNKNOWN = "Inconnues";
 
private Grid header = new Grid(1, 1);
private Grid header = new Grid(1, 2);
private Grid selector = new Grid(1, 1);
private Grid selector = new Grid(1, 2);
 
private FlexTable table = new FlexTable();
 
171,6 → 171,8
// Mise en forme du header
 
 
header.setCellSpacing(0);
header.setCellPadding(2);
header.setWidth("100%");
177,18 → 179,12
 
header.setStyleName("date-ListHeader");
 
String com;
if (location.compareTo("all")==0) {
com="toutes communes";
}
else {
com=location;
}
header.setHTML(0, 0, "Dates observations "+com); // yeah !
header.setWidget(0, 1,navBar);
 
header.getCellFormatter().setWidth(0, 0, "100%");
// header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme de l'entree "Toutes localités"
226,12 → 222,7
 
table.setStyleName("date-ListElement");
 
// Mise en forme barre navigation
outer.add(navBar);
navBar.setWidth("100%");
outer.add(header);
inner.add(selector); // Toutes localités
inner.add(table);
252,6 → 243,7
mediator.onDateSelected(table.getText(row,cell));
}
else {
date="00/00/0000";
mediator.onDateSelected("00/00/0000");
}
341,17 → 333,7
public void onCompletion(String str) {
String com;
if (location.compareTo("all")==0) {
com="toutes communes";
}
else {
com=location;
}
header.setHTML(0, 0, "Dates observations "+com); // yeah !
 
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
JSONArray jsonArrayNested;
380,7 → 362,7
table.setText(row, 0,VALUE_UNKNOWN);
}
if (adate.compareTo(date)==0) {
if ((adate.compareTo(date)==0) || ( date.compareTo("00/00/0000")==0) && adate.compareTo("0000-00-00 00:00:00")==0 ) {
styleRow(row, true);
}
else {
399,11 → 381,12
 
// Suppression fin ancien affichage
if (i<table.getRowCount()-1) {
for (int j = table.getRowCount() - 1; j > i-1; j--) {
if (i<table.getRowCount()) {
for (int j = table.getRowCount() -1 ; j >= i; j--) {
table.removeRow(j);
}
}
 
setStatusEnabled();
 
 
/trunk/src/org/tela_botanica/client/LeftPanel.java
16,8 → 16,7
package org.tela_botanica.client;
 
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.StackPanel;
 
import org.tela_botanica.client.LocationList;
 
31,7 → 30,6
 
public LeftPanel(Mediator mediator) {
 
HorizontalPanel inner = new HorizontalPanel();
dateList = new DateList(mediator);
locationList = new LocationList(mediator);
38,15 → 36,21
dateList.setStyleName("dateList");
locationList.setStyleName("locationList");
VerticalPanel outer = new VerticalPanel();
 
StackPanel outer = new StackPanel();
outer.add(inner);
outer.add(locationList);
outer.add(dateList);
outer.setCellHeight(inner,"100%");
outer.add(locationList,"Communes");
outer.add(dateList,"Dates");
 
// Create the groups within the stack panel.
outer.add(locationList, "<b>Localit&eacute;s</b>", true);
outer.add(dateList, "<b>Dates</b>", true);
 
outer.showStack(0);
initWidget(outer);
}
 
 
}
/trunk/src/org/tela_botanica/client/NameAssistant.java
65,7 → 65,11
}
 
 
public void setText(String str) {
autoCompletebox.setText(str);
}
 
 
public String getText() {
return autoCompletebox.getText();
}
75,6 → 79,10
return autoCompletebox.getValue();
}
 
public void setValue(String value) {
autoCompletebox.setValue(value);
}
 
}
/trunk/src/org/tela_botanica/client/InventoryItem.java
10,9 → 10,10
private String date=null;
private String complementlocation=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) {
public InventoryItem(String name,String nomenclaturalNumber, String location, String location_id, String date, String complementlocation, String comment,String ordre) {
 
this.name=name;
31,6 → 32,7
this.date=date;
this.complementlocation=complementlocation;
this.comment=comment;
this.ordre=ordre;
}
 
68,6 → 70,10
public String getDate() {
return date;
}
 
 
public String getOrdre() {
return ordre;
}
}
/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java
349,6 → 349,10
}
 
public void setValue(String value) {
this.currentValue=value;
}
 
}
/trunk/src/org/tela_botanica/client/EntryPanel.java
17,10 → 17,15
 
import java.util.Date;
 
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
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.Button;
import com.google.gwt.user.client.ui.ChangeListener;
import com.google.gwt.user.client.ui.CheckBox;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Grid;
28,9 → 33,7
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
 
38,7 → 41,7
* Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
*/
 
public class EntryPanel extends Composite implements ClickListener {
public class EntryPanel extends Composite {
private NameAssistant nameAssistant = null;
private LocationAssistant locationAssistant = null;
49,6 → 52,11
boolean visible=false;
Mediator mediator=null;
 
private String serviceBaseUrl = null;
private String user= null;
private String ordre =null;
final CalendarWidget calendar = new CalendarWidget();
private PopupPanel choicesPopup = new PopupPanel(true);
67,11 → 75,15
mediator.registerComplementLocation(complementLocation);
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
 
VerticalPanel outer = new VerticalPanel();
 
outer.add(new HTML("<b>Nouvelle observation:</b>"));
// outer.add(new HTML("<b>Nouvelle observation:</b>"));
 
121,7 → 133,7
visible=true;
choicesPopup.show();
choicesPopup.setPopupPosition(dateSelector.getAbsoluteLeft(),
dateSelector.getAbsoluteTop() + dateSelector.getOffsetHeight());
dateSelector.getAbsoluteTop() - dateSelector.getOffsetHeight() - choicesPopup.getOffsetHeight());
choicesPopup.setWidth(dateSelector.getOffsetWidth() + "px");
}
}
238,64 → 250,154
}
);
 
Button addButton = new Button("Ajout");
Button updateButton = new Button("Modification");
 
addButton.addClickListener(
new ClickListener() {
public void onClick(Widget w) {
mediator.onAddInventoryItem();
}
}
);
HorizontalPanel buttonPanel = new HorizontalPanel();
updateButton.addClickListener(
new ClickListener() {
public void onClick(Widget w) {
mediator.onModifyInventoryItem(ordre);
}
}
);
buttonPanel.add(addButton);
buttonPanel.add(updateButton);
 
inner.setWidth("100%");
 
outer.add(inner);
outer.setCellWidth(inner, "100%");
outer.setSpacing(20);
outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
outer.add(buttonPanel);
 
 
Button close = new Button("Cacher");
close.addClickListener(this);
 
outer.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
 
 
outer.add(close);
 
initWidget(outer);
setPixelSize(1000,200);
 
}
public void onClick(Widget sender) {
hide();
}
public void show() {
DOM.setStyleAttribute(getElement(), "backgroundColor", "white");
this.setOpacity(this,85);
RootPanel.get().remove(this);
RootPanel.get().add(this,200,200);
}
 
/*
* Numero d'ordre du relevé affiché
*
*/
public void hide() {
this.setOpacity(RootPanel.get(),100);
RootPanel.get().remove(this);
public void setOrdre(String ordre) {
this.ordre = ordre;
}
 
 
/*
* Numero d'ordre du relevé affiché
*
*/
private void setOpacity(UIObject e, int percentage) {
if ( percentage > 100 ) percentage = 100;
if ( percentage < 0 ) percentage = 0;
String opac;
if ( percentage == 100 ) opac = "1";
else if ( percentage == 0 ) opac = "0";
else if ( percentage < 10 ) opac = ".0" + percentage;
else opac = "." + percentage;
Element h = e.getElement();
DOM.setStyleAttribute(h, "filter", "alpha(opacity=" + percentage + ")");
DOM.setStyleAttribute(h, "opacity", opac);
public String getOrdre() {
return this.ordre;
}
 
 
/**
* Mise a jour de l'affichage a partir de données deja saisie
*
*/
 
public void update() {
 
HTTPRequest.asyncGet(serviceBaseUrl + "/Inventory/" + user + "/" + ordre,
 
new ResponseTextHandler() {
 
public void onCompletion(String str) {
 
JSONValue jsonValue = JSONParser.parse(str);
JSONArray jsonArray;
if ((jsonArray = jsonValue.isArray()) != null) {
// Nom saisi
nameAssistant.setText(((JSONString) jsonArray.get(0)).stringValue());
// Numero nomenclatural
String ann=((JSONString) jsonArray .get(3)).stringValue();
if (ann.compareTo("0")!=0) {
nameAssistant.setValue(ann);
}
// Commune
String aloc=((JSONString) jsonArray .get(6)).stringValue();
if (aloc.compareTo("000null")!=0) {
locationAssistant.setText(aloc);
}
else {
locationAssistant.setText("");
}
String adate=((JSONString) jsonArray .get(8)).stringValue();
// Date
if (adate.compareTo("0000-00-00 00:00:00")!=0) {
date.setText(adate);
}
else {
date.setText("");
}
 
 
String astation=((JSONString) jsonArray .get(9)).stringValue();
// Station
if (astation.compareTo("null")!=0) {
complementLocation.setText(astation);
}
else {
complementLocation.setText("");
}
 
String acomment=((JSONString) jsonArray .get(10)).stringValue();
// Notes
if (acomment.compareTo("null")!=0) {
comment.setText(acomment);
}
else {
comment.setText("");
}
}
 
}
});
 
}
 
 
}
/trunk/src/org/tela_botanica/client/SearchPanel.java
New file
0,0 → 1,103
/*
* 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.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;
 
/**
* Composite permet de wrapper des Widget pour creer un nouveau Widget cf methode initWidget()
*/
 
public class SearchPanel extends Composite {
Mediator mediator=null;
private String serviceBaseUrl = null;
private String user= null;
private TextBox search = null;
 
 
public SearchPanel(final Mediator med) {
 
HorizontalPanel outer=new HorizontalPanel();
mediator=med;
 
mediator.registerSearchPanel(this);
search = new TextBox();
// Recherche
HTML searchButton=new HTML("Rechercher");
searchButton.setStyleName("html_button");
searchButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
mediator.onSearch(search.getText());
}
}
);
search.addKeyboardListener( new KeyboardListener() {
 
public void onKeyDown(Widget arg0, char arg1, int arg2) {
if(arg1 == KEY_ENTER)
{
mediator.onSearch(search.getText());
}
 
}
public void onKeyUp(Widget arg0, char arg1, int arg2) {
}
 
public void onKeyPress(Widget arg0, char arg1, int arg2) {
}
}
);
 
outer.setSpacing(5);
outer.add(search);
outer.add(searchButton);
user=mediator.getUser();
serviceBaseUrl = mediator.getServiceBaseUrl();
 
 
initWidget(outer);
}
 
 
}
/trunk/src/org/tela_botanica/client/ActionPanel.java
New file
0,0 → 1,116
/*
* 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.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HTML;
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 {
Mediator mediator=null;
 
 
public ActionPanel(final Mediator med) {
mediator=med;
mediator.registerActionPanel(this);
HorizontalPanel outer = new HorizontalPanel();
outer.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
// Suppression d'elements
HTML delButton=new HTML("Suppression");
delButton.setStyleName("html_button");
delButton.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().deleteElement();
}
}
);
outer.add(delButton);
 
// Export de la totalité
HTML exportButton=new HTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" +mediator.getUser()+"\">"+"Tout exporter</a>");
outer.add(exportButton);
exportButton.setStyleName("html_button");
 
outer.setSpacing(5);
 
// Selections de l'affichage
HorizontalPanel selections = new HorizontalPanel();
selections.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
selections.setSpacing(3);
 
selections.add(new HTML("S&eacute;lection : "));
Label allLabel = new Label("Tous");
Label separatorLabel = new Label(",");
Label noneLabel = new Label("Aucun");
allLabel.setStyleName("selection_label");
noneLabel.setStyleName("selection_label");
selections.add(allLabel);
allLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().selectAll();
}
}
);
selections.add(separatorLabel);
selections.add(noneLabel);
noneLabel.addClickListener(
new ClickListener() {
public void onClick(Widget sender) {
// TODO : une action dans le mediator
mediator.getInventoryItemList().deselectAll();
}
}
);
 
outer.add(selections);
 
initWidget(outer);
this.setStyleName("action-Panel");
}
}
/trunk/src/org/tela_botanica/client/CenterPanel.java
23,7 → 23,6
inventoryItemList.setStyleName("inventoryItemList");
 
VerticalPanel outer = new VerticalPanel();
outer.add(inventoryItemList);
inventoryItemList.setWidth("100%");
 
/trunk/src/org/tela_botanica/client/Cel.java
1,9 → 1,13
package org.tela_botanica.client;
 
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.WindowResizeListener;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
 
 
 
10,7 → 14,7
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class Cel implements EntryPoint {
public class Cel implements EntryPoint, WindowResizeListener {
 
private TopPanel topPanel = null;
17,7 → 21,10
private CenterPanel centerPanel = null;
private LeftPanel leftPanel = null;
private EntryPanel entryPanel = null;
private ActionPanel actionPanel = null;
private SearchPanel searchPanel = null;
private VerticalPanel rightPanel = null;
private Mediator mediator = null;
 
 
38,19 → 45,39
 
centerPanel = new CenterPanel(mediator);
topPanel = new TopPanel(mediator);
leftPanel = new LeftPanel(mediator);
 
entryPanel = new EntryPanel(mediator);
actionPanel = new ActionPanel(mediator);
searchPanel = new SearchPanel(mediator);
rightPanel = new VerticalPanel();
// Information haut de page (nom application, connexion ... etc).
// A regler
entryPanel.setStyleName("item-Input");
rightPanel.add(searchPanel);
rightPanel.add(actionPanel);
rightPanel.add(centerPanel);
rightPanel.add(entryPanel);
rightPanel.setWidth("100%");
centerPanel.setWidth("100%");
entryPanel.setWidth("100%");
topPanel.setWidth("100%");
 
 
rightPanel.setSpacing(2);
// DockPanel permet d'arranger plusieurs panneaux au coins cardinaux, le panneau central remplissant
// l'espace laissé.
57,11 → 84,10
DockPanel outer = new DockPanel();
outer.add(topPanel, DockPanel.NORTH);
outer.add(centerPanel, DockPanel.CENTER);
outer.add(rightPanel, DockPanel.CENTER);
outer.add(leftPanel, DockPanel.WEST);
// outer.add(bottomPanel, DockPanel.SOUTH);
centerPanel.setWidth("100%");
// LeftPanel :
// Pour l'instant : relevés.
68,7 → 94,7
outer.setWidth("100%");
 
outer.setSpacing(4);
outer.setCellWidth(centerPanel, "85%");
outer.setCellWidth(rightPanel, "100%");
// Window.enableScrolling(false);
Window.setMargin("0px");
75,16 → 101,35
 
mediator.onInit();
entryPanel.show();
RootPanel.get().add(outer);
 
 
// Call the window resized handler to get the initial sizes setup. Doing
// this in a deferred command causes it to occur after all widgets' sizes
// have been computed by the browser.
DeferredCommand.add(new Command() {
public void execute() {
onWindowResized(Window.getClientWidth(), Window.getClientHeight());
}
});
 
 
}
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;
if (shortcutHeight < 1)
shortcutHeight = 1;
leftPanel.setHeight("" + shortcutHeight);
 
}
 
 
 
}
/trunk/src/org/tela_botanica/client/LocationList.java
128,7 → 128,7
private static final int VISIBLE_LOCATION_COUNT = 10;
private static final String VALUE_UNKNOWN = "Inconnues";
 
private Grid header = new Grid(1, 1);
private Grid header = new Grid(1, 2);
private Grid selector = new Grid(1, 1);
 
177,11 → 177,10
header.setStyleName("location-ListHeader");
 
header.setHTML(0, 0, "Relev&eacute;s par commune&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"); // yeah !
header.setWidget(0, 1,navBar);
 
header.getCellFormatter().setWidth(0, 0, "100%");
 
 
// Mise en forme de l'entree "Toutes localités"
 
selector.setCellSpacing(0);
218,8 → 217,6
 
// Mise en forme barre navigation
outer.add(navBar);
navBar.setWidth("100%");
outer.add(header);
271,7 → 268,7
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user ,
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/" + location ,
new ResponseTextHandler() {
 
public void onCompletion(String str) {
324,7 → 321,7
setStatusDisabled();
 
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/"
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/" + location + "/"
+ startIndex + "/" + VISIBLE_LOCATION_COUNT,
 
new ResponseTextHandler() {
378,11 → 375,12
 
// Suppression fin ancien affichage
if (i<table.getRowCount()-1) {
for (int j = table.getRowCount() - 1; j > i-1; j--) {
if (i<table.getRowCount()) {
for (int j = table.getRowCount() -1 ; j >= i; j--) {
table.removeRow(j);
}
}
 
setStatusEnabled();
 
 
/trunk/src/org/tela_botanica/client/Mediator.java
24,6 → 24,8
private LocationAssistant locationAssistant=null;
private InventoryItem inventoryItem=null;
private EntryPanel entryPanel=null;
private ActionPanel actionPanel=null;
private SearchPanel searchPanel=null;
private TextBox date = null;
private TextBox complementLocation = null;
62,12 → 64,37
}
/**
* Action sur selection d'une observation : affichage du detail
*/
public void onInventoryItemSelected(String ordre) {
entryPanel.setOrdre(ordre);
entryPanel.update();
}
 
public void onEntryClick() {
/**
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants
*/
public void onSearch(String search) {
if (search.trim().compareTo("")==0) {
search="all";
}
inventoryItemList.setSearch(search);
inventoryItemList.updateCount();
this.entryPanel.show();
}
 
/**
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants
*/
78,16 → 105,13
inventoryItemList.setDate("all");
inventoryItemList.updateCount();
if (entryPanel!=null) {
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
}
else {
locationAssistant.setText(loc);
}
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
}
else {
locationAssistant.setText(loc);
}
}
 
102,7 → 126,6
inventoryItemList.updateCount();
 
/*
if (entryPanel!=null) {
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
111,7 → 134,6
locationAssistant.setText(loc);
}
}
*/
}
151,12 → 173,25
public void onAddInventoryItem() {
// TODO : singleton ?
registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText()));
registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText(),"null"));
inventoryItemList.addelement();
}
 
/**
* Action prealable à 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
278,7 → 313,19
this.entryPanel=entryPanel;
}
 
public void registerActionPanel(ActionPanel actionPanel) {
this.actionPanel=actionPanel;
}
 
public void registerSearchPanel(SearchPanel searchPanel) {
this.searchPanel=searchPanel;
}
 
 
/**
* Declaration commentaire
* @param commentaire
/trunk/src/org/tela_botanica/public/date.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/public/date.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/src/org/tela_botanica/public/com.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/public/com.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
/trunk/src/org/tela_botanica/public/fond.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/src/org/tela_botanica/public/fond.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property