Subversion Repositories eFlore/Archives.cel-v1

Compare Revisions

Ignore whitespace Rev 11 → Rev 12

/trunk/src/org/tela_botanica/client/Mediator.java
10,6 → 10,7
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.TextBox;
 
public class Mediator {
18,9 → 19,19
private String user = null;
private InventoryItemList inventoryItemList = null;
private LocationList locationList = null;
private DateList dateList = null;
private NameAssistant nameAssistant=null;
private LocationAssistant locationAssistant=null;
private InventoryItem inventoryItem=null;
private EntryPanel entryPanel=null;
private TextBox date = null;
private TextBox complementLocation = null;
private TextBox comment = null;
 
 
 
private Cel cel = null;
 
38,28 → 49,76
getUserFromService();
}
/**
* Action initialisation
*/
public void onInit() {
 
this.onLocationSelected("all");
}
 
public void onEntryClick() {
this.entryPanel.show();
}
/**
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants
*
*/
public void onLocationSelected(String loc) {
inventoryItemList.setLocation(loc);
inventoryItemList.setDate("all");
inventoryItemList.updateCount();
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
if (entryPanel!=null) {
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
}
else {
locationAssistant.setText(loc);
}
}
else {
locationAssistant.setText(loc);
}
 
/**
* Action sur selection d'une date : affichage de la liste des taxons correspondants
*/
public void onDateSelected(String date) {
 
inventoryItemList.setDate(date);
inventoryItemList.updateCount();
 
/*
if (entryPanel!=null) {
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) {
locationAssistant.setText("");
}
else {
locationAssistant.setText(loc);
}
}
*/
}
 
/**
* Action sur ajout d'un taxon : affichage du lieu corresondant
* Action posterieure à l'affichage des observations : mise a jour affichage des localites
*/
69,8 → 128,62
locationList.updateCount();
}
/**
* Action posterieure à l'affichage des localites : mise a jour affichage des dates
*/
 
public void onLocationUpdate(String loc) {
 
dateList.setLocation(loc);
dateList.updateCount();
}
/**
* Action prealable à l'ajout d'une observation : controle presence champs requis et lancement mise a jour
*
*/
public void onAddInventoryItem() {
// TODO : singleton ?
registerInventoryItem(new InventoryItem(nameAssistant.getText(),nameAssistant.getValue(),locationAssistant.getText(),locationAssistant.getValue(),date.getText(),complementLocation.getText(),comment.getText()));
inventoryItemList.addelement();
}
 
 
public boolean inventoryItemIsValid() {
// TODO : controle date
if (inventoryItem.getName().compareTo("")==0) {
return false;
}
else {
return true;
}
}
 
/**
* Declaration InventoryItem
* @param cel
*/
 
public void registerInventoryItem(InventoryItem inventoryItem) {
this.inventoryItem=inventoryItem;
}
 
 
/**
* Declaration InventoryItemList
* @param inventoryItemList
*/
90,8 → 203,22
this.locationList=locationList;
}
/**
* Declaration DateList
* @param locationList
*/
public void registerDateList(DateList dateList) {
this.dateList=dateList;
}
 
/**
* Declaration Cel
* @param cel
*/
121,9 → 248,51
this.locationAssistant=locationAssistant;
}
 
/**
* Declaration date
* @param date
*/
public void registerDate(TextBox date) {
this.date=date;
}
/**
* Declaration complementLocation
* @param complementLocation
*/
public void registerComplementLocation(TextBox complementLocation) {
this.complementLocation=complementLocation;
}
public void registerEntryPanel(EntryPanel entryPanel) {
this.entryPanel=entryPanel;
}
 
/**
* Declaration commentaire
* @param commentaire
*/
public void registerComment(TextBox comment) {
this.comment=comment;
}
 
 
/**
* Recherche distante et asynchrone de l'utilisateur connecté, en retour lancement methode initialisation
* de l'appellant Cel. (initAsync)
*
191,6 → 360,11
return locationList;
}
 
public DateList getDateList() {
return dateList;
}
 
public NameAssistant getNameAssistant() {
return nameAssistant;
}
199,6 → 373,14
return locationAssistant;
}
 
public InventoryItem getInventoryItem() {
return inventoryItem;
}
 
public EntryPanel getEntryPanel() {
return entryPanel;
}
 
 
 
}