View Javadoc

1   /*
2    * Copyright (c) 2001 - 2005 ivata limited.
3    * All rights reserved.
4    * -----------------------------------------------------------------------------
5    * ivata masks may be redistributed under the GNU General Public
6    * License as published by the Free Software Foundation;
7    * version 2 of the License.
8    *
9    * These programs are free software; you can redistribute them and/or
10   * modify them under the terms of the GNU General Public License
11   * as published by the Free Software Foundation; version 2 of the License.
12   *
13   * These programs are distributed in the hope that they will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16   *
17   * See the GNU General Public License in the file LICENSE.txt for more
18   * details.
19   *
20   * If you would like a copy of the GNU General Public License write to
21   *
22   * Free Software Foundation, Inc.
23   * 59 Temple Place - Suite 330
24   * Boston, MA 02111-1307, USA.
25   *
26   *
27   * To arrange commercial support and licensing, contact ivata at
28   *                  http://www.ivata.com/contact.jsp
29   * -----------------------------------------------------------------------------
30   * $Log: DemoRequestProcessor.java,v $
31   * Revision 1.6  2005/04/11 12:21:15  colinmacleod
32   * Changed MaskRequestProcessorImpl to
33   * MaskRequestProcessorImplementation.
34   * Improved tiles support.
35   *
36   * Revision 1.5  2005/04/09 18:04:14  colinmacleod
37   * Changed copyright text to GPL v2 explicitly.
38   *
39   * Revision 1.4  2005/01/07 09:13:04  colinmacleod
40   * Added newline to end of file.
41   *
42   * Revision 1.3  2005/01/07 08:08:18  colinmacleod
43   * Moved up a version number.
44   * Changed copyright notices to 2005.
45   * Updated the documentation:
46   *   - started working on multiproject:site docu.
47   *   - changed the logo.
48   * Added checkstyle and fixed LOADS of style issues.
49   * Added separate thirdparty subproject.
50   * Added struts (in web), util and webgui (in webtheme) from ivata op.
51   *
52   * Revision 1.2  2004/12/23 21:28:16  colinmacleod
53   * Modifications to add ivata op compatibility.
54   *
55   * Revision 1.1.1.1  2004/05/16 20:40:07  colinmacleod
56   * Ready for 0.1 release
57   * -----------------------------------------------------------------------------
58   */
59  package com.ivata.mask.web.demo.struts;
60  import java.math.BigDecimal;
61  
62  import com.ivata.mask.field.DefaultFieldValueConvertorFactory;
63  import com.ivata.mask.field.number.NumberFieldValueConvertor;
64  import com.ivata.mask.web.demo.catalog.Catalog;
65  import com.ivata.mask.web.struts.MaskRequestProcessorImplementation;
66  import com.ivata.mask.web.struts.MaskTilesRequestProcessor;
67  /***
68   * <p>
69   * Overridden to specify the mask factory and the value object locator for the
70   * superclass.
71   * </p>
72   *
73   * @since ivata masks 0.1 (2004-05-11)
74   * @author Colin MacLeod
75   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
76   * @version $Revision: 1.6 $
77   */
78  public class DemoRequestProcessor extends MaskTilesRequestProcessor {
79      /***
80       * <p>
81       * Default constructor. Initializes the mask factory and value object
82       * locator (catalog) in the superclass.
83       * </p>
84       */
85      public DemoRequestProcessor() {
86          super(Catalog.getInstance().getMaskFactory(), Catalog.getInstance());
87          setImplementation(new MaskRequestProcessorImplementation(
88                          Catalog.getInstance().getMaskFactory(),
89                          Catalog.getInstance(),
90                          new DefaultFieldValueConvertorFactory()));
91          // BigDecimals are amounts for us - override the default to always show
92          // 2 decimals.
93          getImplementation().getFieldValueConvertorFactory().
94              setFieldValueConvertor(BigDecimal.class,
95                      new NumberFieldValueConvertor(
96                      "0.00"));
97      }
98  }
99