/*
* Copyright (c) 2001 - 2005 ivata limited.
* All rights reserved.
* -----------------------------------------------------------------------------
* ivata masks may be redistributed under the GNU General Public
* License as published by the Free Software Foundation;
* version 2 of the License.
*
* These programs are free software; you can redistribute them and/or
* modify them under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the License.
*
* These programs are distributed in the hope that they will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License in the file LICENSE.txt for more
* details.
*
* If you would like a copy of the GNU General Public License write to
*
* Free Software Foundation, Inc.
* 59 Temple Place - Suite 330
* Boston, MA 02111-1307, USA.
*
*
* To arrange commercial support and licensing, contact ivata at
* http://www.ivata.com/contact.jsp
* -----------------------------------------------------------------------------
* $Log: FormatConstants.java,v $
* Revision 1.4 2005/10/02 14:06:33 colinmacleod
* Added/improved log4j logging.
*
* Revision 1.3 2005/04/09 18:04:18 colinmacleod
* Changed copyright text to GPL v2 explicitly.
*
* Revision 1.2 2005/01/19 12:51:54 colinmacleod
* Fixed bundle and resource paths.
*
* Revision 1.1 2005/01/06 22:41:01 colinmacleod
* Moved up a version number.
* Changed copyright notices to 2005.
* Updated the documentation:
* - started working on multiproject:site docu.
* - changed the logo.
* Added checkstyle and fixed LOADS of style issues.
* Added separate thirdparty subproject.
* Added struts (in web), util and webgui (in webtheme) from ivata op.
*
* Revision 1.4 2004/07/13 19:48:11 colinmacleod
* Moved project to POJOs from EJBs.
* Applied PicoContainer to services layer (replacing session EJBs).
* Applied Hibernate to persistence layer (replacing entity EJBs).
*
* Revision 1.3 2004/03/21 21:16:37 colinmacleod
* Shortened name to ivata op.
*
* Revision 1.2 2004/02/01 22:07:32 colinmacleod
* Added full names to author tags
*
* Revision 1.1.1.1 2004/01/27 20:59:47 colinmacleod
* Moved ivata op to SourceForge.
*
* Revision 1.2 2003/10/15 14:13:39 colin
* Fixes for XDoclet.
*
* Revision 1.1 2003/02/24 19:33:32 colin
* Moved to new subproject.
*
* Revision 1.4 2003/02/04 17:43:46 colin
* copyright notice
*
* Revision 1.3 2002/11/13 09:20:39 colin
* changed the resource bundle used to
* com.ivata.mask.business.ApplicationResources
*
* Revision 1.2 2002/11/12 09:01:46 colin
* added getLabelValues for use with Struts
*
* Revision 1.1 2002/08/10 21:20:34 colin
* HTML/Text format constants as used in the library
* -----------------------------------------------------------------------------
*/
package com.ivata.mask.web.format;
import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.ResourceBundle;
import java.util.Vector;
import org.apache.struts.util.LabelValueBean;
/**
* <p>
* Constants used to identify different text and HTML formats.
* </p>
*
* @since ivata masks 0.4 (2002-07-11)
* @author Colin MacLeod <a
* href="mailto:colin.macleod@ivata.com">colin.macleod@ivata.com </a>
* @version $Revision: 1.4 $
*/
public final class FormatConstants {
/**
* Logger for this class.
*/
private static final Logger logger = Logger
.getLogger(FormatConstants.class);
/**
* <p>
* Identifies text with HTML tags in input text-areas. This will sent to the
* page as it is.
* </p>
*/
public static final int FORMAT_HTML = 1;
/**
* <p>
* Identifies clear text in input text-areas. This will be parsed using
* HTMLFormatter with line break conversion.
* </p>
*/
public static final int FORMAT_TEXT = 0;
/**
* <p>
* Get all of the format constants and their labels. This is useful for
* populating <code>option</code> tags in <strong>Struts </strong>.
* </p>
*
* @return <code>Collection</code> of {@link
* com.ivata.mask.util.LabelValueBean LabelValueBean} instances.
*/
public static Collection getLabelValues() {
if (logger.isDebugEnabled()) {
logger.debug("getLabelValues() - start");
}
Vector collection = new Vector();
ResourceBundle formatResources = ResourceBundle
.getBundle("com.ivata.mask.web.ApplicationResources");
collection.add(new LabelValueBean(formatResources
.getString("web.format.constant.text"), new Integer(
FORMAT_TEXT).toString()));
collection.add(new LabelValueBean(formatResources
.getString("web.format.constant.html"), new Integer(
FORMAT_HTML).toString()));
if (logger.isDebugEnabled()) {
logger.debug("getLabelValues() - end - return value = "
+ collection);
}
return collection;
}
/**
* Private default constructor enforces utility class behavior.
*/
private FormatConstants() {
}
}
|