org.paneris.bibliomania.shopping
Class BibliomaniaShoppingTrolley

java.lang.Object
  extended by org.paneris.melati.shopping.ShoppingTrolley
      extended by org.paneris.bibliomania.shopping.BibliomaniaShoppingTrolley

public class BibliomaniaShoppingTrolley
extends org.paneris.melati.shopping.ShoppingTrolley

A Shopping Trolley stored information in the user's Shopping Trolley.

It does this by storing itself in the session.

For this reason, the constructors are private, and you will be expected to always get the Shopping Trolley using getInstance();

usage example: ShoppingTrolley trolley = ShoppingTrolley.getInstance(Melati melati); context.put("trolley", trolley);


Nested Class Summary
 class BibliomaniaShoppingTrolley.SupplierCharge
           
 
Field Summary
 Country countryCode
           
 
Fields inherited from class org.paneris.melati.shopping.ShoppingTrolley
address, config, country, county, email, hasDetails, locale, melati, message, name, postcode, tel, town, VAT_PERCENT_TIMES_TEN
 
Constructor Summary
BibliomaniaShoppingTrolley()
           
 
Method Summary
 void assertLogin(org.melati.Melati melatiP)
           
 boolean canSupply()
          Can we deliver this - we need to check that each item has a supplier.
 void configureRequest(org.melati.Melati melatiP)
           
 void confirmPayment(org.melati.Melati melatiP)
           
 double convertFromUK(double value)
          Convert from foreign currency back to sterling.
 java.lang.String convertFromUKandFormat(double value)
          Format a number in the locale currency.
 double convertToUK(double value)
          Convert from foreign currency back to sterling.
 java.lang.String displayCurrency(double value)
           
 org.melati.poem.Field getCountries()
           
 Country getCountryCode()
           
 Currency getCurrency()
           
 Currency getCurrency(java.util.Locale localeP)
           
 double getDeliveryValue()
          Work out the cost of delivery.
 double getDiscountRate()
          If you want to apply a discount to this order, do it here.
 java.util.Locale getLocale()
          Get the Locale for this trolley.
 ShopOrder getOrder()
           
 java.util.Enumeration getSuppliersCharges()
          Extract the list of supplier's charges.
 boolean hasDelivery()
          Provide a mechanism for working out if this order should include a delivery charge.
 boolean hasDiscount()
          Provide a mechanism for working out if this order should include a discount.
 boolean hasVAT()
          Provide a mechanism for working out if this order should include VAT (default should be true).
 void initialise(org.melati.Melati melatiP, org.paneris.melati.shopping.MelatiShoppingConfig configP)
          Public Constructor to build a trolley from some id.
 void load(java.lang.Integer id)
          Load a trolley from something persistent.
static java.lang.String name()
          Return the name of the trolley (for storing in the session).
static double round(double num)
           
 void save()
          Save a trolley to something persistent.
 void setCountryCode(Country newCode)
           
 void setDefaultDetails(org.melati.Melati melati)
           
 void setFromForm(org.melati.Melati melati)
           
 
Methods inherited from class org.paneris.melati.shopping.ShoppingTrolley
abandonURL, addItem, baseURL, confirmURL, detailsURL, displayCurrency, getCountry, getCounty, getDeliveryAddress, getDeliveryDisplay, getDiscountRateDisplay, getDiscountValue, getDiscountValueDisplay, getEmail, getInstance, getItem, getItems, getMessage, getName, getPostcode, getTel, getTotalDeliveryValue, getTotalValue, getTotalValueDisplay, getTotalValuePence, getTown, getValue, getValueDisplay, getVATDisplay, getVATValue, hasDetails, initialise, isEmpty, newItem, newTrolley, paidURL, remove, removeItem, roundTo2dp, setCountry, setCounty, setDeliveryAddress, setEmail, setLocale, setMessage, setName, setPostcode, setTel, setTown, updateURL, viewURL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

countryCode

public Country countryCode
Constructor Detail

BibliomaniaShoppingTrolley

public BibliomaniaShoppingTrolley()
Method Detail

getLocale

public java.util.Locale getLocale()
Get the Locale for this trolley.

Specified by:
getLocale in class org.paneris.melati.shopping.ShoppingTrolley

initialise

public void initialise(org.melati.Melati melatiP,
                       org.paneris.melati.shopping.MelatiShoppingConfig configP)
Public Constructor to build a trolley from some id.

Overrides:
initialise in class org.paneris.melati.shopping.ShoppingTrolley

load

public void load(java.lang.Integer id)
          throws org.melati.util.InstantiationPropertyException
Load a trolley from something persistent.

Specified by:
load in class org.paneris.melati.shopping.ShoppingTrolley
Throws:
org.melati.util.InstantiationPropertyException

save

public void save()
Save a trolley to something persistent.

Specified by:
save in class org.paneris.melati.shopping.ShoppingTrolley

hasDelivery

public boolean hasDelivery()
Provide a mechanism for working out if this order should include a delivery charge.

Specified by:
hasDelivery in class org.paneris.melati.shopping.ShoppingTrolley

canSupply

public boolean canSupply()
Can we deliver this - we need to check that each item has a supplier.


getDeliveryValue

public double getDeliveryValue()
Work out the cost of delivery.

Specified by:
getDeliveryValue in class org.paneris.melati.shopping.ShoppingTrolley

getSuppliersCharges

public java.util.Enumeration getSuppliersCharges()
Extract the list of supplier's charges.


hasDiscount

public boolean hasDiscount()
Provide a mechanism for working out if this order should include a discount.

Specified by:
hasDiscount in class org.paneris.melati.shopping.ShoppingTrolley

getDiscountRate

public double getDiscountRate()
If you want to apply a discount to this order, do it here.

Specified by:
getDiscountRate in class org.paneris.melati.shopping.ShoppingTrolley

hasVAT

public boolean hasVAT()
Provide a mechanism for working out if this order should include VAT (default should be true).

Specified by:
hasVAT in class org.paneris.melati.shopping.ShoppingTrolley

getCountries

public org.melati.poem.Field getCountries()

getCountryCode

public Country getCountryCode()

setFromForm

public void setFromForm(org.melati.Melati melati)
Overrides:
setFromForm in class org.paneris.melati.shopping.ShoppingTrolley

setCountryCode

public void setCountryCode(Country newCode)

setDefaultDetails

public void setDefaultDetails(org.melati.Melati melati)
Specified by:
setDefaultDetails in class org.paneris.melati.shopping.ShoppingTrolley

assertLogin

public void assertLogin(org.melati.Melati melatiP)
Specified by:
assertLogin in class org.paneris.melati.shopping.ShoppingTrolley

confirmPayment

public void confirmPayment(org.melati.Melati melatiP)
Specified by:
confirmPayment in class org.paneris.melati.shopping.ShoppingTrolley

name

public static java.lang.String name()
Return the name of the trolley (for storing in the session).


getOrder

public ShopOrder getOrder()

round

public static double round(double num)

convertFromUKandFormat

public java.lang.String convertFromUKandFormat(double value)
Format a number in the locale currency.


convertFromUK

public double convertFromUK(double value)
Convert from foreign currency back to sterling.


convertToUK

public double convertToUK(double value)
Convert from foreign currency back to sterling.


getCurrency

public Currency getCurrency(java.util.Locale localeP)

getCurrency

public Currency getCurrency()

displayCurrency

public java.lang.String displayCurrency(double value)
Overrides:
displayCurrency in class org.paneris.melati.shopping.ShoppingTrolley

configureRequest

public void configureRequest(org.melati.Melati melatiP)
Overrides:
configureRequest in class org.paneris.melati.shopping.ShoppingTrolley


Copyright © 2000-2009 PanEris. All Rights Reserved.