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

View File

@ -36,9 +36,17 @@ public class GUIStringTool {
public static IObjectStringRenderer<Product> getDetailledProductStringRenderer(){ public static IObjectStringRenderer<Product> getDetailledProductStringRenderer(){
return product->{ return product->{
if(product!=null) if(product!=null){
return String.format("%s - %.2f€ (%s)", product.getName(), product.getPrice(), (product.getAmountRemaining()>=30?"30+": Integer.toString(product.getAmountRemaining()))); String amountStr;
else 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"; return "null";
}; };
} }