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: FieldWriterFactory.java,v $
31   * Revision 1.6  2005/04/09 18:04:17  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.5  2005/01/19 12:51:03  colinmacleod
35   * Changed Id --> Name.
36   *
37   * Revision 1.4  2005/01/07 08:08:24  colinmacleod
38   * Moved up a version number.
39   * Changed copyright notices to 2005.
40   * Updated the documentation:
41   *   - started working on multiproject:site docu.
42   *   - changed the logo.
43   * Added checkstyle and fixed LOADS of style issues.
44   * Added separate thirdparty subproject.
45   * Added struts (in web), util and webgui (in webtheme) from ivata op.
46   *
47   * Revision 1.3  2004/11/12 15:10:41  colinmacleod
48   * Moved persistence classes from ivata op as a replacement for
49   * ValueObjectLocator.
50   *
51   * Revision 1.2  2004/11/11 13:44:04  colinmacleod
52   * Added HTMLFormatter.
53   *
54   * Revision 1.1.1.1  2004/05/16 20:40:32  colinmacleod
55   * Ready for 0.1 release
56   * -----------------------------------------------------------------------------
57   */
58  package com.ivata.mask.web.field;
59  import com.ivata.mask.field.Field;
60  import com.ivata.mask.util.SystemException;
61  import com.ivata.mask.valueobject.ValueObject;
62  /***
63   * <p>
64   * Use implementations of this interface to generate an appropriate field
65   * writer for a given mask and field.
66   * </p>
67   *
68   * @since ivata masks 0.1 (2004-05-14)
69   * @author Colin MacLeod
70   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
71   * @version $Revision: 1.6 $
72   */
73  public interface FieldWriterFactory {
74      /***
75       * <p>
76       * Name of the attribute to set in the application scope. You must store an
77       * appropriate instance of this class in this attribute, so that the field
78       * tag can locate the field writer factory.
79       * </p>
80       */
81      String APPLICATION_ATTRIBUTE = "FieldWriterFactory";
82      /***
83       * Get a field writer appropriate to the given field.
84       *
85       * @param valueObject
86       *            Value object on which to operate.
87       * @param field
88       *            Field for which to return an appropriate field writer.
89       * @param subField
90       *            If this field writer is for a sublist, defines the field
91       *            within a field which is actually being displayed.
92       * @param hidden
93       * If <code>true</code>, overrides the field definition, and gets a writer
94       * for a hidden field.
95       * @return valid field writer for the field provided.
96       * @throws SystemException
97       *             if the writer cannot be retrieved for any reason.
98       */
99      FieldWriter getFieldWriter(ValueObject valueObject, Field field,
100             Field subField, boolean hidden) throws SystemException;
101 }
102