/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; |
} |
70,4 → 72,8 |
} |
public String getOrdre() { |
return ordre; |
} |
} |
/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java |
---|
349,7 → 349,11 |
} |
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"); |
} |
} |
239,63 → 251,153 |
); |
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); |
initWidget(outer); |
outer.add(close); |
} |
initWidget(outer); |
/* |
* Numero d'ordre du relevé affiché |
* |
*/ |
setPixelSize(1000,200); |
public void setOrdre(String ordre) { |
this.ordre = ordre; |
} |
/* |
* Numero d'ordre du relevé affiché |
* |
*/ |
public String getOrdre() { |
return this.ordre; |
} |
public void onClick(Widget sender) { |
hide(); |
/** |
* 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(); |
public void show() { |
if (aloc.compareTo("000null")!=0) { |
locationAssistant.setText(aloc); |
} |
else { |
locationAssistant.setText(""); |
} |
DOM.setStyleAttribute(getElement(), "backgroundColor", "white"); |
this.setOpacity(this,85); |
RootPanel.get().remove(this); |
RootPanel.get().add(this,200,200); |
String adate=((JSONString) jsonArray .get(8)).stringValue(); |
// Date |
if (adate.compareTo("0000-00-00 00:00:00")!=0) { |
date.setText(adate); |
} |
else { |
date.setText(""); |
} |
public void hide() { |
this.setOpacity(RootPanel.get(),100); |
RootPanel.get().remove(this); |
String astation=((JSONString) jsonArray .get(9)).stringValue(); |
// Station |
if (astation.compareTo("null")!=0) { |
complementLocation.setText(astation); |
} |
else { |
complementLocation.setText(""); |
} |
private void setOpacity(UIObject e, int percentage) { |
if ( percentage > 100 ) percentage = 100; |
if ( percentage < 0 ) percentage = 0; |
String acomment=((JSONString) jsonArray .get(10)).stringValue(); |
// Notes |
if (acomment.compareTo("null")!=0) { |
comment.setText(acomment); |
} |
else { |
comment.setText(""); |
} |
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); |
} |
}); |
} |
} |
/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é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; |
39,10 → 46,15 |
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 |
49,8 → 61,23 |
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,9 → 177,8 |
header.setStyleName("location-ListHeader"); |
header.setHTML(0, 0, "Relevés par commune "); // yeah ! |
header.setWidget(0, 1,navBar); |
header.getCellFormatter().setWidth(0, 0, "100%"); |
// Mise en forme de l'entree "Toutes localités" |
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; |
63,15 → 65,40 |
} |
public void onEntryClick() { |
this.entryPanel.show(); |
/** |
* Action sur selection d'une observation : affichage du detail |
*/ |
public void onInventoryItemSelected(String ordre) { |
entryPanel.setOrdre(ordre); |
entryPanel.update(); |
} |
/** |
* 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(); |
} |
/** |
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants |
*/ |
public void onLocationSelected(String loc) { |
inventoryItemList.setLocation(loc); |
78,7 → 105,6 |
inventoryItemList.setDate("all"); |
inventoryItemList.updateCount(); |
if (entryPanel!=null) { |
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) { |
locationAssistant.setText(""); |
89,9 → 115,7 |
} |
} |
/** |
* Action sur selection d'une date : affichage de la liste des taxons correspondants |
*/ |
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,13 → 173,26 |
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 |
279,6 → 314,18 |
} |
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/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,109 → 98,11 |
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é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. |
startIndex += VISIBLE_TAXON_COUNT; |
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,9 → 153,14 |
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) { |
mediator=med; |
276,22 → 184,8 |
header.setStyleName("inventoryItem-ListHeader"); |
header.setText(0, 0, ""); |
header.setHTML(0, 1, "Plante observée"); |
header.setHTML(0, 2, "Référence retenue"); |
header.setHTML(0, 3, "Référence<br>Nomenclaturale"); |
header.setHTML(0, 4, "Réfé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); |
299,6 → 193,7 |
table.setCellPadding(2); |
table.setWidth("100%"); |
// Mise en forme barre navigation |
navBar.setWidth("100%"); |
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() |
321,9 → 231,30 |
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"); |
} |
} |
} |
/** |
* Action lancee par la selection d'un nom dans l'assistant de saisie. Lance |
* la recherche d'informations complémentaires (famille, numero |
340,6 → 271,62 |
} |
// 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--; |
} |
} |
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) { |
548,6 → 575,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 |
* saisies. La valeur de this.startIndex permet de determiner quelles |
558,6 → 590,8 |
public void update() { |
// table.setBorderWidth(1); |
setStatusDisabled(); |
String adate="all"; |
565,7 → 599,38 |
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écisées"; |
} |
else { |
com="Commune de "+location; |
} |
} |
String dat; |
if (date.compareTo("all")==0) { |
dat=", toute période"; |
} |
else { |
if (date.compareTo("00/00/0000")==0) { |
dat=", période non précisé"; |
} |
else { |
dat=", le "+ date; |
} |
} |
header.setHTML(0, 0, com + dat ); |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location +"/" + adate + "/" + search + "/" + |
+ startIndex + "/" + VISIBLE_TAXON_COUNT, |
new ResponseTextHandler() { |
576,7 → 641,11 |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
StringBuffer left=new StringBuffer(); |
StringBuffer center=new StringBuffer(); |
StringBuffer right=new StringBuffer(); |
int row=0; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
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 |
table.setText(row, 1, ((JSONString) jsonArrayNested |
.get(0)).stringValue()); |
left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>"); |
// 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,68 → 704,104 |
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 |
// TODO : Bool ici non ? |
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); |
} |
// Affichage contenu commune si tout demandé. |
} |
String aloc=((JSONString) jsonArrayNested .get(6)).stringValue(); |
if (location.compareTo("all")==0) { |
String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue(); |
// Localisation - Lieu |
// Localisation - Lieu dit |
if (aloc.compareTo("000null")==0) { |
table.setText(row, 6, "Inconnu"); |
if (alieudit.compareTo("null")!=0) { |
center.append(", "+alieudit); |
} |
else { |
table.setText(row, 6, aloc ); |
String acomment=((JSONString) jsonArrayNested .get(10)).stringValue(); |
// Commentaire |
if (acomment.compareTo("null")!=0) { |
center.append(", "+acomment); |
} |
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%"); |
String adate=((JSONString) jsonArrayNested .get(8)).stringValue(); |
// Date |
if (adate.compareTo("0000-00-00 00:00:00")!=0) { |
right.append("<b>"+adate+"</b>"); |
} |
else { |
header.getCellFormatter().setVisible(0, 6,false); |
table.getCellFormatter().setVisible(row, 6,false); |
// right.append("<b>00/00/0000</b>"); |
} |
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(" "+left,40)); |
table.setHTML(row, 2, subLeft(" "+center,120)); |
table.setHTML(row, 3, subLeft(" "+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,17 → 809,25 |
// 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," "); |
table.setHTML(j,1," "); |
table.setHTML(j,2," "); |
table.setHTML(j,3," "); |
table.setHTML(j,4," "); |
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%"); |
178,19 → 180,13 |
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" |
selector.setCellSpacing(0); |
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(locationList,"Communes"); |
outer.add(dateList,"Dates"); |
outer.add(inner); |
outer.add(locationList); |
outer.add(dateList); |
outer.setCellHeight(inner,"100%"); |
// Create the groups within the stack panel. |
outer.add(locationList, "<b>Localité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); |
} |
} |