From d6c9e58519952fba98e7a8fe4eb20bf762696fef Mon Sep 17 00:00:00 2001 From: Notmoo Date: Sat, 19 Aug 2017 19:20:39 +0200 Subject: [PATCH] Module Client, clss GUIStringTool : modification du renderer de produit --- .../gui/ressources/strings/GUIStringTool.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/strings/GUIStringTool.java b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/strings/GUIStringTool.java index 22fe69f3..0b69d406 100644 --- a/Workspace/client/src/main/java/com/pqt/client/gui/ressources/strings/GUIStringTool.java +++ b/Workspace/client/src/main/java/com/pqt/client/gui/ressources/strings/GUIStringTool.java @@ -36,9 +36,17 @@ public class GUIStringTool { public static IObjectStringRenderer getDetailledProductStringRenderer(){ return product->{ - if(product!=null) - return String.format("%s - %.2f€ (%s)", product.getName(), product.getPrice(), (product.getAmountRemaining()>=30?"30+": Integer.toString(product.getAmountRemaining()))); - else + if(product!=null){ + String amountStr; + if(product.getAmountRemaining()<=0){ + amountStr = "OUT OF STOCK"; + }else if(product.getAmountRemaining()>=30){ + amountStr = "30+"; + }else{ + amountStr = Integer.toString(product.getAmountRemaining()); + } + return String.format("%s - %.2f€ (%s)", product.getName(), product.getPrice(), amountStr); + }else return "null"; }; }