From 1d0628ffe93c1743fd759b877014715b25d58dba Mon Sep 17 00:00:00 2001 From: Notmoo Date: Thu, 17 Aug 2017 23:52:46 +0200 Subject: [PATCH] =?UTF-8?q?Module=20Client=20:=20ajustements=20GUI=20(?= =?UTF-8?q?=C3=A9cran=20de=20vente)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sale_screen/SaleScreenController.java | 22 +++++++--- .../modules/sale_screen/SaleScreenView.java | 5 ++- .../SaleValidationScreen.java | 2 + .../modules/stat_screen/StatScreenView.java | 3 +- .../components/CategoryTabStockDisplayer.java | 12 +++-- .../CommandComposerSaleDisplayer.java | 8 +++- .../client/src/main/resources/dark-theme.css | 44 ++++++++++++++++--- 7 files changed, 75 insertions(+), 21 deletions(-) diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenController.java b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenController.java index 5a65ebc5..b3abd1e8 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenController.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenController.java @@ -65,14 +65,20 @@ class SaleScreenController { return model.getCurrentSale(); } - void updateView(){ + private void updateSale(){ + view.setSale(getCurrentSale()); + view.setValidationButtonEnabled(model.checkValidity(getCurrentSale())); + } + + private void updateData(){ view.setProducts(fetchProductList()); view.setSaleTypes(fetchSaleTypeList()); view.setAccounts(fetchAccountList()); + } - view.setSale(getCurrentSale()); - - view.setValidationButtonEnabled(model.checkValidity(getCurrentSale())); + void updateView(){ + updateData(); + updateSale(); } private List fetchProductList(){ @@ -90,7 +96,7 @@ class SaleScreenController { @Override public void onComponentClickEvent(Event event, Product product) { model.removeProductFromSale(product); - SaleScreenController.this.updateView(); + SaleScreenController.this.updateSale(); } @Override @@ -117,8 +123,10 @@ class SaleScreenController { @Override public void onContentClickEvent(Event event, Product eventTarget) { - model.addProductToSale(eventTarget); - SaleScreenController.this.updateView(); + if(eventTarget!=null) { + model.addProductToSale(eventTarget); + SaleScreenController.this.updateSale(); + } } @Override diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenView.java b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenView.java index 24adaa81..f3595839 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenView.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/SaleScreenView.java @@ -5,6 +5,7 @@ import com.pqt.client.gui.ressources.components.CommandComposerSaleDisplayer; 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.components.generics.IFXComponent; +import com.pqt.client.gui.ressources.css.GUICssTool; import com.pqt.client.gui.ressources.strings.GUIStringTool; import com.pqt.client.gui.ressources.components.CategoryTabStockDisplayer; import com.pqt.core.entities.product.Product; @@ -45,7 +46,7 @@ class SaleScreenView implements IFXComponent { private void initGui() { mainPane = new StackPane(); - mainPane.getStyleClass().add("main-module-pane"); + mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass()); mainPaneContent = new BorderPane(); @@ -142,7 +143,7 @@ class SaleScreenView implements IFXComponent { Pane greyIntermediaryPane = new Pane(); greyIntermediaryPane.getStyleClass().clear(); - greyIntermediaryPane.getStyleClass().add("grey-intermediary-pane"); + greyIntermediaryPane.getStyleClass().add(GUICssTool.getIntermediaryPaneStyleClass()); saleValidationScreen = new SaleValidationScreen(saleId, sale); saleValidationScreen.addListener(ctrl.getSaleValidationScreenListener()); diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/sale_validation_screen/SaleValidationScreen.java b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/sale_validation_screen/SaleValidationScreen.java index 9153b679..93a4b7c8 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/sale_validation_screen/SaleValidationScreen.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/modules/sale_screen/sale_validation_screen/SaleValidationScreen.java @@ -2,6 +2,7 @@ package com.pqt.client.gui.modules.sale_screen.sale_validation_screen; 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.css.GUICssTool; import com.pqt.client.gui.ressources.strings.GUIStringTool; import com.pqt.core.entities.sale.Sale; import com.pqt.core.entities.sale.SaleStatus; @@ -32,6 +33,7 @@ public class SaleValidationScreen { public SaleValidationScreen(long saleId, Sale sale) { listeners = new EventListenerList(); mainPane = new Pane(); + mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass()); saleStatus = sale.getStatus(); diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/modules/stat_screen/StatScreenView.java b/Workspace/client/src/main/java/com/pqt/client/gui/modules/stat_screen/StatScreenView.java index 5fd5485d..ca13ed3d 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/modules/stat_screen/StatScreenView.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/modules/stat_screen/StatScreenView.java @@ -1,6 +1,7 @@ package com.pqt.client.gui.modules.stat_screen; import com.pqt.client.gui.ressources.components.generics.IFXComponent; +import com.pqt.client.gui.ressources.css.GUICssTool; import com.sun.deploy.util.StringUtils; import javafx.application.Platform; import javafx.scene.control.TextArea; @@ -22,7 +23,7 @@ class StatScreenView implements IFXComponent { private void initGui() { mainPane = new Pane(); - mainPane.getStyleClass().add("main-module-pane"); + mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass()); statTextArea = new TextArea(); mainPane.getChildren().add(statTextArea); diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CategoryTabStockDisplayer.java b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CategoryTabStockDisplayer.java index d79b83c3..a8cf9df3 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CategoryTabStockDisplayer.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CategoryTabStockDisplayer.java @@ -3,6 +3,7 @@ package com.pqt.client.gui.ressources.components; import com.pqt.client.gui.ressources.components.generics.displayers.IFXDisplayerComponent; import com.pqt.client.gui.ressources.components.specifics.products.listeners.IStockComponentListener; import com.pqt.client.gui.ressources.components.specifics.products.listeners.SimpleStockComponentFirerer; +import com.pqt.client.gui.ressources.css.GUICssTool; import com.pqt.client.gui.ressources.strings.GUIStringTool; import com.pqt.client.gui.ressources.strings.IObjectStringRenderer; import com.pqt.core.entities.product.Product; @@ -33,7 +34,7 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent content) { - final ObservableList tabs = FXCollections.emptyObservableList(); + final ObservableList tabs = FXCollections.observableArrayList(); if(content!=null){ List categories = content.stream().map(product->product.getCategory().getName()).distinct().collect(Collectors.toList()); @@ -70,6 +71,7 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponentfirerer.fireContentClickEvent(event, listView.getSelectionModel().getSelectedItem())); + listView.setOnMouseClicked(event->{ + firerer.fireContentClickEvent(event, listView.getSelectionModel().getSelectedItem()); + Platform.runLater(()->listView.getSelectionModel().clearSelection(listView.getSelectionModel().getSelectedIndex())); + }); listView.setOnKeyTyped(event -> { if(event.getCode().equals(KeyCode.ENTER)){ firerer.fireContentClickEvent(event, listView.getSelectionModel().getSelectedItem()); + Platform.runLater(()->listView.getSelectionModel().clearSelection(listView.getSelectionModel().getSelectedIndex())); event.consume(); } }); @@ -119,6 +125,6 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent getProductRenderer(){ - return GUIStringTool.getProductStringRenderer(); + return GUIStringTool.getDetailledProductStringRenderer(); } } diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CommandComposerSaleDisplayer.java b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CommandComposerSaleDisplayer.java index 678b9ce2..5fec3ecf 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CommandComposerSaleDisplayer.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/components/CommandComposerSaleDisplayer.java @@ -3,6 +3,7 @@ package com.pqt.client.gui.ressources.components; import com.pqt.client.gui.ressources.components.specifics.sale.IFXSaleDisplayerComponent; import com.pqt.client.gui.ressources.components.specifics.sale.listeners.ISaleComponentListener; import com.pqt.client.gui.ressources.components.specifics.sale.listeners.SimpleSaleComponentFirerer; +import com.pqt.client.gui.ressources.css.GUICssTool; import com.pqt.client.gui.ressources.strings.GUIStringTool; import com.pqt.core.entities.product.Product; import com.pqt.core.entities.sale.Sale; @@ -35,6 +36,8 @@ public class CommandComposerSaleDisplayer implements IFXSaleDisplayerComponent { mainPane.getStyleClass().add("sale-displayer"); Label title = new Label(GUIStringTool.getCommandComposerTitleTitle()); + title.setAlignment(Pos.CENTER); + title.getStyleClass().add(GUICssTool.getTitleTextStyleClass()); HBox topPane = new HBox(); topPane.setFillHeight(true); @@ -74,7 +77,10 @@ public class CommandComposerSaleDisplayer implements IFXSaleDisplayerComponent { return; this.sale = content; - Platform.runLater(()->this.listView.setItems(FXCollections.observableList(new ArrayList<>(this.sale.getProducts().keySet())))); + Platform.runLater(()->{ + this.listView.getItems().clear(); + this.listView.getItems().addAll(this.sale.getProducts().keySet()); + }); } @Override diff --git a/Workspace/client/src/main/resources/dark-theme.css b/Workspace/client/src/main/resources/dark-theme.css index b71e5642..e8db18a7 100644 --- a/Workspace/client/src/main/resources/dark-theme.css +++ b/Workspace/client/src/main/resources/dark-theme.css @@ -6,7 +6,7 @@ -fx-font-size: 11pt; -fx-font-family: "Segoe UI Semibold"; -fx-text-fill: white; - -fx-opacity: 0.6; + -fx-opacity: 0.8; } .label-bright { @@ -17,12 +17,37 @@ } .label-header { - -fx-font-size: 32pt; - -fx-font-family: "Segoe UI Light"; + -fx-font-size: 25pt; + -fx-font-family: "Segoe UI"; -fx-text-fill: white; -fx-opacity: 1; } +.tab { + -fx-background-color: #3a3a3a; +} + +.tab-label { + -fx-text-fill: white; +} + +.tab:selected { + -fx-background-color: #4d4d4d; +} + +.tab-pane *.tab-header-background { + -fx-background-color: #1d1d1d; + -fx-border-width: 1px; + -fx-border-radius: 1px; + -fx-border-color: gray; +} + +.tab-pane { + -fx-border-width: 2px; + -fx-border-radius: 1px; + -fx-border-color: gray; +} + .list-view { -fx-base: #1d1d1d; -fx-control-inner-background: #1d1d1d; @@ -30,6 +55,9 @@ -fx-table-cell-border-color: transparent; -fx-table-header-border-color: transparent; -fx-padding: 5; + -fx-border-width: 2px; + -fx-border-radius: 1px; + -fx-border-color: gray; } .list-view .list-cell .label{ @@ -165,7 +193,7 @@ .button:focused { -fx-border-color: white, white; -fx-border-width: 1, 1; - -fx-border-style: solid, segments(1, 1); + -fx-border-style: solid; -fx-border-radius: 0, 0; -fx-border-insets: 1 1 1 1, 0; } @@ -202,11 +230,13 @@ .grey-intermediary-pane { -fx-background-color: #1d1d1d; - -fx-opacity: 60%; + -fx-opacity: 85%; } .main-module-pane { -fx-padding: 10 10 10 10; + -fx-border-width: 2px; + -fx-border-color: whitesmoke; } .validator { @@ -222,11 +252,11 @@ .sidebar { -fx-background-color: #2e2e2e; -fx-padding: 5 22 5 22; - -fx-border-color: #e2e2e2; + -fx-border-color: whitesmoke; -fx-border-width: 2; -fx-background-radius: 0; -fx-background-insets: 0 0 0 0, 0, 1, 2; - -pqt-expanded-width : 200px; + -pqt-expanded-width : 175px; } .tool-bar {