Module Client, clss GUIStringTool : modification du renderer de produit

This commit is contained in:
Notmoo 2017-08-19 19:20:39 +02:00
parent 0ec1f69bb5
commit d6c9e58519
1 changed files with 11 additions and 3 deletions

View File

@ -36,9 +36,17 @@ public class GUIStringTool {
public static IObjectStringRenderer<Product> 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";
};
}