mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-12-22 23:41:09 +00:00
Module Client : correction bug commit update StockScreenModel; Les méthds de la clss UpdateBuilder sont désormais chainables
This commit is contained in:
parent
90985fbc46
commit
2cbe949b03
@ -35,15 +35,15 @@ class StockScreenModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void commitProductDeletion(Product product) {
|
void commitProductDeletion(Product product) {
|
||||||
|
stockService.commitUpdate(stockService.getNewUpdateBuilder().removeProduct(product));
|
||||||
}
|
}
|
||||||
|
|
||||||
void commitProductModification(Product oldProduct, Product newProduct) {
|
void commitProductModification(Product oldProduct, Product newProduct) {
|
||||||
|
stockService.commitUpdate(stockService.getNewUpdateBuilder().modifyProduct(oldProduct, newProduct));
|
||||||
}
|
}
|
||||||
|
|
||||||
void commitProductAddition(Product product) {
|
void commitProductAddition(Product product) {
|
||||||
|
stockService.commitUpdate(stockService.getNewUpdateBuilder().addProduct(product));
|
||||||
}
|
}
|
||||||
|
|
||||||
void addListener(IStockScreenModelListener l){
|
void addListener(IStockScreenModelListener l){
|
||||||
|
@ -16,20 +16,23 @@ public class UpdateBuilder {
|
|||||||
toModify = new HashMap<>();
|
toModify = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addProduct(Product product) {
|
public UpdateBuilder addProduct(Product product) {
|
||||||
if(!toAdd.contains(product)){
|
if(!toAdd.contains(product)){
|
||||||
toAdd.add(product);
|
toAdd.add(product);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeProduct(Product product) {
|
public UpdateBuilder removeProduct(Product product) {
|
||||||
if(toRemove.contains(product)){
|
if(toRemove.contains(product)){
|
||||||
toRemove.remove(product);
|
toRemove.remove(product);
|
||||||
}
|
}
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void modifyProduct(Product oldVersion, Product newVersion) {
|
public UpdateBuilder modifyProduct(Product oldVersion, Product newVersion) {
|
||||||
toModify.put(oldVersion, newVersion);
|
toModify.put(oldVersion, newVersion);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ProductUpdate> build() {
|
public List<ProductUpdate> build() {
|
||||||
|
Loading…
Reference in New Issue
Block a user