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: FormatConstants.java,v $
31 * Revision 1.3 2005/04/09 18:04:18 colinmacleod
32 * Changed copyright text to GPL v2 explicitly.
33 *
34 * Revision 1.2 2005/01/19 12:51:54 colinmacleod
35 * Fixed bundle and resource paths.
36 *
37 * Revision 1.1 2005/01/06 22:41:01 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.4 2004/07/13 19:48:11 colinmacleod
48 * Moved project to POJOs from EJBs.
49 * Applied PicoContainer to services layer (replacing session EJBs).
50 * Applied Hibernate to persistence layer (replacing entity EJBs).
51 *
52 * Revision 1.3 2004/03/21 21:16:37 colinmacleod
53 * Shortened name to ivata op.
54 *
55 * Revision 1.2 2004/02/01 22:07:32 colinmacleod
56 * Added full names to author tags
57 *
58 * Revision 1.1.1.1 2004/01/27 20:59:47 colinmacleod
59 * Moved ivata op to SourceForge.
60 *
61 * Revision 1.2 2003/10/15 14:13:39 colin
62 * Fixes for XDoclet.
63 *
64 * Revision 1.1 2003/02/24 19:33:32 colin
65 * Moved to new subproject.
66 *
67 * Revision 1.4 2003/02/04 17:43:46 colin
68 * copyright notice
69 *
70 * Revision 1.3 2002/11/13 09:20:39 colin
71 * changed the resource bundle used to
72 * com.ivata.mask.business.ApplicationResources
73 *
74 * Revision 1.2 2002/11/12 09:01:46 colin
75 * added getLabelValues for use with Struts
76 *
77 * Revision 1.1 2002/08/10 21:20:34 colin
78 * HTML/Text format constants as used in the library
79 * -----------------------------------------------------------------------------
80 */
81 package com.ivata.mask.web.format;
82 import java.util.Collection;
83 import java.util.ResourceBundle;
84 import java.util.Vector;
85 import org.apache.struts.util.LabelValueBean;
86 /***
87 * <p>
88 * Constants used to identify different text and HTML formats.
89 * </p>
90 *
91 * @since ivata masks 0.4 (2002-07-11)
92 * @author Colin MacLeod <a
93 * href="mailto:colin.macleod@ivata.com">colin.macleod@ivata.com </a>
94 * @version $Revision: 1.3 $
95 */
96 public final class FormatConstants {
97 /***
98 * <p>
99 * Identifies text with HTML tags in input text-areas. This will sent to the
100 * page as it is.
101 * </p>
102 */
103 public static final int FORMAT_HTML = 1;
104 /***
105 * <p>
106 * Identifies clear text in input text-areas. This will be parsed using
107 * HTMLFormatter with line break conversion.
108 * </p>
109 */
110 public static final int FORMAT_TEXT = 0;
111 /***
112 * <p>
113 * Get all of the format constants and their labels. This is useful for
114 * populating <code>option</code> tags in <strong>Struts </strong>.
115 * </p>
116 *
117 * @return <code>Collection</code> of {@link
118 * com.ivata.mask.util.LabelValueBean LabelValueBean} instances.
119 */
120 public static Collection getLabelValues() {
121 Vector collection = new Vector();
122 ResourceBundle formatResources = ResourceBundle
123 .getBundle("com.ivata.mask.web.ApplicationResources");
124 collection.add(new LabelValueBean(formatResources
125 .getString("web.format.constant.text"), new Integer(
126 FORMAT_TEXT).toString()));
127 collection.add(new LabelValueBean(formatResources
128 .getString("web.format.constant.html"), new Integer(
129 FORMAT_HTML).toString()));
130 return collection;
131 }
132 /***
133 * Private default constructor enforces utility class behavior.
134 */
135 private FormatConstants() {
136 }
137 }
138