Module Client : ajustements GUI (écran de vente)

This commit is contained in:
Notmoo 2017-08-17 23:52:46 +02:00
parent aaaa45039e
commit 1d0628ffe9
7 changed files with 75 additions and 21 deletions

View File

@ -65,14 +65,20 @@ class SaleScreenController {
return model.getCurrentSale(); return model.getCurrentSale();
} }
void updateView(){ private void updateSale(){
view.setSale(getCurrentSale());
view.setValidationButtonEnabled(model.checkValidity(getCurrentSale()));
}
private void updateData(){
view.setProducts(fetchProductList()); view.setProducts(fetchProductList());
view.setSaleTypes(fetchSaleTypeList()); view.setSaleTypes(fetchSaleTypeList());
view.setAccounts(fetchAccountList()); view.setAccounts(fetchAccountList());
}
view.setSale(getCurrentSale()); void updateView(){
updateData();
view.setValidationButtonEnabled(model.checkValidity(getCurrentSale())); updateSale();
} }
private List<Product> fetchProductList(){ private List<Product> fetchProductList(){
@ -90,7 +96,7 @@ class SaleScreenController {
@Override @Override
public void onComponentClickEvent(Event event, Product product) { public void onComponentClickEvent(Event event, Product product) {
model.removeProductFromSale(product); model.removeProductFromSale(product);
SaleScreenController.this.updateView(); SaleScreenController.this.updateSale();
} }
@Override @Override
@ -117,8 +123,10 @@ class SaleScreenController {
@Override @Override
public void onContentClickEvent(Event event, Product eventTarget) { public void onContentClickEvent(Event event, Product eventTarget) {
if(eventTarget!=null) {
model.addProductToSale(eventTarget); model.addProductToSale(eventTarget);
SaleScreenController.this.updateView(); SaleScreenController.this.updateSale();
}
} }
@Override @Override

View File

@ -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.SimpleValidator;
import com.pqt.client.gui.ressources.components.generics.javafx_override.CssEnabledGridPane; 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.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.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;
@ -45,7 +46,7 @@ class SaleScreenView implements IFXComponent {
private void initGui() { private void initGui() {
mainPane = new StackPane(); mainPane = new StackPane();
mainPane.getStyleClass().add("main-module-pane"); mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass());
mainPaneContent = new BorderPane(); mainPaneContent = new BorderPane();
@ -142,7 +143,7 @@ class SaleScreenView implements IFXComponent {
Pane greyIntermediaryPane = new Pane(); Pane greyIntermediaryPane = new Pane();
greyIntermediaryPane.getStyleClass().clear(); greyIntermediaryPane.getStyleClass().clear();
greyIntermediaryPane.getStyleClass().add("grey-intermediary-pane"); greyIntermediaryPane.getStyleClass().add(GUICssTool.getIntermediaryPaneStyleClass());
saleValidationScreen = new SaleValidationScreen(saleId, sale); saleValidationScreen = new SaleValidationScreen(saleId, sale);
saleValidationScreen.addListener(ctrl.getSaleValidationScreenListener()); saleValidationScreen.addListener(ctrl.getSaleValidationScreenListener());

View File

@ -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.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.components.generics.javafx_override.CssEnabledGridPane;
import com.pqt.client.gui.ressources.css.GUICssTool;
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;
@ -32,6 +33,7 @@ public class SaleValidationScreen {
public SaleValidationScreen(long saleId, Sale sale) { public SaleValidationScreen(long saleId, Sale sale) {
listeners = new EventListenerList(); listeners = new EventListenerList();
mainPane = new Pane(); mainPane = new Pane();
mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass());
saleStatus = sale.getStatus(); saleStatus = sale.getStatus();

View File

@ -1,6 +1,7 @@
package com.pqt.client.gui.modules.stat_screen; package com.pqt.client.gui.modules.stat_screen;
import com.pqt.client.gui.ressources.components.generics.IFXComponent; import com.pqt.client.gui.ressources.components.generics.IFXComponent;
import com.pqt.client.gui.ressources.css.GUICssTool;
import com.sun.deploy.util.StringUtils; import com.sun.deploy.util.StringUtils;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.scene.control.TextArea; import javafx.scene.control.TextArea;
@ -22,7 +23,7 @@ class StatScreenView implements IFXComponent {
private void initGui() { private void initGui() {
mainPane = new Pane(); mainPane = new Pane();
mainPane.getStyleClass().add("main-module-pane"); mainPane.getStyleClass().add(GUICssTool.getMainModulePaneCssClass());
statTextArea = new TextArea(); statTextArea = new TextArea();
mainPane.getChildren().add(statTextArea); mainPane.getChildren().add(statTextArea);

View File

@ -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.generics.displayers.IFXDisplayerComponent;
import com.pqt.client.gui.ressources.components.specifics.products.listeners.IStockComponentListener; 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.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.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;
@ -33,7 +34,7 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent<Collecti
@Override @Override
public void display(Collection<Product> content) { public void display(Collection<Product> content) {
final ObservableList<Tab> tabs = FXCollections.emptyObservableList(); final ObservableList<Tab> tabs = FXCollections.observableArrayList();
if(content!=null){ if(content!=null){
List<String> categories = content.stream().map(product->product.getCategory().getName()).distinct().collect(Collectors.toList()); List<String> categories = content.stream().map(product->product.getCategory().getName()).distinct().collect(Collectors.toList());
@ -70,6 +71,7 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent<Collecti
Label title = new Label(GUIStringTool.getCategorytabStockDisplayerTitle()); Label title = new Label(GUIStringTool.getCategorytabStockDisplayerTitle());
title.setAlignment(Pos.CENTER); title.setAlignment(Pos.CENTER);
title.getStyleClass().add(GUICssTool.getTitleTextStyleClass());
HBox topPane = new HBox(); HBox topPane = new HBox();
topPane.setFillHeight(true); topPane.setFillHeight(true);
@ -104,10 +106,14 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent<Collecti
listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE); listView.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
listView.setEditable(false); listView.setEditable(false);
listView.setOnMouseClicked(event->firerer.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 -> { listView.setOnKeyTyped(event -> {
if(event.getCode().equals(KeyCode.ENTER)){ if(event.getCode().equals(KeyCode.ENTER)){
firerer.fireContentClickEvent(event, listView.getSelectionModel().getSelectedItem()); firerer.fireContentClickEvent(event, listView.getSelectionModel().getSelectedItem());
Platform.runLater(()->listView.getSelectionModel().clearSelection(listView.getSelectionModel().getSelectedIndex()));
event.consume(); event.consume();
} }
}); });
@ -119,6 +125,6 @@ public class CategoryTabStockDisplayer implements IFXDisplayerComponent<Collecti
} }
private static IObjectStringRenderer<Product> getProductRenderer(){ private static IObjectStringRenderer<Product> getProductRenderer(){
return GUIStringTool.getProductStringRenderer(); return GUIStringTool.getDetailledProductStringRenderer();
} }
} }

View File

@ -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.IFXSaleDisplayerComponent;
import com.pqt.client.gui.ressources.components.specifics.sale.listeners.ISaleComponentListener; 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.components.specifics.sale.listeners.SimpleSaleComponentFirerer;
import com.pqt.client.gui.ressources.css.GUICssTool;
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;
@ -35,6 +36,8 @@ public class CommandComposerSaleDisplayer implements IFXSaleDisplayerComponent {
mainPane.getStyleClass().add("sale-displayer"); mainPane.getStyleClass().add("sale-displayer");
Label title = new Label(GUIStringTool.getCommandComposerTitleTitle()); Label title = new Label(GUIStringTool.getCommandComposerTitleTitle());
title.setAlignment(Pos.CENTER);
title.getStyleClass().add(GUICssTool.getTitleTextStyleClass());
HBox topPane = new HBox(); HBox topPane = new HBox();
topPane.setFillHeight(true); topPane.setFillHeight(true);
@ -74,7 +77,10 @@ public class CommandComposerSaleDisplayer implements IFXSaleDisplayerComponent {
return; return;
this.sale = content; 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 @Override

View File

@ -6,7 +6,7 @@
-fx-font-size: 11pt; -fx-font-size: 11pt;
-fx-font-family: "Segoe UI Semibold"; -fx-font-family: "Segoe UI Semibold";
-fx-text-fill: white; -fx-text-fill: white;
-fx-opacity: 0.6; -fx-opacity: 0.8;
} }
.label-bright { .label-bright {
@ -17,12 +17,37 @@
} }
.label-header { .label-header {
-fx-font-size: 32pt; -fx-font-size: 25pt;
-fx-font-family: "Segoe UI Light"; -fx-font-family: "Segoe UI";
-fx-text-fill: white; -fx-text-fill: white;
-fx-opacity: 1; -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 { .list-view {
-fx-base: #1d1d1d; -fx-base: #1d1d1d;
-fx-control-inner-background: #1d1d1d; -fx-control-inner-background: #1d1d1d;
@ -30,6 +55,9 @@
-fx-table-cell-border-color: transparent; -fx-table-cell-border-color: transparent;
-fx-table-header-border-color: transparent; -fx-table-header-border-color: transparent;
-fx-padding: 5; -fx-padding: 5;
-fx-border-width: 2px;
-fx-border-radius: 1px;
-fx-border-color: gray;
} }
.list-view .list-cell .label{ .list-view .list-cell .label{
@ -165,7 +193,7 @@
.button:focused { .button:focused {
-fx-border-color: white, white; -fx-border-color: white, white;
-fx-border-width: 1, 1; -fx-border-width: 1, 1;
-fx-border-style: solid, segments(1, 1); -fx-border-style: solid;
-fx-border-radius: 0, 0; -fx-border-radius: 0, 0;
-fx-border-insets: 1 1 1 1, 0; -fx-border-insets: 1 1 1 1, 0;
} }
@ -202,11 +230,13 @@
.grey-intermediary-pane { .grey-intermediary-pane {
-fx-background-color: #1d1d1d; -fx-background-color: #1d1d1d;
-fx-opacity: 60%; -fx-opacity: 85%;
} }
.main-module-pane { .main-module-pane {
-fx-padding: 10 10 10 10; -fx-padding: 10 10 10 10;
-fx-border-width: 2px;
-fx-border-color: whitesmoke;
} }
.validator { .validator {
@ -222,11 +252,11 @@
.sidebar { .sidebar {
-fx-background-color: #2e2e2e; -fx-background-color: #2e2e2e;
-fx-padding: 5 22 5 22; -fx-padding: 5 22 5 22;
-fx-border-color: #e2e2e2; -fx-border-color: whitesmoke;
-fx-border-width: 2; -fx-border-width: 2;
-fx-background-radius: 0; -fx-background-radius: 0;
-fx-background-insets: 0 0 0 0, 0, 1, 2; -fx-background-insets: 0 0 0 0, 0, 1, 2;
-pqt-expanded-width : 200px; -pqt-expanded-width : 175px;
} }
.tool-bar { .tool-bar {