* removed streets from dictionary
[aramzamzam-ru.rentdom.git] / rentdom-web / src / main / java / ru / rentdom / components / HousingList.java
blobd85e4dbc13ef48150639af6091805d470f9fabfb
1 package ru.rentdom.components;
3 import java.text.DecimalFormat;
4 import java.text.DecimalFormatSymbols;
5 import java.util.List;
7 import org.apache.tapestry5.annotations.Parameter;
8 import org.apache.tapestry5.annotations.Property;
9 import org.apache.tapestry5.ioc.Messages;
10 import org.apache.tapestry5.ioc.annotations.Inject;
12 import ru.rentdom.entities.housing.Housing;
13 import ru.rentdom.services.coords.CoordsService;
15 public class HousingList {
16 private DecimalFormat priceFormat=null;
18 @Parameter(required=true, allowNull=false)
19 @Property(write=false)
20 private List<Housing> housings;
22 @Property
23 private Housing housing;
25 @Inject
26 private CoordsService coordsService;
28 @Inject
29 private Messages messages;
31 public boolean isEmptyList()
33 return housings.size()==0;
36 public DecimalFormat getPriceFormat()
38 if (priceFormat==null)
40 DecimalFormatSymbols dfs=new DecimalFormatSymbols();
41 dfs.setGroupingSeparator(' ');
42 priceFormat = new DecimalFormat("###,###", dfs);
44 return priceFormat;
47 public String getPrice()
49 return getPriceFormat().format(housing.getPrice())+" "+housing.getCurrency();
52 public String getMetroOrDistrict()
54 if (coordsService.hasMetro(housing.getTown()))
55 return messages.format("metro", housing.getMetroStation().getName());
56 else
57 return messages.format("distrinc", housing.getDistrict().getName());