mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-22 08:13:20 +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);
|
StatScreenController ctrl = new StatScreenController(model);
|
||||||
view = new StatScreenView();
|
view = new StatScreenView();
|
||||||
|
|
||||||
|
model.addListener(ctrl);
|
||||||
ctrl.setView(view);
|
ctrl.setView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ class StatScreenModel {
|
|||||||
listenerList = new EventListenerList();
|
listenerList = new EventListenerList();
|
||||||
this.statService.addListener(new StatListenerAdapter() {
|
this.statService.addListener(new StatListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void onGetStatSuccess() {
|
public void onStatChangedEvent() {
|
||||||
Arrays.stream(listenerList.getListeners(IStatScreenModelListener.class)).forEach(IStatScreenModelListener::onStatisticsChangedEvent);
|
Arrays.stream(listenerList.getListeners(IStatScreenModelListener.class)).forEach(IStatScreenModelListener::onStatisticsChangedEvent);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -24,6 +24,7 @@ class StockScreenModel {
|
|||||||
this.stockService.addListener(new StockListenerAdapter(){
|
this.stockService.addListener(new StockListenerAdapter(){
|
||||||
@Override
|
@Override
|
||||||
public void onProductListChangedEvent() {
|
public void onProductListChangedEvent() {
|
||||||
|
System.out.println("Product list changed event");
|
||||||
StockScreenModel.this.fireProductCollectionChanged();
|
StockScreenModel.this.fireProductCollectionChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -57,6 +58,14 @@ class StockScreenModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Collection<Product> getProductCollection() {
|
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();
|
return stockService.getProducts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public class StockDao {
|
|||||||
executor.executeStockQuery(new ICollectionItemMessageCallback<Product>() {
|
executor.executeStockQuery(new ICollectionItemMessageCallback<Product>() {
|
||||||
@Override
|
@Override
|
||||||
public void ack(Collection<Product> obj) {
|
public void ack(Collection<Product> obj) {
|
||||||
replaceProductList(products);
|
replaceProductList(obj);
|
||||||
eventFirerer.fireGetProductListSuccessEvent();
|
eventFirerer.fireGetProductListSuccessEvent();
|
||||||
//TODO add log line
|
//TODO add log line
|
||||||
}
|
}
|
||||||
@ -66,7 +66,15 @@ public class StockDao {
|
|||||||
return lastRefreshTimestamp;
|
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.clear();
|
||||||
this.products.addAll(products);
|
this.products.addAll(products);
|
||||||
this.lastRefreshTimestamp = new Date();
|
this.lastRefreshTimestamp = new Date();
|
||||||
|
Loading…
Reference in New Issue
Block a user