Package common.money

Examples of common.money.MonetaryAmountEditor


    private MonetaryAmountEditor amountEditor;

    private SimpleDateEditor dateEditor;

    public FormattedReward(Reward reward) {
      amountEditor = new MonetaryAmountEditor();
      amountEditor.setValue(reward.getAmount());
      dateEditor = new SimpleDateEditor();
      dateEditor.setValue(reward.getDate());
      this.reward = reward;
    }
View Full Code Here


   */
  public ModelAndView newForm(HttpServletRequest request, HttpServletResponse response) {
    RewardForm rewardForm = new RewardForm();
    DataBinder binder = new DataBinder(rewardForm, "rewardForm");
    // installs a type converter to convert from String to MonetaryAmount during form data binding
    binder.registerCustomEditor(MonetaryAmount.class, new MonetaryAmountEditor());
    return new ModelAndView("reward/new", binder.getBindingResult().getModel());
  }
View Full Code Here

  public ModelAndView create(HttpServletRequest request, HttpServletResponse response) {
    RewardForm rewardForm = new RewardForm();
    ServletRequestDataBinder binder = new ServletRequestDataBinder(rewardForm, "rewardForm");
    // enforces these fields are present in the form
    binder.setRequiredFields(new String[] { "creditCardNumber", "amount", "merchantNumber" });
    binder.registerCustomEditor(MonetaryAmount.class, new MonetaryAmountEditor());
    // copies parameters in the request to the reward form
    binder.bind(request);
    if (binder.getBindingResult().hasErrors()) {
      return new ModelAndView("reward/new", binder.getBindingResult().getModel());
    } else {
View Full Code Here

   * @return a selection of the "show" view to render the reward
   */
  public ModelAndView show(HttpServletRequest request, HttpServletResponse response) {
    Reward reward = rewardLookupService.lookupReward(extractConfirmationNumber(request));
    DataBinder binder = new DataBinder(reward, "reward");
    binder.registerCustomEditor(MonetaryAmount.class, new MonetaryAmountEditor());
    binder.registerCustomEditor(SimpleDate.class, new SimpleDateEditor());
    return new ModelAndView("reward/show", binder.getBindingResult().getModel());
  }
View Full Code Here

     * @param binder the data binder to configure
     */
  @InitBinder
    public void initBinder(WebDataBinder binder) {
    binder.setRequiredFields(new String[] { "creditCardNumber", "amount", "merchantNumber" });
    binder.registerCustomEditor(MonetaryAmount.class, new MonetaryAmountEditor());
    binder.registerCustomEditor(SimpleDate.class, new SimpleDateEditor());
   
View Full Code Here

     * @param binder the data binder to configure
     */
  @InitBinder
    public void initBinder(WebDataBinder binder) {
    binder.setRequiredFields(new String[] { "creditCardNumber", "amount", "merchantNumber" });
    binder.registerCustomEditor(MonetaryAmount.class, new MonetaryAmountEditor());
    binder.registerCustomEditor(SimpleDate.class, new SimpleDateEditor());
   
View Full Code Here

TOP

Related Classes of common.money.MonetaryAmountEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.