mirror of
https://github.com/klmp200/PQT_Gestionnaire_vente_stock.git
synced 2024-11-16 21:33:21 +00:00
Module Client : test de l'écran de composition des ventes; correction bugs; ajout fichier css; réorganisation packages
This commit is contained in:
parent
0eef751c41
commit
d1fdc64cad
32
Workspace/client/src/main/java/com/pqt/client/Main.java
Normal file
32
Workspace/client/src/main/java/com/pqt/client/Main.java
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
package com.pqt.client;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.modules.sale_screen.SaleScreen;
|
||||||
|
import com.pqt.client.gui.ressources.css.GUICssTool;
|
||||||
|
import com.pqt.client.module.account.AccountService;
|
||||||
|
import com.pqt.client.module.sale.SaleService;
|
||||||
|
import com.pqt.client.module.stock.StockService;
|
||||||
|
import javafx.application.Application;
|
||||||
|
import javafx.scene.Scene;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
|
public class Main extends Application{
|
||||||
|
|
||||||
|
public static void main(String[] args){
|
||||||
|
launch(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
SaleService saleService = new SaleService();
|
||||||
|
StockService stockService = new StockService();
|
||||||
|
AccountService accountService = new AccountService();
|
||||||
|
|
||||||
|
SaleScreen saleScreen = new SaleScreen(accountService, stockService, saleService);
|
||||||
|
Scene scene = new Scene(saleScreen.getPane(), 800, 600);
|
||||||
|
scene.getStylesheets().clear();
|
||||||
|
scene.getStylesheets().addAll(getClass().getResource(GUICssTool.getCssFilePath()).toExternalForm());
|
||||||
|
|
||||||
|
primaryStage.setScene(scene);
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.pqt.client.gui.modules.sale_screen;
|
package com.pqt.client.gui.modules.sale_screen;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.IFXComponent;
|
import com.pqt.client.gui.ressources.components.generics.IFXComponent;
|
||||||
import com.pqt.client.module.account.AccountService;
|
import com.pqt.client.module.account.AccountService;
|
||||||
import com.pqt.client.module.sale.SaleService;
|
import com.pqt.client.module.sale.SaleService;
|
||||||
import com.pqt.client.module.stock.StockService;
|
import com.pqt.client.module.stock.StockService;
|
||||||
@ -8,16 +8,15 @@ import javafx.scene.layout.Pane;
|
|||||||
|
|
||||||
public class SaleScreen implements IFXComponent {
|
public class SaleScreen implements IFXComponent {
|
||||||
|
|
||||||
private SaleScreenModel model;
|
|
||||||
private SaleScreenController ctrl;
|
|
||||||
private SaleScreenView view;
|
private SaleScreenView view;
|
||||||
|
|
||||||
public SaleScreen(AccountService accountService, StockService stockService, SaleService saleService) {
|
public SaleScreen(AccountService accountService, StockService stockService, SaleService saleService) {
|
||||||
model = new SaleScreenModel(accountService, stockService, saleService);
|
SaleScreenModel model = new SaleScreenModel(accountService, stockService, saleService);
|
||||||
ctrl = new SaleScreenController(model);
|
SaleScreenController ctrl = new SaleScreenController(model);
|
||||||
view = new SaleScreenView(ctrl);
|
view = new SaleScreenView(ctrl);
|
||||||
|
|
||||||
ctrl.setView(view);
|
ctrl.setView(view);
|
||||||
|
ctrl.updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
package com.pqt.client.gui.modules.sale_screen;
|
package com.pqt.client.gui.modules.sale_screen;
|
||||||
|
|
||||||
import com.pqt.client.gui.modules.sale_screen.listeners.ISaleScreenModelListener;
|
import com.pqt.client.gui.modules.sale_screen.listeners.ISaleScreenModelListener;
|
||||||
import com.pqt.client.gui.ressources.components.sale_validation_screen.listeners.ISaleValidationScreenListener;
|
import com.pqt.client.gui.modules.sale_screen.sale_validation_screen.listeners.ISaleValidationScreenListener;
|
||||||
import com.pqt.client.gui.ressources.specifics.products.listeners.IStockComponentListener;
|
import com.pqt.client.gui.ressources.components.specifics.products.listeners.IStockComponentListener;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.IValidatorComponentListener;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.IValidatorComponentListener;
|
||||||
import com.pqt.client.gui.ressources.specifics.sale.listeners.ISaleComponentListener;
|
import com.pqt.client.gui.ressources.components.specifics.sale.listeners.ISaleComponentListener;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
import com.pqt.core.entities.sale.Sale;
|
import com.pqt.core.entities.sale.Sale;
|
||||||
import com.pqt.core.entities.sale.SaleStatus;
|
import com.pqt.core.entities.sale.SaleStatus;
|
||||||
@ -13,7 +12,6 @@ import com.pqt.core.entities.sale.SaleType;
|
|||||||
import com.pqt.core.entities.user_account.Account;
|
import com.pqt.core.entities.user_account.Account;
|
||||||
import com.pqt.core.entities.user_account.AccountLevel;
|
import com.pqt.core.entities.user_account.AccountLevel;
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -73,6 +71,8 @@ class SaleScreenController {
|
|||||||
view.setAccounts(fetchAccountList());
|
view.setAccounts(fetchAccountList());
|
||||||
|
|
||||||
view.setSale(getCurrentSale());
|
view.setSale(getCurrentSale());
|
||||||
|
|
||||||
|
view.setValidationButtonEnabled(model.checkValidity(getCurrentSale()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Product> fetchProductList(){
|
private List<Product> fetchProductList(){
|
||||||
@ -140,7 +140,7 @@ class SaleScreenController {
|
|||||||
return new IValidatorComponentListener() {
|
return new IValidatorComponentListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onValidationEvent() {
|
public void onValidationEvent() {
|
||||||
model.commitSale();
|
if(model.commitSale())
|
||||||
view.switchToSaleValidationWaitingMode(model.getTempSaleId(), model.getCurrentSale());
|
view.switchToSaleValidationWaitingMode(model.getTempSaleId(), model.getCurrentSale());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@ class SaleScreenModel {
|
|||||||
private long tempSaleId;
|
private long tempSaleId;
|
||||||
|
|
||||||
SaleScreenModel(AccountService accountService, StockService stockService, SaleService saleService) {
|
SaleScreenModel(AccountService accountService, StockService stockService, SaleService saleService) {
|
||||||
|
if(accountService==null || stockService==null || saleService==null)
|
||||||
|
throw new NullPointerException("At least one of the following services is null : account, stock, sale");
|
||||||
|
|
||||||
|
listeners = new EventListenerList();
|
||||||
this.accountService = accountService;
|
this.accountService = accountService;
|
||||||
this.stockService = stockService;
|
this.stockService = stockService;
|
||||||
this.saleService = saleService;
|
this.saleService = saleService;
|
||||||
@ -104,6 +108,8 @@ class SaleScreenModel {
|
|||||||
fireAccountListUpdatedEvent();
|
fireAccountListUpdatedEvent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clearSale();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireSaleValidatedEvent() {
|
private void fireSaleValidatedEvent() {
|
||||||
@ -135,7 +141,7 @@ class SaleScreenModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sale getCurrentSale() {
|
Sale getCurrentSale() {
|
||||||
return currentSaleBuilder.build();
|
return currentSaleBuilder!=null?currentSaleBuilder.build():null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Product> getProductList() {
|
List<Product> getProductList() {
|
||||||
@ -143,15 +149,29 @@ class SaleScreenModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void clearSale() {
|
void clearSale() {
|
||||||
currentSaleBuilder = saleService.getNewSaleBuilder();
|
currentSaleBuilder = getNewSaleBuilder();
|
||||||
currentSaleBuilder.orderedBy(accountService.getCurrentAccount());
|
|
||||||
currentSaleBuilder.saleType(SaleType.CASH);
|
|
||||||
|
|
||||||
tempSaleId = -1;
|
tempSaleId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void commitSale() {
|
private SaleBuilder getNewSaleBuilder(){
|
||||||
|
SaleBuilder saleBuilder = saleService.getNewSaleBuilder();
|
||||||
|
saleBuilder.orderedBy(accountService.getCurrentAccount());
|
||||||
|
saleBuilder.saleType(SaleType.CASH);
|
||||||
|
return saleBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean commitSale() {
|
||||||
|
if(!checkValidity(currentSaleBuilder.build()))
|
||||||
|
return false;
|
||||||
|
|
||||||
tempSaleId = saleService.commitSale(currentSaleBuilder);
|
tempSaleId = saleService.commitSale(currentSaleBuilder);
|
||||||
|
return tempSaleId!=-1;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean checkValidity(Sale sale) {
|
||||||
|
return sale.getProducts().size()>0
|
||||||
|
&& sale.getOrderedBy()!=null
|
||||||
|
&& sale.getType()!=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
long getTempSaleId(){
|
long getTempSaleId(){
|
||||||
@ -159,18 +179,22 @@ class SaleScreenModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void addProductToSale(Product product) {
|
void addProductToSale(Product product) {
|
||||||
|
if(currentSaleBuilder!=null)
|
||||||
currentSaleBuilder.addProduct(product);
|
currentSaleBuilder.addProduct(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
void removeProductFromSale(Product product) {
|
void removeProductFromSale(Product product) {
|
||||||
|
if(currentSaleBuilder!=null)
|
||||||
currentSaleBuilder.removeProduct(product);
|
currentSaleBuilder.removeProduct(product);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSaleType(SaleType saleType) {
|
void setSaleType(SaleType saleType) {
|
||||||
|
if(currentSaleBuilder!=null)
|
||||||
currentSaleBuilder.saleType(saleType);
|
currentSaleBuilder.saleType(saleType);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSaleBeneficiary(Account saleBeneficiary) {
|
void setSaleBeneficiary(Account saleBeneficiary) {
|
||||||
|
if(currentSaleBuilder!=null)
|
||||||
currentSaleBuilder.orderedFor(saleBeneficiary);
|
currentSaleBuilder.orderedFor(saleBeneficiary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
package com.pqt.client.gui.modules.sale_screen;
|
package com.pqt.client.gui.modules.sale_screen;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.components.sale_validation_screen.SaleValidationScreen;
|
import com.pqt.client.gui.modules.sale_screen.sale_validation_screen.SaleValidationScreen;
|
||||||
import com.pqt.client.gui.ressources.components.CommandComposerSaleDisplayer;
|
import com.pqt.client.gui.ressources.components.CommandComposerSaleDisplayer;
|
||||||
import com.pqt.client.gui.ressources.components.SimpleValidator;
|
import com.pqt.client.gui.ressources.components.SimpleValidator;
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.javafx_override.CssEnabledGridPane;
|
||||||
import com.pqt.client.gui.ressources.css.GUICssTool;
|
import com.pqt.client.gui.ressources.css.GUICssTool;
|
||||||
import com.pqt.client.gui.ressources.generics.IFXComponent;
|
import com.pqt.client.gui.ressources.components.generics.IFXComponent;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.client.gui.ressources.components.CategoryTabStockDisplayer;
|
import com.pqt.client.gui.ressources.components.CategoryTabStockDisplayer;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
@ -14,6 +15,7 @@ import com.pqt.core.entities.sale.SaleType;
|
|||||||
import com.pqt.core.entities.user_account.Account;
|
import com.pqt.core.entities.user_account.Account;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.layout.*;
|
import javafx.scene.layout.*;
|
||||||
@ -35,6 +37,7 @@ class SaleScreenView implements IFXComponent {
|
|||||||
private ChoiceBox<Account> saleBeneficiaryAccountDisplayer;
|
private ChoiceBox<Account> saleBeneficiaryAccountDisplayer;
|
||||||
private ChoiceBox<SaleType> saleTypeDisplayer;
|
private ChoiceBox<SaleType> saleTypeDisplayer;
|
||||||
private TextField salePriceDisplayer;
|
private TextField salePriceDisplayer;
|
||||||
|
private SimpleValidator validator;
|
||||||
|
|
||||||
SaleScreenView(SaleScreenController ctrl) {
|
SaleScreenView(SaleScreenController ctrl) {
|
||||||
this.ctrl = ctrl;
|
this.ctrl = ctrl;
|
||||||
@ -43,6 +46,7 @@ class SaleScreenView implements IFXComponent {
|
|||||||
|
|
||||||
private void initGui() {
|
private void initGui() {
|
||||||
mainPane = new StackPane();
|
mainPane = new StackPane();
|
||||||
|
mainPane.getStyleClass().add("main-module-pane");
|
||||||
|
|
||||||
mainPaneContent = new BorderPane();
|
mainPaneContent = new BorderPane();
|
||||||
|
|
||||||
@ -50,7 +54,6 @@ class SaleScreenView implements IFXComponent {
|
|||||||
-----------------------CENTER PANE-----------------------
|
-----------------------CENTER PANE-----------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
mainPane.getChildren().add(mainPaneContent);
|
|
||||||
mainPaneContent.prefWidthProperty().bind(mainPane.widthProperty());
|
mainPaneContent.prefWidthProperty().bind(mainPane.widthProperty());
|
||||||
mainPaneContent.prefHeightProperty().bind(mainPane.heightProperty());
|
mainPaneContent.prefHeightProperty().bind(mainPane.heightProperty());
|
||||||
|
|
||||||
@ -72,7 +75,9 @@ class SaleScreenView implements IFXComponent {
|
|||||||
-----------------------BOTTOM PANE-----------------------
|
-----------------------BOTTOM PANE-----------------------
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
AnchorPane mainContentBottomPane = new AnchorPane();
|
HBox mainContentBottomPane = new HBox();
|
||||||
|
mainContentBottomPane.setFillHeight(true);
|
||||||
|
mainContentBottomPane.setAlignment(Pos.CENTER);
|
||||||
// Sale secondary data configuration (author, beneficiary, payment type, etc...
|
// Sale secondary data configuration (author, beneficiary, payment type, etc...
|
||||||
{
|
{
|
||||||
saleMakerAccountDisplayer = new TextField();
|
saleMakerAccountDisplayer = new TextField();
|
||||||
@ -96,30 +101,29 @@ class SaleScreenView implements IFXComponent {
|
|||||||
salePriceDisplayer.setPromptText(GUIStringTool.getSalePriceTextFieldPromptText());
|
salePriceDisplayer.setPromptText(GUIStringTool.getSalePriceTextFieldPromptText());
|
||||||
|
|
||||||
|
|
||||||
GridPane mainContentBottomLeftPane = new GridPane();
|
GridPane mainContentBottomCenterPane = new CssEnabledGridPane();
|
||||||
mainContentBottomLeftPane.add(new Label(GUIStringTool.getSaleMakerTextFieldLabel()), 0, 0);
|
mainContentBottomCenterPane.add(new Label(GUIStringTool.getSaleMakerTextFieldLabel()), 0, 0);
|
||||||
mainContentBottomLeftPane.add(saleMakerAccountDisplayer, 1, 0);
|
mainContentBottomCenterPane.add(saleMakerAccountDisplayer, 1, 0);
|
||||||
mainContentBottomLeftPane.add(new Label(GUIStringTool.getSaleBeneficiaryTextFieldLabel()), 0, 1);
|
mainContentBottomCenterPane.add(new Label(GUIStringTool.getSaleBeneficiaryTextFieldLabel()), 0, 1);
|
||||||
mainContentBottomLeftPane.add(saleBeneficiaryAccountDisplayer, 1, 1);
|
mainContentBottomCenterPane.add(saleBeneficiaryAccountDisplayer, 1, 1);
|
||||||
mainContentBottomLeftPane.add(new Label(GUIStringTool.getSaleTypeTextFieldLabel()), 0, 2);
|
mainContentBottomCenterPane.add(new Label(GUIStringTool.getSaleTypeTextFieldLabel()), 0, 2);
|
||||||
mainContentBottomLeftPane.add(saleTypeDisplayer, 1, 2);
|
mainContentBottomCenterPane.add(saleTypeDisplayer, 1, 2);
|
||||||
mainContentBottomLeftPane.add(new Label(GUIStringTool.getSalePriceTextFieldLabel()), 0, 3);
|
mainContentBottomCenterPane.add(new Label(GUIStringTool.getSalePriceTextFieldLabel()), 0, 3);
|
||||||
mainContentBottomLeftPane.add(salePriceDisplayer, 1, 3);
|
mainContentBottomCenterPane.add(salePriceDisplayer, 1, 3);
|
||||||
|
|
||||||
mainContentBottomPane.getChildren().add(mainContentBottomLeftPane);
|
mainContentBottomPane.getChildren().add(mainContentBottomCenterPane);
|
||||||
AnchorPane.setBottomAnchor(mainContentBottomLeftPane, 0d);
|
|
||||||
AnchorPane.setTopAnchor(mainContentBottomLeftPane, 0d);
|
|
||||||
AnchorPane.setLeftAnchor(mainContentBottomLeftPane, 0d);
|
|
||||||
}
|
}
|
||||||
//Sale Validator
|
//Sale Validator
|
||||||
{
|
{
|
||||||
SimpleValidator validator = new SimpleValidator(true);
|
AnchorPane anchorPane = new AnchorPane();
|
||||||
|
validator = new SimpleValidator(true);
|
||||||
validator.addListener(ctrl.getValidatorListener());
|
validator.addListener(ctrl.getValidatorListener());
|
||||||
|
anchorPane.getChildren().add(validator.getPane());
|
||||||
mainContentBottomPane.getChildren().add(validator.getPane());
|
|
||||||
AnchorPane.setBottomAnchor(validator.getPane(), 0d);
|
|
||||||
AnchorPane.setTopAnchor(validator.getPane(), 0d);
|
|
||||||
AnchorPane.setRightAnchor(validator.getPane(), 0d);
|
AnchorPane.setRightAnchor(validator.getPane(), 0d);
|
||||||
|
AnchorPane.setBottomAnchor(validator.getPane(), 0d);
|
||||||
|
|
||||||
|
mainContentBottomPane.getChildren().add(anchorPane);
|
||||||
|
HBox.setHgrow(anchorPane, Priority.ALWAYS);
|
||||||
}
|
}
|
||||||
mainPaneContent.setBottom(mainContentBottomPane);
|
mainPaneContent.setBottom(mainContentBottomPane);
|
||||||
}
|
}
|
||||||
@ -127,11 +131,6 @@ class SaleScreenView implements IFXComponent {
|
|||||||
------------------------MAIN PANE------------------------
|
------------------------MAIN PANE------------------------
|
||||||
*/
|
*/
|
||||||
mainPane.getChildren().add(mainPaneContent);
|
mainPane.getChildren().add(mainPaneContent);
|
||||||
|
|
||||||
/*
|
|
||||||
-------------------------UPDATE--------------------------
|
|
||||||
*/
|
|
||||||
ctrl.updateView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -143,7 +142,8 @@ class SaleScreenView implements IFXComponent {
|
|||||||
boolean clearChildren = mainPane.getChildren().size()>1;
|
boolean clearChildren = mainPane.getChildren().size()>1;
|
||||||
|
|
||||||
Pane greyIntermediaryPane = new Pane();
|
Pane greyIntermediaryPane = new Pane();
|
||||||
greyIntermediaryPane.setId(GUICssTool.getGreyIntermediaryPaneCssId());
|
greyIntermediaryPane.getStyleClass().clear();
|
||||||
|
greyIntermediaryPane.getStyleClass().add("grey-intermediary-pane");
|
||||||
|
|
||||||
saleValidationScreen = new SaleValidationScreen(saleId, sale);
|
saleValidationScreen = new SaleValidationScreen(saleId, sale);
|
||||||
saleValidationScreen.addListener(ctrl.getSaleValidationScreenListener());
|
saleValidationScreen.addListener(ctrl.getSaleValidationScreenListener());
|
||||||
@ -153,6 +153,7 @@ class SaleScreenView implements IFXComponent {
|
|||||||
mainPane.getChildren().add(mainPaneContent);
|
mainPane.getChildren().add(mainPaneContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StackPane.setAlignment(saleValidationScreen.getPane(), Pos.CENTER);
|
||||||
mainPane.getChildren().addAll(greyIntermediaryPane, saleValidationScreen.getPane());
|
mainPane.getChildren().addAll(greyIntermediaryPane, saleValidationScreen.getPane());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -173,6 +174,7 @@ class SaleScreenView implements IFXComponent {
|
|||||||
void setSaleTypes(List<SaleType> saleTypes) {
|
void setSaleTypes(List<SaleType> saleTypes) {
|
||||||
Platform.runLater(()->{
|
Platform.runLater(()->{
|
||||||
saleTypeDisplayer.getItems().clear();
|
saleTypeDisplayer.getItems().clear();
|
||||||
|
if(saleTypes!=null)
|
||||||
saleTypeDisplayer.getItems().addAll(saleTypes);
|
saleTypeDisplayer.getItems().addAll(saleTypes);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -181,11 +183,13 @@ class SaleScreenView implements IFXComponent {
|
|||||||
Platform.runLater(()->{
|
Platform.runLater(()->{
|
||||||
saleBeneficiaryAccountDisplayer.getItems().clear();
|
saleBeneficiaryAccountDisplayer.getItems().clear();
|
||||||
saleBeneficiaryAccountDisplayer.getItems().add(ctrl.getDefaultAccount());
|
saleBeneficiaryAccountDisplayer.getItems().add(ctrl.getDefaultAccount());
|
||||||
|
if(accounts!=null)
|
||||||
saleBeneficiaryAccountDisplayer.getItems().addAll(accounts);
|
saleBeneficiaryAccountDisplayer.getItems().addAll(accounts);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSale(Sale sale) {
|
void setSale(Sale sale) {
|
||||||
|
if(sale!=null) {
|
||||||
saleDisplayer.display(sale);
|
saleDisplayer.display(sale);
|
||||||
|
|
||||||
String price = GUIStringTool.getPriceRenderer().render(sale.getTotalPrice());
|
String price = GUIStringTool.getPriceRenderer().render(sale.getTotalPrice());
|
||||||
@ -199,6 +203,7 @@ class SaleScreenView implements IFXComponent {
|
|||||||
selectElement(saleBeneficiaryAccountDisplayer, sale.getOrderedFor());
|
selectElement(saleBeneficiaryAccountDisplayer, sale.getOrderedFor());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> void selectElement(ChoiceBox<T> choiceBox, T element){
|
private <T> void selectElement(ChoiceBox<T> choiceBox, T element){
|
||||||
if(element!=null){
|
if(element!=null){
|
||||||
@ -212,4 +217,8 @@ class SaleScreenView implements IFXComponent {
|
|||||||
void setSaleStatus(SaleStatus status){
|
void setSaleStatus(SaleStatus status){
|
||||||
this.saleValidationScreen.setSaleStatus(status);
|
this.saleValidationScreen.setSaleStatus(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setValidationButtonEnabled(boolean validationButtonEnabled) {
|
||||||
|
validator.setValidationButtonEnable(validationButtonEnabled);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
package com.pqt.client.gui.ressources.components.sale_validation_screen;
|
package com.pqt.client.gui.modules.sale_screen.sale_validation_screen;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.components.sale_validation_screen.listeners.ISaleValidationScreenListener;
|
import com.pqt.client.gui.modules.sale_screen.sale_validation_screen.listeners.ISaleValidationScreenListener;
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.javafx_override.CssEnabledGridPane;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.core.entities.sale.Sale;
|
import com.pqt.core.entities.sale.Sale;
|
||||||
import com.pqt.core.entities.sale.SaleStatus;
|
import com.pqt.core.entities.sale.SaleStatus;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.control.ProgressIndicator;
|
import javafx.scene.control.ProgressIndicator;
|
||||||
@ -31,9 +33,12 @@ public class SaleValidationScreen {
|
|||||||
listeners = new EventListenerList();
|
listeners = new EventListenerList();
|
||||||
mainPane = new Pane();
|
mainPane = new Pane();
|
||||||
|
|
||||||
|
saleStatus = sale.getStatus();
|
||||||
|
|
||||||
BorderPane mainPaneContent = new BorderPane();
|
BorderPane mainPaneContent = new BorderPane();
|
||||||
|
|
||||||
GridPane centerPane = new GridPane();
|
GridPane centerPane = new CssEnabledGridPane();
|
||||||
|
centerPane.setAlignment(Pos.CENTER);
|
||||||
|
|
||||||
Label saleIdLabel = new Label(GUIStringTool.getSaleIdLabel());
|
Label saleIdLabel = new Label(GUIStringTool.getSaleIdLabel());
|
||||||
centerPane.add(saleIdLabel, 0, 0);
|
centerPane.add(saleIdLabel, 0, 0);
|
||||||
@ -45,24 +50,29 @@ public class SaleValidationScreen {
|
|||||||
Label saleStatusLabel = new Label(GUIStringTool.getSaleStatusLabel());
|
Label saleStatusLabel = new Label(GUIStringTool.getSaleStatusLabel());
|
||||||
centerPane.add(saleStatusLabel, 0, 1);
|
centerPane.add(saleStatusLabel, 0, 1);
|
||||||
|
|
||||||
saleStatusTextField = new TextField(GUIStringTool.getSaleStatusRenderer().render(SaleStatus.PENDING));
|
saleStatusTextField = new TextField(GUIStringTool.getSaleStatusRenderer().render(saleStatus));
|
||||||
saleStatusTextField.setEditable(false);
|
saleStatusTextField.setEditable(false);
|
||||||
centerPane.add(saleStatusTextField, 1, 1);
|
centerPane.add(saleStatusTextField, 1, 1);
|
||||||
|
|
||||||
|
validationButton = new Button(GUIStringTool.getOkButtonLabel());
|
||||||
|
validationButton.setDisable(saleStatus.equals(SaleStatus.PENDING));
|
||||||
|
validationButton.setOnMouseClicked(event->fireScreenClose(saleStatus.equals(SaleStatus.ACCEPTED)));
|
||||||
|
centerPane.add(validationButton, 1,2);
|
||||||
|
|
||||||
mainPaneContent.setCenter(centerPane);
|
mainPaneContent.setCenter(centerPane);
|
||||||
|
|
||||||
progressIndicator = new ProgressIndicator();
|
progressIndicator = new ProgressIndicator();
|
||||||
progressIndicator.setPrefSize(50, 50);
|
|
||||||
mainPaneContent.setLeft(progressIndicator);
|
mainPaneContent.setLeft(progressIndicator);
|
||||||
|
|
||||||
validationButton = new Button(GUIStringTool.getOkButtonLabel());
|
mainPaneContent.prefHeightProperty().bind(mainPane.heightProperty());
|
||||||
validationButton.setOnMouseClicked(event->fireScreenClose(saleStatus.equals(SaleStatus.ACCEPTED)));
|
mainPaneContent.prefWidthProperty().bind(mainPane.widthProperty());
|
||||||
|
mainPane.getChildren().add(mainPaneContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireScreenClose(boolean saleValidateddSuccessFully) {
|
private void fireScreenClose(boolean saleValidatedSuccessFully) {
|
||||||
if(!validationButton.isDisable()){
|
if(!validationButton.isDisable()){
|
||||||
Arrays.stream(listeners.getListeners(ISaleValidationScreenListener.class))
|
Arrays.stream(listeners.getListeners(ISaleValidationScreenListener.class))
|
||||||
.forEach(listener->listener.onScreenClose(saleValidateddSuccessFully));
|
.forEach(listener->listener.onScreenClose(saleValidatedSuccessFully));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.components.sale_validation_screen.listeners;
|
package com.pqt.client.gui.modules.sale_screen.sale_validation_screen.listeners;
|
||||||
|
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
|
|
@ -1,12 +1,12 @@
|
|||||||
package com.pqt.client.gui.ressources.components;
|
package com.pqt.client.gui.ressources.components;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.creators.IFXCreatorComponent;
|
import com.pqt.client.gui.ressources.components.generics.creators.IFXCreatorComponent;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.IFXValidatorComponent;
|
import com.pqt.client.gui.ressources.components.generics.validators.IFXValidatorComponent;
|
||||||
import com.pqt.client.gui.ressources.specifics.account.listeners.IAccountComponentListener;
|
import com.pqt.client.gui.ressources.components.specifics.account.listeners.IAccountComponentListener;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.IValidatorComponentListener;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.IValidatorComponentListener;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.SimpleValidatorComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.SimpleValidatorComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.specifics.account.IFXAccountsDisplayerComponent;
|
import com.pqt.client.gui.ressources.components.specifics.account.IFXAccountsDisplayerComponent;
|
||||||
import com.pqt.client.gui.ressources.specifics.account.listeners.SimpleAccountComponentFirerer;
|
import com.pqt.client.gui.ressources.components.specifics.account.listeners.SimpleAccountComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.core.entities.user_account.Account;
|
import com.pqt.core.entities.user_account.Account;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package com.pqt.client.gui.ressources.components;
|
package com.pqt.client.gui.ressources.components;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.IFXDisplayerComponent;
|
import com.pqt.client.gui.ressources.components.generics.displayers.IFXDisplayerComponent;
|
||||||
import com.pqt.client.gui.ressources.specifics.products.listeners.IStockComponentListener;
|
import com.pqt.client.gui.ressources.components.specifics.products.listeners.IStockComponentListener;
|
||||||
import com.pqt.client.gui.ressources.specifics.products.listeners.SimpleStockComponentFirerer;
|
import com.pqt.client.gui.ressources.components.specifics.products.listeners.SimpleStockComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.client.gui.ressources.strings.IObjectStringRenderer;
|
import com.pqt.client.gui.ressources.strings.IObjectStringRenderer;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
import javafx.collections.ObservableList;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -64,8 +66,17 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent<Collecti
|
|||||||
|
|
||||||
private void init(){
|
private void init(){
|
||||||
mainPane = new BorderPane();
|
mainPane = new BorderPane();
|
||||||
|
mainPane.getStyleClass().add("stock-displayer");
|
||||||
|
|
||||||
Label title = new Label(GUIStringTool.getCategorytabStockDisplayerTitle());
|
Label title = new Label(GUIStringTool.getCategorytabStockDisplayerTitle());
|
||||||
mainPane.setTop(title);
|
title.setAlignment(Pos.CENTER);
|
||||||
|
|
||||||
|
HBox topPane = new HBox();
|
||||||
|
topPane.setFillHeight(true);
|
||||||
|
topPane.setAlignment(Pos.CENTER);
|
||||||
|
topPane.getChildren().add(title);
|
||||||
|
|
||||||
|
mainPane.setTop(topPane);
|
||||||
|
|
||||||
tabPane = new TabPane();
|
tabPane = new TabPane();
|
||||||
mainPane.setCenter(tabPane);
|
mainPane.setCenter(tabPane);
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
package com.pqt.client.gui.ressources.components;
|
package com.pqt.client.gui.ressources.components;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.specifics.sale.IFXSaleDisplayerComponent;
|
import com.pqt.client.gui.ressources.components.specifics.sale.IFXSaleDisplayerComponent;
|
||||||
import com.pqt.client.gui.ressources.specifics.sale.listeners.ISaleComponentListener;
|
import com.pqt.client.gui.ressources.components.specifics.sale.listeners.ISaleComponentListener;
|
||||||
import com.pqt.client.gui.ressources.specifics.sale.listeners.SimpleSaleComponentFirerer;
|
import com.pqt.client.gui.ressources.components.specifics.sale.listeners.SimpleSaleComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
import com.pqt.core.entities.sale.Sale;
|
import com.pqt.core.entities.sale.Sale;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
|
import javafx.geometry.Pos;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -30,8 +32,16 @@ public class CommandComposerSaleDisplayer implements IFXSaleDisplayerComponent {
|
|||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
mainPane = new BorderPane();
|
mainPane = new BorderPane();
|
||||||
|
mainPane.getStyleClass().add("sale-displayer");
|
||||||
|
|
||||||
Label title = new Label(GUIStringTool.getCommandComposerTitleTitle());
|
Label title = new Label(GUIStringTool.getCommandComposerTitleTitle());
|
||||||
mainPane.setTop(title);
|
|
||||||
|
HBox topPane = new HBox();
|
||||||
|
topPane.setFillHeight(true);
|
||||||
|
topPane.setAlignment(Pos.CENTER);
|
||||||
|
topPane.getChildren().add(title);
|
||||||
|
|
||||||
|
mainPane.setTop(topPane);
|
||||||
|
|
||||||
listView = new ListView<>();
|
listView = new ListView<>();
|
||||||
listView.setCellFactory(list->new ListCell<Product>(){
|
listView.setCellFactory(list->new ListCell<Product>(){
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package com.pqt.client.gui.ressources.components;
|
package com.pqt.client.gui.ressources.components;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.validators.IFXValidatorComponent;
|
import com.pqt.client.gui.ressources.components.generics.validators.IFXValidatorComponent;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.IValidatorComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.IValidatorComponentFirerer;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.IValidatorComponentListener;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.IValidatorComponentListener;
|
||||||
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
import com.pqt.client.gui.ressources.strings.GUIStringTool;
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.SimpleValidatorComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.SimpleValidatorComponentFirerer;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
import javafx.scene.control.Button;
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.HBox;
|
import javafx.scene.layout.HBox;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
||||||
@ -24,7 +25,6 @@ public class SimpleValidator implements IFXValidatorComponent {
|
|||||||
public SimpleValidator(boolean askConfirmation) {
|
public SimpleValidator(boolean askConfirmation) {
|
||||||
firerer = new SimpleValidatorComponentFirerer();
|
firerer = new SimpleValidatorComponentFirerer();
|
||||||
this.askConfirmation = askConfirmation;
|
this.askConfirmation = askConfirmation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -45,21 +45,22 @@ public class SimpleValidator implements IFXValidatorComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Pane createPane(){
|
private Pane createPane(){
|
||||||
HBox hbox = new HBox();
|
GridPane grid = new GridPane();
|
||||||
|
grid.getStyleClass().add("validator");
|
||||||
|
|
||||||
validationButton = new Button(GUIStringTool.getValidationButtonLabel());
|
validationButton = new Button(GUIStringTool.getValidationButtonLabel());
|
||||||
validationButton.setOnMouseClicked(event->{
|
validationButton.setOnMouseClicked(event->{
|
||||||
getValidationButtonProcess().process();
|
getValidationButtonProcess().process();
|
||||||
});
|
});
|
||||||
hbox.getChildren().add(validationButton);
|
grid.add(validationButton, 0,0);
|
||||||
|
|
||||||
cancelButton = new Button(GUIStringTool.getCancelButtonLabel());
|
cancelButton = new Button(GUIStringTool.getCancelButtonLabel());
|
||||||
cancelButton.setOnMouseClicked(event->{
|
cancelButton.setOnMouseClicked(event->{
|
||||||
getCancelButtonProcess().process();
|
getCancelButtonProcess().process();
|
||||||
});
|
});
|
||||||
hbox.getChildren().add(cancelButton);
|
grid.add(cancelButton, 1, 0);
|
||||||
|
|
||||||
return hbox;
|
return grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IButtonProcess getValidationButtonProcess(){
|
private IButtonProcess getValidationButtonProcess(){
|
||||||
@ -96,4 +97,12 @@ public class SimpleValidator implements IFXValidatorComponent {
|
|||||||
private interface IButtonProcess{
|
private interface IButtonProcess{
|
||||||
void process();
|
void process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setValidationButtonEnable(boolean enable){
|
||||||
|
this.validationButton.setDisable(!enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCancelationButtonEnable(boolean enable){
|
||||||
|
this.cancelButton.setDisable(!enable);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics;
|
package com.pqt.client.gui.ressources.components.generics;
|
||||||
|
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.generics.creators;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.IFXComponent;
|
||||||
|
|
||||||
|
public interface IFXCreatorComponent<T> extends IFXComponent{
|
||||||
|
T create();
|
||||||
|
boolean isCreationPossible();
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.generics.displayers;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.IFXComponent;
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.IDisplayerComponentListener;
|
||||||
|
|
||||||
|
public interface IFXDisplayerComponent<T, U extends IDisplayerComponentListener> extends IFXComponent{
|
||||||
|
void display(T content);
|
||||||
|
void addListener(U l);
|
||||||
|
void removeListener(U l);
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.displayers.listeners;
|
package com.pqt.client.gui.ressources.components.generics.displayers.listeners;
|
||||||
|
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.displayers.listeners;
|
package com.pqt.client.gui.ressources.components.generics.displayers.listeners;
|
||||||
|
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.displayers.listeners;
|
package com.pqt.client.gui.ressources.components.generics.displayers.listeners;
|
||||||
|
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.generics.javafx_override;
|
||||||
|
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
|
||||||
|
public class CssEnabledGridPane extends GridPane {
|
||||||
|
|
||||||
|
public CssEnabledGridPane() {
|
||||||
|
super();
|
||||||
|
this.getStyleClass().add("grid-pane");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.generics.validators;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.IFXComponent;
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.validators.listeners.IValidatorComponentListener;
|
||||||
|
|
||||||
|
public interface IFXValidatorComponent extends IFXComponent{
|
||||||
|
void addListener(IValidatorComponentListener l);
|
||||||
|
void removeListener(IValidatorComponentListener l);
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.validators.listeners;
|
package com.pqt.client.gui.ressources.components.generics.validators.listeners;
|
||||||
|
|
||||||
public interface IValidatorComponentFirerer {
|
public interface IValidatorComponentFirerer {
|
||||||
void addListener(IValidatorComponentListener l);
|
void addListener(IValidatorComponentListener l);
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.validators.listeners;
|
package com.pqt.client.gui.ressources.components.generics.validators.listeners;
|
||||||
|
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.validators.listeners;
|
package com.pqt.client.gui.ressources.components.generics.validators.listeners;
|
||||||
|
|
||||||
import javax.swing.event.EventListenerList;
|
import javax.swing.event.EventListenerList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.specifics.account;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.IFXDisplayerComponent;
|
||||||
|
import com.pqt.client.gui.ressources.components.specifics.account.listeners.IAccountComponentListener;
|
||||||
|
import com.pqt.core.entities.user_account.Account;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public interface IFXAccountsDisplayerComponent extends IFXDisplayerComponent<Collection<Account>, IAccountComponentListener> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.specifics.account.listeners;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.IDisplayerComponentListener;
|
||||||
|
import com.pqt.core.entities.user_account.Account;
|
||||||
|
|
||||||
|
public interface IAccountComponentListener extends IDisplayerComponentListener<Account>{
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.account.listeners;
|
package com.pqt.client.gui.ressources.components.specifics.account.listeners;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
||||||
import com.pqt.core.entities.user_account.Account;
|
import com.pqt.core.entities.user_account.Account;
|
||||||
|
|
||||||
public class SimpleAccountComponentFirerer extends SimpleDisplayerComponentFirerer<Account, IAccountComponentListener> {
|
public class SimpleAccountComponentFirerer extends SimpleDisplayerComponentFirerer<Account, IAccountComponentListener> {
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.specifics.products;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.IFXDisplayerComponent;
|
||||||
|
import com.pqt.client.gui.ressources.components.specifics.products.listeners.IStockComponentListener;
|
||||||
|
import com.pqt.core.entities.product.Product;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public interface IFXProductsDisplayerComponent extends IFXDisplayerComponent<Collection<Product>, IStockComponentListener> {
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.specifics.products.listeners;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.IDisplayerComponentListener;
|
||||||
|
import com.pqt.core.entities.product.Product;
|
||||||
|
|
||||||
|
public interface IStockComponentListener extends IDisplayerComponentListener<Product> {
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.products.listeners;
|
package com.pqt.client.gui.ressources.components.specifics.products.listeners;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
|
|
||||||
public class SimpleStockComponentFirerer extends SimpleDisplayerComponentFirerer<Product, IStockComponentListener> {
|
public class SimpleStockComponentFirerer extends SimpleDisplayerComponentFirerer<Product, IStockComponentListener> {
|
@ -0,0 +1,8 @@
|
|||||||
|
package com.pqt.client.gui.ressources.components.specifics.sale;
|
||||||
|
|
||||||
|
import com.pqt.client.gui.ressources.components.generics.displayers.IFXDisplayerComponent;
|
||||||
|
import com.pqt.client.gui.ressources.components.specifics.sale.listeners.ISaleComponentListener;
|
||||||
|
import com.pqt.core.entities.sale.Sale;
|
||||||
|
|
||||||
|
public interface IFXSaleDisplayerComponent extends IFXDisplayerComponent<Sale, ISaleComponentListener> {
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.sale.listeners;
|
package com.pqt.client.gui.ressources.components.specifics.sale.listeners;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener;
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.IDisplayerComponentListener;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
import com.pqt.core.entities.sale.Sale;
|
import com.pqt.core.entities.sale.Sale;
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
@ -1,6 +1,6 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.sale.listeners;
|
package com.pqt.client.gui.ressources.components.specifics.sale.listeners;
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
import com.pqt.client.gui.ressources.components.generics.displayers.listeners.SimpleDisplayerComponentFirerer;
|
||||||
import com.pqt.core.entities.product.Product;
|
import com.pqt.core.entities.product.Product;
|
||||||
import com.pqt.core.entities.sale.Sale;
|
import com.pqt.core.entities.sale.Sale;
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
@ -1,7 +1,7 @@
|
|||||||
package com.pqt.client.gui.ressources.css;
|
package com.pqt.client.gui.ressources.css;
|
||||||
|
|
||||||
public class GUICssTool {
|
public class GUICssTool {
|
||||||
public static String getGreyIntermediaryPaneCssId(){
|
public static String getCssFilePath(){
|
||||||
return "grey-pane";
|
return "/dark-theme.css";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.creators;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.IFXComponent;
|
|
||||||
|
|
||||||
public interface IFXCreatorComponent<T> extends IFXComponent{
|
|
||||||
T create();
|
|
||||||
boolean isCreationPossible();
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.displayers;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.IFXComponent;
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener;
|
|
||||||
|
|
||||||
public interface IFXDisplayerComponent<T, U extends IDisplayerComponentListener> extends IFXComponent{
|
|
||||||
void display(T content);
|
|
||||||
void addListener(U l);
|
|
||||||
void removeListener(U l);
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.generics.validators;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.IFXComponent;
|
|
||||||
import com.pqt.client.gui.ressources.generics.validators.listeners.IValidatorComponentListener;
|
|
||||||
|
|
||||||
public interface IFXValidatorComponent extends IFXComponent{
|
|
||||||
void addListener(IValidatorComponentListener l);
|
|
||||||
void removeListener(IValidatorComponentListener l);
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.account;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.IFXDisplayerComponent;
|
|
||||||
import com.pqt.client.gui.ressources.specifics.account.listeners.IAccountComponentListener;
|
|
||||||
import com.pqt.core.entities.user_account.Account;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public interface IFXAccountsDisplayerComponent extends IFXDisplayerComponent<Collection<Account>, IAccountComponentListener> {
|
|
||||||
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.account.listeners;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener;
|
|
||||||
import com.pqt.core.entities.user_account.Account;
|
|
||||||
|
|
||||||
public interface IAccountComponentListener extends IDisplayerComponentListener<Account>{
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.products;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.IFXDisplayerComponent;
|
|
||||||
import com.pqt.client.gui.ressources.specifics.products.listeners.IStockComponentListener;
|
|
||||||
import com.pqt.core.entities.product.Product;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
public interface IFXProductsDisplayerComponent extends IFXDisplayerComponent<Collection<Product>, IStockComponentListener> {
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.products.listeners;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.listeners.IDisplayerComponentListener;
|
|
||||||
import com.pqt.core.entities.product.Product;
|
|
||||||
|
|
||||||
public interface IStockComponentListener extends IDisplayerComponentListener<Product> {
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.pqt.client.gui.ressources.specifics.sale;
|
|
||||||
|
|
||||||
import com.pqt.client.gui.ressources.generics.displayers.IFXDisplayerComponent;
|
|
||||||
import com.pqt.client.gui.ressources.specifics.sale.listeners.ISaleComponentListener;
|
|
||||||
import com.pqt.core.entities.sale.Sale;
|
|
||||||
|
|
||||||
public interface IFXSaleDisplayerComponent extends IFXDisplayerComponent<Sale, ISaleComponentListener> {
|
|
||||||
}
|
|
@ -55,7 +55,10 @@ public class GUIStringTool {
|
|||||||
return new StringConverter<Account>() {
|
return new StringConverter<Account>() {
|
||||||
@Override
|
@Override
|
||||||
public String toString(Account object) {
|
public String toString(Account object) {
|
||||||
return String.format("%s - %s)", object.getUsername(), object.getPermissionLevel().name());
|
if(object!=null)
|
||||||
|
return String.format("%s - %s)", object.getUsername(), object.getPermissionLevel());
|
||||||
|
|
||||||
|
return "null";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,4 +12,11 @@ public class AccountListenerAdapter implements IAccountListener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see com.pqt.client.module.account.listeners.IAccountListener#onAccountListChangedEvent()
|
||||||
|
*/
|
||||||
|
public void onAccountListChangedEvent() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
package com.pqt.client.module.sale.listeners;
|
package com.pqt.client.module.sale.listeners;
|
||||||
|
|
||||||
import com.pqt.core.entities.sale.Sale;
|
|
||||||
|
|
||||||
import java.util.EventListener;
|
import java.util.EventListener;
|
||||||
|
|
||||||
public interface ISaleListener extends EventListener {
|
public interface ISaleListener extends EventListener {
|
||||||
|
|
||||||
public abstract void onSaleValidationSuccess(long saleId);
|
void onSaleValidationSuccess(long saleId);
|
||||||
|
|
||||||
public abstract void onSaleValidationError(long saleId, Throwable cause);
|
void onSaleValidationError(long saleId, Throwable cause);
|
||||||
|
|
||||||
public abstract void onSaleValidationRefused(long saleId, Throwable cause);
|
void onSaleValidationRefused(long saleId, Throwable cause);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ public class StockService {
|
|||||||
|
|
||||||
private StockDao dao;
|
private StockDao dao;
|
||||||
|
|
||||||
private StockService() {
|
public StockService() {
|
||||||
dao = new StockDao();
|
dao = new StockDao();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
209
Workspace/client/src/main/resources/dark-theme.css
Normal file
209
Workspace/client/src/main/resources/dark-theme.css
Normal file
@ -0,0 +1,209 @@
|
|||||||
|
.root {
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
-fx-font-size: 11pt;
|
||||||
|
-fx-font-family: "Segoe UI Semibold";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-bright {
|
||||||
|
-fx-font-size: 11pt;
|
||||||
|
-fx-font-family: "Segoe UI Semibold";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label-header {
|
||||||
|
-fx-font-size: 32pt;
|
||||||
|
-fx-font-family: "Segoe UI Light";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-view {
|
||||||
|
-fx-base: #1d1d1d;
|
||||||
|
-fx-control-inner-background: #1d1d1d;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-table-cell-border-color: transparent;
|
||||||
|
-fx-table-header-border-color: transparent;
|
||||||
|
-fx-padding: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-view .list-cell .label{
|
||||||
|
-fx-font-size: 20pt;
|
||||||
|
-fx-font-family: "Segoe UI Light";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-alignment: center-left;
|
||||||
|
-fx-opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-view:focused .list-cell:filled:focused:selected {
|
||||||
|
-fx-background-color: -fx-focus-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-view {
|
||||||
|
-fx-base: #1d1d1d;
|
||||||
|
-fx-control-inner-background: #1d1d1d;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-table-cell-border-color: transparent;
|
||||||
|
-fx-table-header-border-color: transparent;
|
||||||
|
-fx-padding: 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-view .column-header-background {
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-view .column-header, .table-view .filler {
|
||||||
|
-fx-size: 35px;
|
||||||
|
-fx-border-width: 0 0 1 0;
|
||||||
|
-fx-background-color: transparent;
|
||||||
|
-fx-border-color:
|
||||||
|
transparent
|
||||||
|
transparent
|
||||||
|
derive(-fx-base, 80%)
|
||||||
|
transparent;
|
||||||
|
-fx-border-insets: 0 10 1 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-view .column-header .label {
|
||||||
|
-fx-font-size: 20pt;
|
||||||
|
-fx-font-family: "Segoe UI Light";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-alignment: center-left;
|
||||||
|
-fx-opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.table-view:focused .table-row-cell:filled:focused:selected {
|
||||||
|
-fx-background-color: -fx-focus-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-pane:horizontal > .split-pane-divider {
|
||||||
|
-fx-border-color: transparent #1d1d1d transparent #1d1d1d;
|
||||||
|
-fx-background-color: transparent, derive(#1d1d1d,20%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.split-pane {
|
||||||
|
-fx-padding: 1 0 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grid-pane {
|
||||||
|
-fx-hgap: 10;
|
||||||
|
-fx-vgap: 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-bar {
|
||||||
|
-fx-background-color: derive(#1d1d1d,20%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.context-menu {
|
||||||
|
-fx-background-color: derive(#1d1d1d,50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu-bar .label {
|
||||||
|
-fx-font-size: 14pt;
|
||||||
|
-fx-font-family: "Segoe UI Light";
|
||||||
|
-fx-text-fill: white;
|
||||||
|
-fx-opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.menu .left-container {
|
||||||
|
-fx-background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-field {
|
||||||
|
-fx-font-size: 12pt;
|
||||||
|
-fx-font-family: "Segoe UI Semibold";
|
||||||
|
-fx-pref-width: 125;
|
||||||
|
-fx-pref-height: 30;
|
||||||
|
-fx-background-radius: 0;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-background-insets: 0 0 0 0, 0, 1, 2;
|
||||||
|
-fx-border-color: #e2e2e2;
|
||||||
|
-fx-border-width: 2;
|
||||||
|
-fx-text-fill: #d8d8d8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button {
|
||||||
|
-fx-padding: 5 22 5 22;
|
||||||
|
-fx-border-color: #e2e2e2;
|
||||||
|
-fx-border-width: 2;
|
||||||
|
-fx-background-radius: 0;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif;
|
||||||
|
-fx-font-size: 11pt;
|
||||||
|
-fx-text-fill: #d8d8d8;
|
||||||
|
-fx-background-insets: 0 0 0 0, 0, 1, 2;
|
||||||
|
-fx-pref-width: 125;
|
||||||
|
-fx-pref-height: 30;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:hover {
|
||||||
|
-fx-background-color: #3a3a3a;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:pressed, .button:default:hover:pressed {
|
||||||
|
-fx-background-color: white;
|
||||||
|
-fx-text-fill: #1d1d1d;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:focused {
|
||||||
|
-fx-border-color: white, white;
|
||||||
|
-fx-border-width: 1, 1;
|
||||||
|
-fx-border-style: solid, segments(1, 1);
|
||||||
|
-fx-border-radius: 0, 0;
|
||||||
|
-fx-border-insets: 1 1 1 1, 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:disabled, .button:default:disabled {
|
||||||
|
-fx-opacity: 0.4;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-text-fill: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:default {
|
||||||
|
-fx-background-color: -fx-focus-color;
|
||||||
|
-fx-text-fill: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button:default:hover {
|
||||||
|
-fx-background-color: derive(-fx-focus-color,30%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.choice-box {
|
||||||
|
-fx-pref-width: 150;
|
||||||
|
-fx-pref-height: 30;
|
||||||
|
-fx-background-radius: 0;
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-background-insets: 0 0 0 0, 0, 1, 2;
|
||||||
|
-fx-border-color: #e2e2e2;
|
||||||
|
-fx-border-width: 2;
|
||||||
|
-fx-text-fill: #d8d8d8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.progress-indicator {
|
||||||
|
-fx-pref-width: 50;
|
||||||
|
-fx-pref-height: 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grey-intermediary-pane {
|
||||||
|
-fx-background-color: #1d1d1d;
|
||||||
|
-fx-opacity: 60%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main-module-pane {
|
||||||
|
-fx-padding: 10 10 10 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
.validator {
|
||||||
|
-fx-padding: 10 10 10 10;
|
||||||
|
-fx-hgap: 10;
|
||||||
|
-fx-vgap: 10;
|
||||||
|
}
|
||||||
|
.validator .button{
|
||||||
|
-fx-pref-width: 150;
|
||||||
|
-fx-pref-height: 50;
|
||||||
|
}
|
@ -27,21 +27,6 @@ public class Client extends PqtMember{
|
|||||||
this.address = address;
|
this.address = address;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) return true;
|
|
||||||
if (o == null || getClass() != o.getClass()) return false;
|
|
||||||
|
|
||||||
Client client = (Client) o;
|
|
||||||
|
|
||||||
return address.equals(client.address) && id==client.id && type.equals(client.type);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return address.hashCode() + type.hashCode() + Integer.class.cast(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(super.hashCode(), address);
|
return Objects.hash(super.hashCode(), address);
|
||||||
|
Loading…
Reference in New Issue
Block a user