View Javadoc

1   package org.paneris.bibliomania;
2   
3   import java.io.File;
4   import java.text.NumberFormat;
5   import java.util.Locale;
6   
7   import org.paneris.bibliomania.generated.ProductBase;
8   
9   public class Product extends ProductBase {
10    public Product() {}
11  
12    // programmer's domain-specific code here
13  
14    /* format a number in the locale currency
15    */
16    public String displayPrice() {
17      return new String(NumberFormat.getCurrencyInstance(Locale.UK).
18                        format(getPrice().doubleValue()));
19    } 
20    
21    public String getPictureWithUrl() {
22      String url = "";
23      String uploadURL = ((BibliomaniaDatabase)getDatabase()).getUploadURL();
24      if (uploadURL != null) url += uploadURL;
25      if (getBook() != null) { 
26        StringBuffer s = new StringBuffer();
27        getBook().appendCacheSubpath(s);
28        url += s.toString();
29      }
30      return url + File.separatorChar + getPicture();
31    }
32   
33  }