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: FieldWriter.java,v $
31   * Revision 1.5  2005/04/09 18:04:17  colinmacleod
32   * Changed copyright text to GPL v2 explicitly.
33   *
34   * Revision 1.4  2005/01/19 12:51:03  colinmacleod
35   * Changed Id --> Name.
36   *
37   * Revision 1.3  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.2  2004/11/11 13:44:04  colinmacleod
48   * Added HTMLFormatter.
49   *
50   * Revision 1.1.1.1  2004/05/16 20:40:32  colinmacleod
51   * Ready for 0.1 release
52   * -----------------------------------------------------------------------------
53   */
54  package com.ivata.mask.web.field;
55  import javax.servlet.jsp.PageContext;
56  import com.ivata.mask.valueobject.ValueObject;
57  /***
58   * <p>
59   * Each field writer is responsble for writing out a single field value, given
60   * the value object.
61   * </p>
62   *
63   * @since ivata masks 0.4 (2004-05-14)
64   * @author Colin MacLeod
65   * <a href='mailto:colin.macleod@ivata.com'>colin.macleod@ivata.com</a>
66   * @version $Revision: 1.5 $
67   */
68  public interface FieldWriter {
69      /***
70       * Clear an attribute on the field tag. It will no longer appear at all.
71       *
72       * @param name name of the attribute to clear.
73       */
74      void removeAttribute(String name);
75      /***
76       * Set an attribute on the field tag.
77       *
78       * @param name name of the attribute to set.
79       * @param value new value to set the attribute to.
80       */
81      void setAttribute(String name, String value);
82      /***
83       * <p>
84       * Write out the appropriate field value, for the value object provided.
85       * </p>
86       *
87       * @param pageContext
88       *            current tag page context to write with.
89       * @param valueObject
90       *            value object whose field value should be displayed.
91       * @param displayOnly
92       *            if <code>true</code>, only the field value should be shown,
93       *            otherwise an input field is displayed.
94       * @return appropriate representation of the field value in
95       *         <code>HTML</code>.
96       */
97      String write(PageContext pageContext, ValueObject valueObject,
98              boolean displayOnly);
99  }
100