/trunk/src/org/tela_botanica/client/DateFilterPanel.java |
---|
File deleted |
/trunk/src/org/tela_botanica/client/StationFilterPanel.java |
---|
File deleted |
/trunk/src/org/tela_botanica/client/LocationFilterPanel.java |
---|
File deleted |
/trunk/src/org/tela_botanica/client/LocationAssistant.java |
---|
73,6 → 73,9 |
autoCompletebox.setText(str); |
} |
public void setValue(String value) { |
autoCompletebox.setValue(value); |
} |
public String getValue() { |
return autoCompletebox.getValue(); |
/trunk/src/org/tela_botanica/client/Mediator.java |
---|
47,9 → 47,8 |
// Filtres sur les releves |
private InventoryFilterView inventoryFilterView=null; // Containeur filtre date, lieu, lieu-dit ... |
private LocationFilterPanel locationFilterPanel = null; // Filtre sur lieu de releve |
private DateFilterPanel dateFilterPanel = null; // Filtre sur date d'observation |
private StationFilterPanel stationFilterPanel = null; // Filtre sur station d'observation |
private LocationFilterView locationFilterView=null; // Filtre sur lieu de releve |
private DateFilterView dateFilterView = null; // Filtre sur date d'observation |
// Saisie d'une observation |
59,7 → 58,7 |
private LocationAssistant locationAssistant=null; // Assistant de saisie nom de commune |
private TextBox date = null; // date observation |
private TextBox milieu = null; // milieu observation |
private TextBox station = null; // station observation |
private TextBox lieudit = null; // lieu dit observation |
private TextBox comment = null; // commentaire observation |
private InventoryItem inventoryItem=null; // Une observation saisie |
108,27 → 107,27 |
// Navigateur |
Viewport viewport = new Viewport(); |
viewport.setStyleName("my-border-layout"); |
viewport.setBorders(true); |
// viewport.setStyleName("my-border-layout"); |
// viewport.setBorders(true); |
viewport.setLayout(new BorderLayout()); |
center = new WidgetContainer(); |
center.setLayout(new BorderLayout()); |
center.setBorders(true); |
// center.setBorders(true); |
west = new WidgetContainer(); |
west.setLayout(new FillLayout()); |
west.setBorders(true); |
// west.setBorders(true); |
south = new WidgetContainer(); |
south.setLayout(new FillLayout()); |
south.setBorders(true); |
// south.setBorders(true); |
north = new WidgetContainer(); |
north.setLayout(new FillLayout()); |
north.setBorders(true); |
// north.setBorders(true); |
inventoryListView = new InventoryListView(this); // Liste de releves |
connexionView = new ConnexionView(this); // Identifiant de connection |
195,13 → 194,23 |
public void onInit() { |
// Filtre par defaut : all et action selection de toutes les stations |
locationFilterView.setIDLocation("all"); // Mise a jour filtre localite |
locationFilterView.setLocation("all"); // Mise a jour filtre localite |
locationFilterView.setLieudit("all"); // Mise a jour filtre localite |
locationFilterView.update(); // Mise a jour affichage |
locationFilterPanel.setLocation("all"); |
locationFilterPanel.updateCount(); |
this.onLocationSelected("all"); |
dateFilterView.setYear("all"); |
dateFilterView.setMonth("all"); |
dateFilterView.setDay("all"); |
dateFilterView.update(); |
this.onLocationSelected("all","all","all"); |
} |
225,7 → 234,7 |
/** |
* Action suivant la completion d'un nom |
* Action suivant la completion d'un nom : affichage popup information |
* |
*/ |
253,7 → 262,7 |
inventoryItem=new InventoryItem(this); |
} |
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),"null"); |
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),lieudit.getText(),station.getText(),comment.getText(),"null"); |
inventoryItem.addelement(); |
} |
272,7 → 281,7 |
inventoryItem=new InventoryItem(this); |
} |
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),milieu.getText(),comment.getText(),ordre); |
inventoryItem.setContent(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),lieudit.getText(),station.getText(),comment.getText(),ordre); |
inventoryItem.updateElement(); |
} |
309,17 → 318,34 |
*/ |
public void onInventoryUpdated(String location) { |
public void onInventoryUpdated(String id_location,String loc, String lieu) { |
if (location.compareTo("")==0) { |
location="000null"; |
if (id_location.compareTo("")==0) { |
id_location="000null"; |
} |
if (loc.compareTo("")==0) { |
loc="000null"; |
} |
locationFilterPanel.setLocation(location); // Mise a jour filtre localite |
locationFilterPanel.updateCount(); |
if (lieu.compareTo("")==0) { |
lieu="000null"; |
} |
this.onLocationSelected(location); // Selection localite |
locationFilterView.setIDLocation(id_location); // Mise a jour filtre localite |
locationFilterView.setLocation(loc); // Mise a jour filtre localite |
locationFilterView.setLieudit(lieu); // Mise a jour filtre localite |
locationFilterView.update(); // Mise a jour affichage |
dateFilterView.setYear("all"); |
dateFilterView.setMonth("all"); |
dateFilterView.setDay("all"); |
dateFilterView.update(); |
this.onLocationSelected(id_location,loc,lieu); // Selection localite |
} |
365,10 → 391,9 |
this.user=user; |
connexionView.getSignLabel().setText(user+ " (deconnexion)"); |
inventoryListView.setUser(user); |
dateFilterPanel.setUser(user); |
stationFilterPanel.setUser(user); |
dateFilterView.setUser(user); |
entryView.setUser(user); |
locationFilterPanel.setUser(user); |
locationFilterView.setUser(user); |
this.onInit(); |
} |
385,10 → 410,9 |
this.user=user; |
connexionView.getSignLabel().setText("Connexion"); |
inventoryListView.setUser(user); |
dateFilterPanel.setUser(user); |
stationFilterPanel.setUser(user); |
dateFilterView.setUser(user); |
entryView.setUser(user); |
locationFilterPanel.setUser(user); |
locationFilterView.setUser(user); |
this.onInit(); |
} |
418,45 → 442,22 |
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants au filtrage |
*/ |
public void onLocationSelected(String loc) { |
public void onLocationSelected(String id_loc, String loc,String lieu) { |
// Positionnement Filtre affichage |
inventoryListView.setIdLocation(id_loc); |
inventoryListView.setLocation(loc); |
inventoryListView.setLieudit(lieu); |
inventoryListView.updateCount(); |
// Affichage des filtres |
inventoryListView.displayFilter(); |
// Positionnement Filtre affichage |
dateFilterPanel.setLocation(loc); |
dateFilterPanel.updateCount(); |
// Positionnement Filtre affichage |
stationFilterPanel.setLocation(loc); |
stationFilterPanel.updateCount(); |
} |
// Filtre station |
/** |
* Action sur selection d'une station : affichage de la liste des taxons correspondants |
*/ |
public void onStationSelected(String station) { |
inventoryListView.setStation(station); |
inventoryListView.updateCount(); |
inventoryListView.displayFilter(); |
} |
// Filtre date d'observation |
464,9 → 465,12 |
* Action sur selection d'une date : affichage de la liste des taxons correspondants |
*/ |
public void onDateSelected(String date) { |
public void onDateSelected(String year,String month,String day) { |
inventoryListView.setDate(date); |
inventoryListView.setYear(year); |
inventoryListView.setMonth(month); |
inventoryListView.setDay(day); |
inventoryListView.updateCount(); |
inventoryListView.displayFilter(); |
495,7 → 499,7 |
/** |
* Declaration lieu dit : lieu dit d'observation |
* |
* @param milieu |
* @param lieudit |
*/ |
public void registerLieudit(TextBox lieudit) { |
506,13 → 510,13 |
/** |
* Declaration milieu : milieu d'observation |
* Declaration station : station d'observation |
* |
* @param milieu |
* @param station |
*/ |
public void registerMilieu(TextBox milieu) { |
this.milieu=milieu; |
public void registerStation(TextBox station) { |
this.station=station; |
} |
537,18 → 541,20 |
} |
/** |
* Declaration DateFilterPanel : filtre date observation |
* Declaration DateFilterView : filtre date observation |
* @param locationList |
*/ |
public void registerDateFilterPanel(DateFilterPanel dateFilterPanel) { |
public void registerDateFilterView(DateFilterView dateFilterView) { |
this.dateFilterPanel=dateFilterPanel; |
this.dateFilterView=dateFilterView; |
} |
/** |
* Declaration LocationAssistant : completion commune |
561,28 → 567,17 |
} |
/** |
* Declaration LocationFilterPanel : filtre lieu observation |
* Declaration LocationFilterView : filtre lieu observation |
* @param locationList |
*/ |
public void registerLocationFilterPanel(LocationFilterPanel locationFilterPanel) { |
public void registerLocationFilterView(LocationFilterView locationFilterView) { |
this.locationFilterPanel=locationFilterPanel; |
this.locationFilterView=locationFilterView; |
} |
/** |
* Declaration StationFilterPanel : filtre par station |
* @param locationList |
*/ |
public void registerStationFilterPanel(StationFilterPanel stationFilterPanel) { |
this.stationFilterPanel=stationFilterPanel; |
} |
// Accesseurs et setteurs |
632,8 → 627,9 |
return inventoryListView; |
} |
public LocationFilterPanel getLocationList() { |
return locationFilterPanel; |
public LocationFilterView getLocationFilterView() { |
return locationFilterView; |
} |
public NameAssistant getNameAssistant() { |
/trunk/src/org/tela_botanica/client/ActionView.java |
---|
20,14 → 20,16 |
import net.mygwt.ui.client.Style; |
import net.mygwt.ui.client.event.BaseEvent; |
import net.mygwt.ui.client.event.SelectionListener; |
import net.mygwt.ui.client.widget.Button; |
import net.mygwt.ui.client.widget.WidgetContainer; |
import net.mygwt.ui.client.widget.layout.BorderLayoutData; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.ClickListener; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.Widget; |
public class ActionView { |
private Mediator mediator=null; |
44,13 → 46,10 |
// Transmission d'elements |
HTML transButton=new HTML("Transmettre Tela Botanica"); |
transButton.setStyleName("html_button_long"); |
transButton.addClickListener( |
new ClickListener() { |
public void onClick(Widget sender) { |
// TODO : une action dans le mediator |
Button transButton= new Button("Transmettre Tela Botanica", |
new SelectionListener() { |
public void widgetSelected(BaseEvent be) { |
if (mediator.getConnected()) { |
mediator.getInventoryListView().transmitElement(); |
} |
64,12 → 63,10 |
buttons.add(transButton); |
// Suppression d'elements |
HTML delButton=new HTML("Suppression"); |
delButton.setStyleName("html_button"); |
delButton.addClickListener( |
new ClickListener() { |
public void onClick(Widget sender) { |
Button delButton = new Button("Suppression", |
new SelectionListener() { |
public void widgetSelected(BaseEvent be) { |
// TODO : une action dans le mediator |
mediator.getInventoryListView().deleteElement(); |
} |
82,9 → 79,7 |
exportButton=new HTML(); |
buttons.add(exportButton); |
exportButton.setStyleName("html_button"); |
panel.add(buttons); |
WidgetContainer center=mediator.getCenterContainer(); |
104,6 → 99,9 |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* Revision 1.1 2008-01-02 21:26:05 ddelon |
* mise en place mygwt |
* |
* Revision 1.5 2007-12-22 14:48:53 ddelon |
* Documentation et refactorisation |
* |
/trunk/src/org/tela_botanica/client/LocationFilterView.java |
---|
New file |
0,0 → 1,473 |
/* |
* Copyright 2006 Google Inc. |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not |
* use this file except in compliance with the License. You may obtain a copy of |
* the License at |
* |
* http://www.apache.org/licenses/LICENSE-2.0 |
* |
* Unless required by applicable law or agreed to in writing, software |
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
* License for the specific language governing permissions and limitations under |
* the License. |
*/ |
package org.tela_botanica.client; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONString; |
import com.google.gwt.json.client.JSONValue; |
import com.google.gwt.user.client.HTTPRequest; |
import com.google.gwt.user.client.ResponseTextHandler; |
import com.google.gwt.user.client.ui.VerticalPanel; |
import net.mygwt.ui.client.data.Model; |
import net.mygwt.ui.client.event.BaseEvent; |
import net.mygwt.ui.client.event.SelectionListener; |
import net.mygwt.ui.client.viewer.IAsyncContentCallback; |
import net.mygwt.ui.client.viewer.IAsyncTreeContentProvider; |
import net.mygwt.ui.client.viewer.IElementComparer; |
import net.mygwt.ui.client.viewer.ISelectionChangedListener; |
import net.mygwt.ui.client.viewer.ModelLabelProvider; |
import net.mygwt.ui.client.viewer.SelectionChangedEvent; |
import net.mygwt.ui.client.viewer.TreeViewer; |
import net.mygwt.ui.client.viewer.Viewer; |
import net.mygwt.ui.client.widget.Button; |
import net.mygwt.ui.client.widget.ExpandBar; |
import net.mygwt.ui.client.widget.ExpandItem; |
import net.mygwt.ui.client.widget.tree.Tree; |
/** |
* A tree displaying a set of email folders. |
*/ |
public class LocationFilterView { |
private static final String VALUE_UNKNOWN = "Inconnu"; |
private String user; |
private String serviceBaseUrl = null; |
private String id_location = "all"; |
private String location = "all"; |
private String lieudit = "all"; |
private Mediator mediator = null; |
private SALB[] salbs=null; |
private TALB[] talbs=null; |
private FALB[] falbs=null; |
private Model root = null; |
private RALB ralb = null; |
private Tree tree = null; |
private TreeViewer viewer=null; |
public LocationFilterView(Mediator med,InventoryFilterView inventoryFilterView) { |
mediator=med; |
user=mediator.getUser(); |
serviceBaseUrl = mediator.getServiceBaseUrl(); |
mediator.registerLocationFilterView(this); |
initTree(); |
ExpandItem locationfilter = new ExpandItem(); |
locationfilter.setText("Lieux"); |
ExpandBar expandBar=inventoryFilterView.getExpandBar(); |
locationfilter.getContainer().add(tree); |
expandBar.add(locationfilter); |
locationfilter.setExpanded(true); |
} |
// Initialisation noeud de base |
void initTree() { |
// Enregistrement Mise à jour asynchrone |
IAsyncTreeContentProvider cp = new IAsyncTreeContentProvider() { |
public Object[] getElements(Object input) { |
Model m = (Model) input; |
return m.getChildren().toArray(); |
} |
public Object getParent(Object element) { |
return ((Model) element).getParent(); |
} |
public boolean hasChildren(Object parent) { |
if (parent instanceof FALB) { // Station |
return false; |
} |
else { |
if (parent instanceof SALB) { // Departement |
if (((SALB)parent).toString().compareTo(VALUE_UNKNOWN)==0) |
return false; |
else |
return true; |
} |
else { |
return true; |
} |
} |
} |
public void getChildren(final Object parent, final IAsyncContentCallback callback) { |
if (parent instanceof SALB) { |
// Departement + commune |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/" |
+ ((SALB) parent).getAsString("path"), |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
talbs=new TALB[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String dep=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (dep.compareTo("000null")==0) dep=VALUE_UNKNOWN; |
talbs[i]=new TALB((SALB) parent,dep); |
} |
} |
callback.setElements(talbs); |
} |
} |
}); |
} |
else if (parent instanceof TALB) { |
// Commune + station |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user + "/" |
+ ((TALB) parent).getAsString("path") , |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
falbs=new FALB[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String com=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (com.compareTo("000null")==0) com=VALUE_UNKNOWN; |
falbs[i]=new FALB((TALB) parent, com); |
} |
} |
callback.setElements(falbs); |
} |
} |
}); |
} |
else if (parent instanceof RALB) { |
// Rafraichissement Racine |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user , |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
salbs=new SALB[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String all=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (all.compareTo("000null")==0) all=VALUE_UNKNOWN; |
salbs[i]=new SALB(all); |
} |
} |
callback.setElements(salbs); |
Model m=new Model(); |
m.set("name",id_location); |
viewer.setExpanded(m,true); |
} |
} |
}); |
} |
} |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
} |
}; |
tree = new Tree(); |
viewer = new TreeViewer(tree); |
viewer.setContentProvider(cp); |
viewer.setLabelProvider(new ModelLabelProvider()); |
viewer.setComparer(new IElementComparer() { |
public boolean equals(Object a, Object b) { |
if ((a==null) || b==null) |
return false; |
if (((Model) a).getAsString("name").compareTo(((Model) b).getAsString("name"))==0) { |
return true; |
} |
else return false; |
} |
} |
); |
viewer.addSelectionListener(new ISelectionChangedListener() { |
public void selectionChanged(SelectionChangedEvent se) { |
Model m = (Model) se.getSelection().getFirstElement(); |
// Info.show("Selection Changed", "{0} was selected", m.getAsString("path")); |
if (m instanceof TALB) { // Commune |
location=m.getAsString("name"); |
if (location.compareTo(VALUE_UNKNOWN)==0) location="000null"; |
id_location=m.getAsString("salb"); |
if (id_location.compareTo(VALUE_UNKNOWN)==0) id_location="000null"; |
lieudit="all"; |
mediator.onLocationSelected(id_location,location,lieudit); |
} |
else |
if (m instanceof FALB) { // Station |
id_location=m.getAsString("salb"); |
if (id_location.compareTo(VALUE_UNKNOWN)==0) id_location="000null"; |
location=m.getAsString("talb"); |
if (location.compareTo(VALUE_UNKNOWN)==0) location="000null"; |
lieudit=m.getAsString("name"); |
if (lieudit.compareTo(VALUE_UNKNOWN)==0) lieudit="000null"; |
mediator.onLocationSelected(id_location,location,lieudit); |
} |
else |
if (m instanceof SALB) { // Departement |
id_location=m.getAsString("name"); |
if (id_location.compareTo(VALUE_UNKNOWN)==0) id_location="000null"; |
location="all"; |
lieudit="all"; |
mediator.onLocationSelected(id_location,location,lieudit); |
} |
if (m instanceof RALB) { // Pays |
id_location="all"; |
location="all"; |
lieudit="all"; |
mediator.onLocationSelected(id_location,location,lieudit); |
} |
} |
}); |
// Initialisation premier niveau (doublon obligatoire avec rafraichissement asynchrone) |
root = new Model(); |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryLocationList/" + user , |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
salbs=new SALB[arraySize]; |
ralb = new RALB("France"); |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String all=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (all.compareTo("000null")==0) all=VALUE_UNKNOWN; |
salbs[i]=new SALB(all); |
ralb.add(salbs[i]); |
} |
} |
root.add(ralb); |
viewer.setInput(root); |
} |
} |
}); |
} |
public void setLocation(String location) { |
this.location = location; |
} |
public void setIDLocation(String id_location) { |
this.id_location = id_location; |
} |
public void setLieudit(String lieudit) { |
this.lieudit = lieudit; |
} |
public void setUser(String user) { |
this.user = user; |
} |
private class RALB extends Model { // Root Administrative level boundaries (pays) |
public RALB(String name) { |
set("name", name); |
set("path", name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class SALB extends Model { // Second Administrative level boundaries (departerment) |
public SALB(String name) { |
set("name", name); |
set("path", name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class TALB extends Model { // Tierce Administrative level boundaries (Commune) |
public TALB(SALB parent, String name) { |
set("name", name); |
set("salb", parent.get("name")); |
set("path", parent.get("path")+"/"+name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class FALB extends Model { // Forth Administrative level boundaries (Station) |
public FALB(TALB parent,String name) { |
set("name", name); |
set("salb", parent.get("salb")); |
set("talb", parent.get("name")); |
set("path", parent.get("path")+"/"+name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
public void update() { |
Model m=new Model(); |
m.set("name",id_location); |
if (viewer.findItem(m)!=null) { |
viewer.refresh(m); // Rafraichissement branche departemental |
} |
else { // Pas de branche departementale ? : rafraichissement total |
Model r=new Model(); |
r.set("name","France"); |
viewer.refresh(r); |
} |
} |
} |
/trunk/src/org/tela_botanica/client/InventoryItem.java |
---|
17,7 → 17,8 |
private String location=null; |
private String location_id=null; |
private String date=null; |
private String milieu=null; |
private String lieudit=null; |
private String station=null; |
private String comment=null; |
private String ordre=null; |
43,7 → 44,7 |
// Alimentation contenu depuis saisie |
public void setContent(String name,String nomenclaturalNumber, String location, String location_id, String date, String milieu, String comment,String ordre) { |
public void setContent(String name,String nomenclaturalNumber, String location, String location_id, String date, String lieudit, String station, String comment,String ordre) { |
this.name=name; |
59,8 → 60,11 |
} |
this.location_id=location_id; |
if (location.compareTo("")==0) this.location_id=""; |
if (location_id==null) this.location_id=""; |
this.date=date; |
this.milieu=milieu; |
this.lieudit=lieudit; |
this.station=station; |
this.comment=comment; |
this.ordre=ordre; |
115,7 → 119,7 |
.stringValue(), |
Util.toCelString(((JSONString) jsonArray.get(3)) |
.toString()), |
location,location_id,date,milieu,comment); |
location,location_id,date,lieudit,station,comment); |
} |
} |
123,7 → 127,7 |
} |
// Saisie libre |
else { |
addElement(name, " ", " ", " ", " ", " ",location,location_id,date,milieu,comment); |
addElement(name, " ", " ", " ", " ", " ",location,location_id,date,lieudit,station,comment); |
} |
} |
153,7 → 157,7 |
*/ |
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 milieu, String comment) { |
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String lieu, String sta, String comment) { |
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/", "identifiant=" |
160,12 → 164,12 |
+ mediator.getUser() + "&nom_sel=" + URL.encodeComponent(nom_sel) + "&num_nom_sel=" + num_nom_sel |
+ "&nom_ret=" + URL.encodeComponent(nom_ret) + "&num_nom_ret=" + num_nom_ret |
+ "&num_taxon=" + num_taxon + "&famille=" + URL.encodeComponent(famille) + "&location=" + URL.encodeComponent(loc) + "&id_location=" + id_location + "&date_observation=" + dat |
+ "&station="+ URL.encodeComponent(milieu) + "&commentaire="+ URL.encodeComponent(comment), |
+ "&lieudit="+ URL.encodeComponent(lieu) + "&station="+ URL.encodeComponent(sta) + "&commentaire="+ URL.encodeComponent(comment), |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
mediator.onInventoryUpdated(location); |
mediator.onInventoryUpdated(location_id,location,"all"); |
} |
}); |
} |
206,7 → 210,7 |
.stringValue(), |
Util.toCelString(((JSONString) jsonArray.get(3)) |
.toString()), |
location,location_id,date,milieu,comment); |
location,location_id,date,lieudit,station,comment); |
} |
} |
214,7 → 218,7 |
} |
// Modification d'un nom ne faisant pas parti du referentiel (saisie libre) |
else { |
updateElement(ordre,name, " ", " ", " ", " ", " ",location,location_id,date,milieu,comment); |
updateElement(ordre,name, " ", " ", " ", " ", " ",location,location_id,date,lieudit,station,comment); |
} |
} |
247,7 → 251,7 |
*/ |
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 milieu, String comment) { |
String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String lieu, String sta, String comment) { |
HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + mediator.getUser() + "/" +ordre + "/", |
254,12 → 258,12 |
"&nom_sel=" + URL.encodeComponent(nom_sel) + "&num_nom_sel=" + num_nom_sel |
+ "&nom_ret=" + URL.encodeComponent(nom_ret) + "&num_nom_ret=" + num_nom_ret |
+ "&num_taxon=" + num_taxon + "&famille=" + URL.encodeComponent(famille) + "&location=" + URL.encodeComponent(loc) + "&id_location=" + id_location + "&date_observation=" + dat |
+ "&station="+ URL.encodeComponent(milieu) + "&commentaire="+ URL.encodeComponent(comment), |
+ "&lieudit="+ URL.encodeComponent(lieu) + "&station="+ URL.encodeComponent(sta) + "&commentaire="+ URL.encodeComponent(comment), |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
mediator.onInventoryUpdated(location); |
mediator.onInventoryUpdated(location_id,location,"all"); |
} |
}); |
} |
/trunk/src/org/tela_botanica/client/AutoCompleteAsyncTextBox.java |
---|
186,6 → 186,7 |
} |
currentValue=null; |
this.setText(""); |
this.setValue(null); |
} |
} |
211,6 → 212,8 |
if(text.length() > 0) |
{ |
currentValue=null; |
items.clear(); |
if (getFromCache(text)!=null) { |
/trunk/src/org/tela_botanica/client/DateFilterView.java |
---|
New file |
0,0 → 1,459 |
/* |
* 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 net.mygwt.ui.client.data.Model; |
import net.mygwt.ui.client.viewer.IAsyncContentCallback; |
import net.mygwt.ui.client.viewer.IAsyncTreeContentProvider; |
import net.mygwt.ui.client.viewer.IElementComparer; |
import net.mygwt.ui.client.viewer.ISelectionChangedListener; |
import net.mygwt.ui.client.viewer.ModelLabelProvider; |
import net.mygwt.ui.client.viewer.SelectionChangedEvent; |
import net.mygwt.ui.client.viewer.TreeViewer; |
import net.mygwt.ui.client.viewer.Viewer; |
import net.mygwt.ui.client.widget.ExpandBar; |
import net.mygwt.ui.client.widget.ExpandItem; |
import net.mygwt.ui.client.widget.tree.Tree; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONParser; |
import com.google.gwt.json.client.JSONString; |
import com.google.gwt.json.client.JSONValue; |
import com.google.gwt.user.client.HTTPRequest; |
import com.google.gwt.user.client.ResponseTextHandler; |
import com.google.gwt.user.client.ui.Composite; |
public class DateFilterView extends Composite { |
private static final String VALUE_UNKNOWN = "Inconnus"; |
private String user; |
private String serviceBaseUrl = null; |
private String year = "all"; |
private String month = "all"; |
private String day = "all"; |
private Mediator mediator = null; |
private YEAR[] years=null; |
private MONTH[] months=null; |
private DAY[] days=null; |
private Model root = null; |
private MILLENIUM millenium = null; |
private Tree tree = null; |
private TreeViewer viewer=null; |
public DateFilterView(Mediator med, InventoryFilterView inventoryFilterView) { |
mediator=med; |
mediator.registerDateFilterView(this); |
user=mediator.getUser(); |
serviceBaseUrl = mediator.getServiceBaseUrl(); |
initTree(); |
ExpandItem dateFilter = new ExpandItem(); |
dateFilter.setText("Dates"); |
ExpandBar expandBar=inventoryFilterView.getExpandBar(); |
dateFilter.getContainer().add(tree); |
expandBar.add(dateFilter); |
} |
// Initialisation noeud de base |
void initTree() { |
// Enregistrement Mise à jour asynchrone |
IAsyncTreeContentProvider cp = new IAsyncTreeContentProvider() { |
public Object[] getElements(Object input) { |
Model m = (Model) input; |
return m.getChildren().toArray(); |
} |
public Object getParent(Object element) { |
return ((Model) element).getParent(); |
} |
public boolean hasChildren(Object parent) { |
if (parent instanceof DAY) { // Jour |
return false; |
} |
else { |
if (parent instanceof YEAR) { // Annee |
if (((YEAR)parent).toString().compareTo(VALUE_UNKNOWN)==0) |
return false; |
else |
return true; |
} |
else { |
return true; |
} |
} |
} |
public void getChildren(final Object parent, final IAsyncContentCallback callback) { |
if (parent instanceof YEAR) { |
// Annee + mois |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" |
+ ((YEAR) parent).getAsString("path"), |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
months=new MONTH[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String month=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (month.compareTo("0")==0) month=VALUE_UNKNOWN; |
months[i]=new MONTH((YEAR) parent,month); |
} |
} |
callback.setElements(months); |
} |
} |
}); |
} |
else if (parent instanceof MONTH) { |
// Mois + jours |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user + "/" |
+ ((MONTH) parent).getAsString("path") , |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
days=new DAY[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String day=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (day.compareTo("0")==0) day=VALUE_UNKNOWN; |
days[i]=new DAY((MONTH) parent, day); |
} |
} |
callback.setElements(days); |
} |
} |
}); |
} |
else if (parent instanceof MILLENIUM) { |
// Rafraichissement Racine |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user , |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
years=new YEAR[arraySize]; |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String all=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (all.compareTo("0")==0) all=VALUE_UNKNOWN; |
years[i]=new YEAR(all); |
} |
} |
callback.setElements(years); |
} |
} |
}); |
} |
} |
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
} |
}; |
tree = new Tree(); |
viewer = new TreeViewer(tree); |
viewer.setContentProvider(cp); |
viewer.setLabelProvider(new ModelLabelProvider()); |
viewer.setComparer(new IElementComparer() { |
public boolean equals(Object a, Object b) { |
if ((a==null) || b==null) |
return false; |
if (((Model) a).getAsString("name").compareTo(((Model) b).getAsString("name"))==0) { |
return true; |
} |
else return false; |
} |
} |
); |
viewer.addSelectionListener(new ISelectionChangedListener() { |
public void selectionChanged(SelectionChangedEvent se) { |
Model m = (Model) se.getSelection().getFirstElement(); |
// Info.show("Selection Changed", "{0} was selected", m.getAsString("path")); |
if (m instanceof MONTH) { // Mois |
month=m.getAsString("name"); |
if (month.compareTo(VALUE_UNKNOWN)==0) month="0"; |
year=m.getAsString("year"); |
if (year.compareTo(VALUE_UNKNOWN)==0) year="0"; |
day="all"; |
mediator.onDateSelected(year,month,day); |
} |
else |
if (m instanceof DAY) { // Jour |
month=m.getAsString("month"); |
if (month.compareTo(VALUE_UNKNOWN)==0) month="0"; |
year=m.getAsString("year"); |
if (year.compareTo(VALUE_UNKNOWN)==0) year="0"; |
day=m.getAsString("name"); |
if (day.compareTo(VALUE_UNKNOWN)==0) day="0"; |
mediator.onDateSelected(year,month,day); |
} |
else |
if (m instanceof YEAR) { // Annee |
month="all"; |
year=m.getAsString("name"); |
if (year.compareTo(VALUE_UNKNOWN)==0) year="0"; |
day="all"; |
mediator.onDateSelected(year,month,day); |
} |
if (m instanceof MILLENIUM) { // Tous |
month="all"; |
year="all"; |
day="all"; |
mediator.onDateSelected(year,month,day); |
} |
} |
}); |
// Initialisation premier niveau (doublon obligatoire avec rafraichissement asynchrone) |
root = new Model(); |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryDateList/" + user, |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
int arraySize = jsonArray.size(); |
years=new YEAR[arraySize]; |
millenium = new MILLENIUM("Toutes"); |
for (i = 0; i < arraySize; ++i) { |
if ((jsonArrayNested = jsonArray.get(i).isArray()) != null) { |
String all=Util.toCelString(((JSONString)jsonArrayNested.get(0)).toString()); |
if (all.compareTo("0")==0) all=VALUE_UNKNOWN; |
years[i]=new YEAR(all); |
millenium.add(years[i]); |
} |
} |
root.add(millenium); |
viewer.setInput(root); |
} |
} |
}); |
} |
private class MILLENIUM extends Model { // Root |
public MILLENIUM(String name) { |
set("name", name); |
set("path", name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class YEAR extends Model { // Annee |
public YEAR(String name) { |
set("name", name); |
set("path", name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class MONTH extends Model { // Mois |
public MONTH(YEAR parent, String name) { |
set("name", name); |
set("year", parent.get("name")); |
set("path", parent.get("path")+"/"+name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
private class DAY extends Model { // Jour |
public DAY(MONTH parent,String name) { |
set("name", name); |
set("year", parent.get("year")); |
set("month", parent.get("name")); |
set("path", parent.get("path")+"/"+name); |
} |
public String toString() { |
return getAsString("name"); |
} |
} |
public void setUser(String user) { |
this.user = user; |
} |
public void setYear(String year) { |
this.year = year; |
} |
public void setMonth(String month) { |
this.month = month; |
} |
public void setDay(String day) { |
this.day = day; |
} |
public void update() { |
Model r=new Model(); |
r.set("name","Toutes"); |
viewer.refresh(r); |
} |
} |
/trunk/src/org/tela_botanica/client/InfoPopup.java |
---|
96,7 → 96,7 |
public void setImageTop(String url) { |
if (url.compareTo("null")!=0) { |
setPopupPosition(mediator.getWestContainer().getAbsoluteLeft()+10, mediator.getWestContainer().getAbsoluteTop() + (mediator.getWestContainer().getOffsetHeight()/3) +15); |
setPopupPosition(mediator.getWestContainer().getAbsoluteLeft()+10, mediator.getWestContainer().getAbsoluteTop() + (mediator.getWestContainer().getOffsetHeight()/3) +20); |
show(); |
imageTop.setUrl(url); |
} |
109,7 → 109,7 |
public void setImageBottom(String url) { |
if (url.compareTo("null")!=0) { |
setPopupPosition(mediator.getWestContainer().getAbsoluteLeft()+10, mediator.getWestContainer().getAbsoluteTop() + (mediator.getWestContainer().getOffsetHeight()/3) +15); |
setPopupPosition(mediator.getWestContainer().getAbsoluteLeft()+10, mediator.getWestContainer().getAbsoluteTop() + (mediator.getWestContainer().getOffsetHeight()/3) +20); |
show(); |
imageBottom.setUrl(url); |
} |
/trunk/src/org/tela_botanica/client/InventoryListView.java |
---|
164,10 → 164,13 |
// Filtre par defaut : |
private String id_location = "all"; |
private String location = "all"; |
private String date = "all"; |
private String year = "all"; |
private String month = "all"; |
private String day = "all"; |
private String search = "all"; |
private String station = "all"; |
private String lieudit = "all"; |
private String ordre= null; |
192,7 → 195,7 |
navBar = new NavBar(); |
panel.getHeader().addWidget(navBar); |
// Contenu : |
235,23 → 238,25 |
// Selection d'une ligne |
table.addListener(Events.RowClick, new Listener() { |
public void handleEvent(BaseEvent be) { |
TableItem item=(TableItem) be.item; |
if (item!=null) { |
if (ordre==null) { |
if (ordre==null) { // Affichage de la ligne selectionne |
ordre= (String) item.getValue(4); |
mediator.onInventoryItemSelected(ordre); |
} |
else { |
if (ordre.compareTo((String) item.getValue(4))==0) { |
else { |
// Si une ligne etait deja selectionne |
if (ordre.compareTo((String) item.getValue(4))==0) { // C'est la meme, on la deselectionne |
ordre=null; |
table.deselect(be.rowIndex); |
mediator.onInventoryItemUnselected(); |
} |
else { |
ordre= (String) item.getValue(4); |
ordre= (String) item.getValue(4); // C'est une autre, on la selectionne |
mediator.onInventoryItemSelected(ordre); |
} |
290,7 → 295,7 |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
mediator.onInventoryUpdated(location); |
mediator.onInventoryUpdated(id_location,"all","all"); |
} |
}); |
} |
349,12 → 354,8 |
// Transformation de la date selectionne vers date time stamp |
String adate="all"; |
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 + "/" + URL.encodeComponent(location) + "/" + adate + "/" + URL.encodeComponent(search) + "/" + URL.encodeComponent(station), |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + id_location + "/" + URL.encodeComponent(location) + "/" + year + "/" + month + "/" + day + "/" + URL.encodeComponent(search) + "/" + URL.encodeComponent(lieudit), |
new ResponseTextHandler() { |
public void onCompletion(String str) { |
391,12 → 392,8 |
// Toutes date par defaut |
String adate="all"; |
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 + "/" + URL.encodeComponent(location) +"/" + adate + "/" + URL.encodeComponent(search) + "/" + URL.encodeComponent(station) + "/" |
HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + id_location + "/" + URL.encodeComponent(location) +"/" + year + "/" + month + "/" + day + "/" + URL.encodeComponent(search) + "/" + URL.encodeComponent(lieudit) + "/" |
+ startIndex + "/" + VISIBLE_TAXON_COUNT, |
new ResponseTextHandler() { |
407,7 → 404,6 |
JSONArray jsonArray; |
JSONArray jsonArrayNested; |
int row=0; |
int i=0; |
if ((jsonArray = jsonValue.isArray()) != null) { |
427,7 → 423,7 |
// Statut Observation transmise ? |
String atransmit=((JSONString) jsonArrayNested .get(11)).stringValue(); |
String atransmit=((JSONString) jsonArrayNested .get(12)).stringValue(); |
if (atransmit.compareTo("1")==0) { |
values[0] = new Image("tela.gif"); |
516,8 → 512,19 |
if (alieudit.compareTo("000null")!=0) { |
observationText.append(", "+alieudit); |
} |
// Station - |
String astation=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString()); |
if (astation.compareTo("000null")!=0) { |
observationText.append(", "+astation); |
} |
String acomment=Util.toCelString(((JSONString) jsonArrayNested .get(10)).toString()); |
String acomment=Util.toCelString(((JSONString) jsonArrayNested .get(11)).toString()); |
// Commentaire |
if (acomment.compareTo("null")!=0) { |
680,8 → 687,20 |
this.search = search; |
} |
/* |
* Departement en cours |
* |
*/ |
public void setIdLocation(String id_location) { |
this.id_location = id_location; |
} |
/* |
* Localite en cours |
* |
*/ |
697,8 → 716,8 |
* |
*/ |
public void setStation(String station) { |
this.station = station; |
public void setLieudit(String lieudit) { |
this.lieudit = lieudit; |
} |
709,10 → 728,19 |
*/ |
public void setDate(String date) { |
this.date = date; |
public void setYear(String year) { |
this.year = year; |
} |
public void setMonth(String month) { |
this.month = month; |
} |
public void setDay(String day) { |
this.day = day; |
} |
/* |
* Utilisateur en cours |
734,61 → 762,108 |
mediator.getActionView().getExportButton().setHTML("<a href=\""+mediator.getServiceBaseUrl()+"/InventoryExport/" |
+ user + "/" |
+ URL.encodeComponent(id_location) + "/" |
+ URL.encodeComponent(location) + "/" |
+ URL.encodeComponent(station)+ "/" |
+ URL.encodeComponent(search) + "/" |
+ date + |
"\">"+"Export tableur</a>"); |
+ URL.encodeComponent(lieudit)+ "/" |
+ year + "/" |
+ month + "/" |
+ day |
+ "\">"+"Export tableur</a>"); |
// Mise a jour ligne de selection |
String com; |
if (location.compareTo("all")==0) { |
com="Toutes communes"; |
String dep; |
if (id_location.compareTo("all")==0) { |
dep="Tous départements"; |
} |
else { |
if (location.compareTo("000null")==0) { |
com="Communes non renseignées"; |
if (id_location.compareTo("000null")==0) { |
dep="Départements non renseignées "; |
} |
else { |
com="Commune de "+location; |
dep="Département "+id_location; |
} |
} |
String dat; |
if (date.compareTo("all")==0) { |
dat=", toutes périodes"; |
String com; |
if (location.compareTo("all")==0) { |
com=", toutes communes"; |
} |
else { |
if (date.compareTo("00/00/0000")==0) { |
dat=", périodes non renseignées"; |
if (location.compareTo("000null")==0) { |
com=", communes non renseignées"; |
} |
else { |
dat=", le "+ date; |
com=", commune de "+location; |
} |
} |
String stat; |
if (station.compareTo("all")==0) { |
stat=", toutes stations"; |
String lieu; |
if (lieudit.compareTo("all")==0) { |
lieu=", tous lieux dits"; |
} |
else { |
if (station.compareTo("000null")==0) { |
stat=", stations non renseignées"; |
if (lieudit.compareTo("000null")==0) { |
lieu=", lieu-dit non renseignées"; |
} |
else { |
stat=", station "+ station; |
lieu=", lieu-dit "+ lieudit; |
} |
} |
String dat; |
if ((year.compareTo("all")==0) && (month.compareTo("all")==0) && (day.compareTo("all")==0)) { |
dat=", toutes periodes"; |
} |
else { |
String yea=""; |
String da=""; |
String mont=""; |
if (year.compareTo("all")==0) { |
yea=", toutes années"; |
} |
else { |
if (year.compareTo("0")==0) { |
yea=", periode non renseignée"; |
} |
else { |
yea=", "+ year; |
if (month.compareTo("all")==0) { |
mont=", tous mois"; |
} |
else { |
mont="/"+ month; |
} |
if (day.compareTo("all")==0) { |
da=", tous jours"; |
} |
else { |
da="/"+ day; |
} |
} |
} |
dat=yea + mont + da; |
} |
panel.getHeader().setText(com + dat + stat ); |
panel.getHeader().setText(dep + com + lieu + dat); |
799,6 → 874,9 |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* Revision 1.1 2008-01-02 21:26:04 ddelon |
* mise en place mygwt |
* |
* Revision 1.8 2007-12-22 14:48:53 ddelon |
* Documentation et refactorisation |
* |
/trunk/src/org/tela_botanica/client/EntryView.java |
---|
33,6 → 33,9 |
import java.util.Date; |
import net.mygwt.ui.client.Style; |
import net.mygwt.ui.client.event.BaseEvent; |
import net.mygwt.ui.client.event.SelectionListener; |
import net.mygwt.ui.client.widget.Button; |
import net.mygwt.ui.client.widget.ContentPanel; |
import net.mygwt.ui.client.widget.WidgetContainer; |
import net.mygwt.ui.client.widget.layout.BorderLayoutData; |
45,10 → 48,10 |
import com.google.gwt.user.client.HTTPRequest; |
import com.google.gwt.user.client.History; |
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.ClickListener; |
import com.google.gwt.user.client.ui.Grid; |
import com.google.gwt.user.client.ui.HasHorizontalAlignment; |
import com.google.gwt.user.client.ui.HasVerticalAlignment; |
import com.google.gwt.user.client.ui.HorizontalPanel; |
import com.google.gwt.user.client.ui.KeyboardListener; |
import com.google.gwt.user.client.ui.Label; |
67,10 → 70,9 |
private LocationAssistant locationAssistant = null; |
private TextBox date = new TextBox(); |
private TextBox lieudit = new TextBox(); |
private TextBox milieu = new TextBox(); |
private TextBox station = new TextBox(); |
private TextBox comment = new TextBox(); |
private Button dateSelector = new Button("..."); |
private Button validButton = new Button("Ajouter"); |
boolean visible=false; |
private Mediator mediator=null; |
109,7 → 111,7 |
mediator.registerDate(date); |
mediator.registerComment(comment); |
mediator.registerMilieu(milieu); |
mediator.registerStation(station); |
mediator.registerLieudit(lieudit); |
panel= new ContentPanel(Style.HEADER); |
127,8 → 129,8 |
// Saisie Commune |
observation.setHTML(2,0,"Commune: "); |
observation.setWidget(2,1,locationAssistant); |
observation.setHTML(0,0,"Commune: "); |
observation.setWidget(0,1,locationAssistant); |
locationAssistant.setWidth("100%"); |
135,8 → 137,8 |
// Saisie lieu-dit |
observation.setHTML(2,2,"Lieu-dit: "); |
observation.setWidget(2,3,lieudit); |
observation.setHTML(0,2,"Lieu-dit: "); |
observation.setWidget(0,3,lieudit); |
lieudit.setWidth("100%"); |
161,22 → 163,22 |
// Saisie (milieu) |
// Saisie (station) |
observation.setHTML(3,0,"Milieu: "); |
observation.setWidget(3,1,milieu); |
observation.setHTML(1,0,"Station: "); |
observation.setWidget(1,1,station); |
milieu.setWidth("100%"); |
station.setWidth("100%"); |
// Validation par entree sur cette zone de texte |
milieu.addKeyboardListener( new KeyboardListener() { |
station.addKeyboardListener( new KeyboardListener() { |
public void onKeyDown(Widget arg0, char arg1, int arg2) { |
if(arg1 == KEY_ENTER) |
{ |
onValidateTextBox(milieu); |
onValidateTextBox(station); |
} |
} |
193,10 → 195,11 |
// Releve |
dateSelector.addClickListener(new ClickListener () { |
dateSelector.addSelectionListener( |
new SelectionListener() { |
public void widgetSelected(BaseEvent be) { |
public void onClick(Widget w) { |
if (visible) { |
visible=false; |
choicesPopup.hide(); |
232,17 → 235,17 |
// Saisie Espece |
observation.setHTML(0,0,"Espèce: "); |
observation.setWidget(0,1,nameAssistant); |
observation.setHTML(2,0,"Espèce: "); |
observation.setWidget(2,1,nameAssistant); |
nameAssistant.setWidth("100%"); |
observation.setHTML(0,2,"Date: "); |
observation.setHTML(1,2,"Date: "); |
HorizontalPanel datePanel = new HorizontalPanel(); |
datePanel.add(date); |
datePanel.add(dateSelector); |
observation.setWidget(0,3,datePanel); |
observation.setWidget(1,3,datePanel); |
// Saisie date |
// Validation par entree sur cette zone de texte |
268,8 → 271,8 |
// Saisie Commentaire |
observation.setHTML(1,0,"Notes: "); |
observation.setWidget(1,1,comment); |
observation.setHTML(3,0,"Notes: "); |
observation.setWidget(3,1,comment); |
comment.setWidth("100%"); |
293,28 → 296,6 |
); |
// Validation par click sur bouton valider |
validButton.addClickListener( |
new ClickListener() { |
public void onClick(Widget w) { |
// Numero ordre vide : ajout d'une observation |
if (ordre==null) { |
mediator.onAddInventoryItem(); |
} |
else { |
mediator.onModifyInventoryItem(ordre); |
ordre=null; |
} |
} |
} |
); |
HorizontalPanel actionPanel= new HorizontalPanel(); |
// actionPanel.add(validButton); |
334,8 → 315,38 |
panel.add(outer); |
panel.getHeader().addWidget(infoOrdre); |
HorizontalPanel inner=new HorizontalPanel(); |
Button newButton=new Button("#", |
// Init |
new SelectionListener() { |
public void widgetSelected(BaseEvent be) { |
nameAssistant.setText(""); |
nameAssistant.setValue(null); |
locationAssistant.setText(""); |
locationAssistant.setValue(null); // Null ? |
date.setText(""); |
lieudit.setText(""); |
station.setText(""); |
comment.setText(""); |
ordre=null; |
infoOrdre.setText("Nouvelle observation"); |
} |
} |
); |
inner.add(infoOrdre); |
inner.add(newButton); |
inner.setCellHorizontalAlignment(infoOrdre, HasHorizontalAlignment.ALIGN_RIGHT); |
inner.setCellVerticalAlignment(infoOrdre, HasVerticalAlignment.ALIGN_MIDDLE); |
inner.setWidth("100%"); |
panel.getHeader().addWidget(inner); |
WidgetContainer center=mediator.getCenterContainer(); |
BorderLayoutData centerData = new BorderLayoutData(Style.NORTH, .25f, 100, 300); |
center.add(panel,centerData); |
416,7 → 427,7 |
else { |
// Modification d'une observation |
mediator.onModifyInventoryItem(ordre); |
infoOrdre.setText(ordre); |
infoOrdre.setText("Modification de l'observation n°: "+ordre); |
} |
} |
467,8 → 478,18 |
locationAssistant.setText(""); |
} |
String adate=((JSONString) jsonArray .get(8)).stringValue(); |
// Departement |
String adep=Util.toCelString(((JSONString) jsonArray .get(7)).toString()); |
if (adep.compareTo("000null")!=0) { |
locationAssistant.setValue(adep); |
} |
else { |
locationAssistant.setValue(null); |
} |
String adate=((JSONString) jsonArray .get(9)).stringValue(); |
// Date |
if (adate.compareTo("0000-00-00 00:00:00")!=0) { |
date.setText(adate); |
478,18 → 499,28 |
} |
String astation=Util.toCelString(((JSONString) jsonArray .get(9)).toString()); |
String alieudit=Util.toCelString(((JSONString) jsonArray .get(10)).toString()); |
// Lieudit |
if (alieudit.compareTo("000null")!=0) { |
lieudit.setText(alieudit); |
} |
else { |
lieudit.setText(""); |
} |
String astation=Util.toCelString(((JSONString) jsonArray .get(11)).toString()); |
// Station |
if (astation.compareTo("000null")!=0) { |
milieu.setText(astation); |
station.setText(astation); |
} |
else { |
milieu.setText(""); |
station.setText(""); |
} |
String acomment=Util.toCelString(((JSONString) jsonArray .get(10)).toString()); |
String acomment=Util.toCelString(((JSONString) jsonArray .get(12)).toString()); |
// Notes |
if (acomment.compareTo("null")!=0) { |
comment.setText(acomment); |
515,6 → 546,9 |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* Revision 1.1 2008-01-02 21:26:04 ddelon |
* mise en place mygwt |
* |
* Revision 1.8 2007-12-22 14:48:53 ddelon |
* Documentation et refactorisation |
* |
/trunk/src/org/tela_botanica/client/InventoryFilterView.java |
---|
21,7 → 21,6 |
import net.mygwt.ui.client.widget.ExpandItem; |
import net.mygwt.ui.client.widget.WidgetContainer; |
import org.tela_botanica.client.LocationFilterPanel; |
/** |
*/ |
28,43 → 27,23 |
public class InventoryFilterView { |
private LocationFilterPanel locationFilterPanel = null; |
private DateFilterPanel dateFilterPanel = null; |
private StationFilterPanel stationFilterPanel = null; |
private LocationFilterView locationFilterView = null; |
private DateFilterView dateFilterView = null; |
private ExpandBar expandBar=null; |
private Mediator mediator=null; |
public InventoryFilterView(Mediator med) { |
mediator=med; |
dateFilterPanel = new DateFilterPanel(mediator); |
locationFilterPanel = new LocationFilterPanel(mediator); |
stationFilterPanel = new StationFilterPanel(mediator); |
ExpandBar expandBar = new ExpandBar(Style.SINGLE | Style.HEADER); |
expandBar = new ExpandBar(Style.SINGLE | Style.HEADER); |
expandBar.setSize(300, 300); |
ExpandItem locationfilter = new ExpandItem(); |
locationfilter.setText("Localités"); |
locationfilter.getContainer().add(locationFilterPanel); |
expandBar.add(locationfilter); |
locationfilter.setExpanded(true); |
ExpandItem stationfilter = new ExpandItem(); |
stationfilter.setText("Stations"); |
stationfilter.getContainer().add(stationFilterPanel); |
expandBar.add(stationfilter); |
ExpandItem dateFilter = new ExpandItem(); |
dateFilter.setText("Dates"); |
dateFilter.getContainer().add(dateFilterPanel); |
expandBar.add(dateFilter); |
locationFilterView = new LocationFilterView(mediator,this); |
dateFilterView = new DateFilterView(mediator,this); |
WidgetContainer west=mediator.getWestContainer(); |
west.add(expandBar); |
72,12 → 51,19 |
} |
public ExpandBar getExpandBar() { |
return expandBar; |
} |
} |
/* +--Fin du code ---------------------------------------------------------------------------------------+ |
* $Log$ |
* Revision 1.1 2008-01-02 21:26:04 ddelon |
* mise en place mygwt |
* |
* Revision 1.7 2007-09-17 19:25:34 ddelon |
* Documentation |
* |