5,11 → 5,14 |
// TODO : sortie les boutons supprimer et exporter et inclure ici |
|
import com.google.gwt.i18n.client.Dictionary; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONBoolean; |
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.Label; |
import com.google.gwt.user.client.ui.TextBox; |
|
public class Mediator { |
20,6 → 23,7 |
private InventoryItemList inventoryItemList = null; |
private LocationList locationList = null; |
private DateList dateList = null; |
private StationList stationList = null; |
private NameAssistant nameAssistant=null; |
private LocationAssistant locationAssistant=null; |
private InventoryItem inventoryItem=null; |
26,14 → 30,16 |
private EntryPanel entryPanel=null; |
private ActionPanel actionPanel=null; |
private SearchPanel searchPanel=null; |
private LoginDialog loginDialog=null; |
private TopPanel topPanel=null; |
|
private TextBox date = null; |
private TextBox complementLocation = null; |
private TextBox comment = null; |
|
boolean connected=false; |
|
|
|
private Cel cel = null; |
|
|
60,12 → 66,31 |
|
public void onInit() { |
|
|
locationList.setLocation("all"); |
locationList.updateCount(); |
|
this.onLocationSelected("all"); |
|
} |
|
|
/** |
* Action suite ajout, modification, suppression element inventaire |
*/ |
|
|
public void onInventoryUpdated(String location) { |
|
|
locationList.setLocation(location); |
locationList.updateCount(); |
|
this.onLocationSelected(location); |
|
} |
|
|
/** |
* Action sur selection d'une observation : affichage du detail |
*/ |
80,7 → 105,7 |
|
|
/** |
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants |
* Action sur recherche : affichage de la liste des taxons correspondants |
*/ |
|
public void onSearch(String search) { |
97,6 → 122,7 |
|
/** |
* Action sur selection d'un lieu : affichage de la liste des taxons correspondants |
* TODO : gerer asynchronicite ? |
*/ |
|
public void onLocationSelected(String loc) { |
103,68 → 129,86 |
|
inventoryItemList.setLocation(loc); |
inventoryItemList.setDate("all"); |
inventoryItemList.setStation("all"); |
inventoryItemList.updateCount(); |
|
dateList.setLocation(loc); |
dateList.setDate("all"); |
dateList.updateCount(); |
stationList.setLocation(loc); |
stationList.setStation("all"); |
stationList.updateCount(); |
|
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) { |
locationAssistant.setText(""); |
} |
else { |
locationAssistant.setText(loc); |
} |
|
} |
|
|
/** |
* Action sur selection d'une date : affichage de la liste des taxons correspondants |
* Action sur login |
* @param user |
*/ |
|
public void onDateSelected(String date) { |
|
inventoryItemList.setDate(date); |
inventoryItemList.updateCount(); |
public void onLogin(String user) { |
|
/* |
|
if ((loc.compareTo("000null")==0) || (loc.compareTo("all")==0)) { |
locationAssistant.setText(""); |
this.user=user; |
topPanel.getSignLabel().setText(user+ " (deconnexion)"); |
inventoryItemList.setUser(user); |
dateList.setUser(user); |
stationList.setUser(user); |
entryPanel.setUser(user); |
locationList.setUser(user); |
this.onInit(); |
|
} |
else { |
locationAssistant.setText(loc); |
} |
|
|
/** |
* Action sur logoff |
* @param user |
*/ |
|
|
public void onLogoff(String user) { |
|
this.user=user; |
topPanel.getSignLabel().setText("Connexion"); |
inventoryItemList.setUser(user); |
dateList.setUser(user); |
stationList.setUser(user); |
entryPanel.setUser(user); |
locationList.setUser(user); |
this.onInit(); |
|
} |
|
|
/** |
* Action posterieure à l'affichage des observations : mise a jour affichage des localites |
* Action sur selection d'une station : affichage de la liste des taxons correspondants |
*/ |
|
public void onStationSelected(String station) { |
|
public void onInventoryItemUpdate(String loc) { |
inventoryItemList.setStation(station); |
inventoryItemList.updateCount(); |
|
locationList.setLocation(loc); |
locationList.updateCount(); |
|
} |
|
|
|
|
/** |
* Action posterieure à l'affichage des localites : mise a jour affichage des dates |
* Action sur selection d'une date : affichage de la liste des taxons correspondants |
*/ |
|
public void onLocationUpdate(String loc) { |
public void onDateSelected(String date) { |
|
inventoryItemList.setDate(date); |
inventoryItemList.updateCount(); |
|
dateList.setLocation(loc); |
dateList.updateCount(); |
|
} |
|
|
|
|
/** |
* Action prealable à l'ajout d'une observation : controle presence champs requis et lancement mise a jour |
* |
252,7 → 296,18 |
} |
|
|
/** |
* Declaration StationList |
* @param locationList |
*/ |
|
public void registerStationList(StationList stationList) { |
|
this.stationList=stationList; |
} |
|
|
|
/** |
* Declaration Cel |
* @param cel |
325,7 → 380,18 |
this.searchPanel=searchPanel; |
} |
|
public void registerTopPanel(TopPanel topPanel) { |
this.topPanel=topPanel; |
} |
|
|
|
public void registerLoginDialog(LoginDialog loginDialog) { |
this.loginDialog=loginDialog; |
} |
|
|
|
/** |
* Declaration commentaire |
* @param commentaire |
353,9 → 419,10 |
|
public void onCompletion(String str) { |
JSONValue jsonValue = JSONParser.parse(str); |
JSONString jsonString; |
if ((jsonString = jsonValue.isString()) != null) { |
user = jsonString.stringValue(); |
JSONArray jsonArray; |
if ((jsonArray = jsonValue.isArray()) != null) { |
user = ((JSONString) jsonArray.get(0)).stringValue(); |
connected = ((JSONBoolean) jsonArray.get(1)).booleanValue(); |
} |
cel.initAsync(); |
} |
399,6 → 466,12 |
|
|
|
public void setUser(String user) { |
this.user=user; |
} |
|
|
|
public InventoryItemList getInventoryItemList() { |
return inventoryItemList; |
} |
429,5 → 502,15 |
} |
|
|
public void setConnected(boolean connected) { |
|
this.connected=connected; |
} |
|
public boolean getConnected() { |
|
return this.connected; |
} |
|
|
} |