Module Client : update GUi suite modif services; Ajout clss ClientBackEndModuleManager pour gérer l'instanciation des services; Ajout TODO dans clss Main

This commit is contained in:
Notmoo-PC\Notmoo 2017-08-25 16:08:53 +02:00
parent 2161dc2b72
commit 3b735c18ae
5 changed files with 65 additions and 15 deletions

View File

@ -5,15 +5,10 @@ import com.pqt.client.gui.modules.account_screen.AccountScreen;
import com.pqt.client.gui.modules.sale_screen.SaleScreen;
import com.pqt.client.gui.modules.stat_screen.StatScreen;
import com.pqt.client.gui.modules.stock_screen.StockScreen;
import com.pqt.client.gui.ressources.components.generics.others.SideBar;
import com.pqt.client.gui.ressources.components.generics.others.listeners.ISideBarListener;
import com.pqt.client.gui.ressources.components.generics.toast.ToastFactory;
import com.pqt.client.gui.ressources.css.GUICssTool;
import com.pqt.client.gui.ressources.strings.GUIStringTool;
import com.pqt.client.module.account.AccountService;
import com.pqt.client.module.sale.SaleService;
import com.pqt.client.module.stat.StatService;
import com.pqt.client.module.stock.StockService;
import com.pqt.client.module.ClientBackEndModuleManager;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.stage.Stage;
@ -26,16 +21,15 @@ public class Main extends Application{
@Override
public void start(Stage primaryStage) throws Exception {
SaleService saleService = new SaleService();
StockService stockService = new StockService();
AccountService accountService = new AccountService();
StatService statService = new StatService();
//TODO ajouter écran de préloading
MainFrame mainFrame = new MainFrame(accountService);
mainFrame.addModule(new SaleScreen(accountService, stockService, saleService), true);
mainFrame.addModule(new StockScreen(stockService, accountService));
mainFrame.addModule(new StatScreen(statService));
mainFrame.addModule(new AccountScreen(accountService));
ClientBackEndModuleManager moduleManager = new ClientBackEndModuleManager(null);
MainFrame mainFrame = new MainFrame(moduleManager.getAccountService());
mainFrame.addModule(new SaleScreen(moduleManager.getAccountService(), moduleManager.getStockService(), moduleManager.getSaleService()), true);
mainFrame.addModule(new StockScreen(moduleManager.getStockService(), moduleManager.getAccountService()));
mainFrame.addModule(new StatScreen(moduleManager.getStatService()));
mainFrame.addModule(new AccountScreen(moduleManager.getAccountService()));
Scene scene = new Scene(mainFrame.getPane(), 800, 600);

View File

@ -23,6 +23,11 @@ class MainFrameModel {
MainFrameModel.this.fireAccountStatusChangedEvent(status);
}
@Override
public void onAccountStatusNotChangedEvent(Throwable cause) {
}
@Override
public void onAccountListChangedEvent() {
MainFrameModel.this.fireAccountCollectionChangedEvent();

View File

@ -104,6 +104,11 @@ class SaleScreenModel {
fireAccountConnectedStatusUpdateEvent();
}
@Override
public void onAccountStatusNotChangedEvent(Throwable cause) {
}
@Override
public void onAccountListChangedEvent() {
fireAccountListUpdatedEvent();

View File

@ -34,6 +34,11 @@ class StockScreenModel {
StockScreenModel.this.fireConnectedStatusChanged();
}
@Override
public void onAccountStatusNotChangedEvent(Throwable cause) {
}
@Override
public void onAccountListChangedEvent() {

View File

@ -0,0 +1,41 @@
package com.pqt.client.module;
import com.pqt.client.module.account.AccountService;
import com.pqt.client.module.connection.ConnectionService;
import com.pqt.client.module.query.QueryExecutor;
import com.pqt.client.module.sale.SaleService;
import com.pqt.client.module.stat.StatService;
import com.pqt.client.module.stock.StockService;
public class ClientBackEndModuleManager {
private SaleService saleService;
private StockService stockService;
private AccountService accountService;
private StatService statService;
public ClientBackEndModuleManager(String serverUrl) {
ConnectionService connectionService = new ConnectionService(serverUrl);
QueryExecutor queryExecutor = new QueryExecutor(connectionService);
saleService = new SaleService(queryExecutor);
stockService = new StockService(queryExecutor);
accountService = new AccountService(queryExecutor);
statService = new StatService(queryExecutor);
}
public SaleService getSaleService() {
return saleService;
}
public StockService getStockService() {
return stockService;
}
public AccountService getAccountService() {
return accountService;
}
public StatService getStatService() {
return statService;
}
}