mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-22 23:41:09 +00:00
Module Client, écran Stock : correction d'un bug empêchant la mise à jour du stock de produit
This commit is contained in:
parent
4cc9d53742
commit
0c64c49f0f
@ -15,6 +15,7 @@ public class StatScreen implements IGuiModule {
|
||||
StatScreenController ctrl = new StatScreenController(model);
|
||||
view = new StatScreenView();
|
||||
|
||||
model.addListener(ctrl);
|
||||
ctrl.setView(view);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ class StatScreenModel {
|
||||
listenerList = new EventListenerList();
|
||||
this.statService.addListener(new StatListenerAdapter() {
|
||||
@Override
|
||||
public void onGetStatSuccess() {
|
||||
public void onStatChangedEvent() {
|
||||
Arrays.stream(listenerList.getListeners(IStatScreenModelListener.class)).forEach(IStatScreenModelListener::onStatisticsChangedEvent);
|
||||
}
|
||||
});
|
||||
|
@ -24,6 +24,7 @@ class StockScreenModel {
|
||||
this.stockService.addListener(new StockListenerAdapter(){
|
||||
@Override
|
||||
public void onProductListChangedEvent() {
|
||||
System.out.println("Product list changed event");
|
||||
StockScreenModel.this.fireProductCollectionChanged();
|
||||
}
|
||||
});
|
||||
@ -57,6 +58,14 @@ class StockScreenModel {
|
||||
}
|
||||
|
||||
Collection<Product> getProductCollection() {
|
||||
{//TODO delete print block
|
||||
System.out.println("------------------------------------------");
|
||||
System.out.println("Stock service's list : ");
|
||||
for(Product p : stockService.getProducts()){
|
||||
System.out.println(p);
|
||||
}
|
||||
System.out.println("------------------------------------------");
|
||||
}
|
||||
return stockService.getProducts();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class StockDao {
|
||||
executor.executeStockQuery(new ICollectionItemMessageCallback<Product>() {
|
||||
@Override
|
||||
public void ack(Collection<Product> obj) {
|
||||
replaceProductList(products);
|
||||
replaceProductList(obj);
|
||||
eventFirerer.fireGetProductListSuccessEvent();
|
||||
//TODO add log line
|
||||
}
|
||||
@ -66,7 +66,15 @@ public class StockDao {
|
||||
return lastRefreshTimestamp;
|
||||
}
|
||||
|
||||
private synchronized void replaceProductList(List<Product> products){
|
||||
private synchronized void replaceProductList(Collection<Product> products){
|
||||
{//TODO delete print block
|
||||
System.out.println("------------------------------------------");
|
||||
System.out.println("Stock dao's list : ");
|
||||
for(Product p : products){
|
||||
System.out.println(p);
|
||||
}
|
||||
System.out.println("------------------------------------------");
|
||||
}
|
||||
this.products.clear();
|
||||
this.products.addAll(products);
|
||||
this.lastRefreshTimestamp = new Date();
|
||||
|
Loading…
Reference in New Issue
Block a user