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; |
|
|
39,16 → 50,36 |
|
} |
|
|
/** |
* 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 (entryPanel!=null) { |
|
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) { |
locationAssistant.setText(""); |
} |
58,11 → 89,39 |
|
} |
|
} |
|
|
/** |
* Action sur ajout d'un taxon : affichage du lieu corresondant |
* 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 posterieure à l'affichage des observations : mise a jour affichage des localites |
*/ |
|
|
public void onInventoryItemUpdate(String loc) { |
|
locationList.setLocation(loc); |
70,7 → 129,61 |
|
} |
|
|
/** |
* 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 |
*/ |
91,7 → 204,21 |
this.locationList=locationList; |
} |
|
|
|
/** |
* Declaration DateList |
* @param locationList |
*/ |
|
public void registerDateList(DateList dateList) { |
|
this.dateList=dateList; |
} |
|
|
|
/** |
* Declaration Cel |
* @param cel |
*/ |
123,7 → 250,49 |
} |
|
|
|
/** |
* 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; |
} |
|
|
|
} |