01: package com.jamonapi.utils;
02:
03: import com.jamonapi.*;
04:
05: /**
06: @author Steve Souza
07:
08: This class defines constants for use in an application.
09:
10: Currently it contains constants that define what the applications HTML tables and listboxes will look like.
11: The constants defined in this class can be accessed as follows:
12:
13: String str=AppConstants.HTMLTable.COL_PREFIX;
14:
15: Note that being as all values are static the AppConstants object does not to be created
16: with new to reference it.
17:
18: */
19:
20: public class AppConstants extends java.lang.Object {
21: //public static final String DATASOURCE="DataSource";
22: public static final int MONITOR_PRIORITY_LEVEL = 11;
23: public static final String MONITOR_PREFIX = "webdev.";
24:
25: /*private static Map appConstants;
26:
27: static {
28: appConstants = AppMap.createInstance();
29:
30: appConstants.put(DATASOURCE, DATASOURCE);
31: appConstants.put("formMethod", "post");
32: appConstants.put("debug", "0");
33: appConstants.put("dateFormat", "M/d/yy");
34: appConstants.put( "errorIndicator", "** ");
35: appConstants.put( "requiredField", "This is a required field.<br>");
36: appConstants.put( "invalidDate", " is an invalid date.<br>");
37: appConstants.put( "conversion", " was not converted properly.<br>");
38: appConstants.put( "fieldNoExists", " Field object must be defined.<br>");
39:
40: }
41:
42: public static void setAppConstants(Map newAppConstants)
43: {
44: appConstants = newAppConstants;
45: }
46:
47: public static Map getAppConstants()
48: {
49: return appConstants;
50: }
51:
52:
53:
54: public static String get(String key) {
55: String value="The requested AppConstant was not found. Please contact a developer. key="+key;
56:
57: if (appConstants.containsKey(key))
58: value = appConstants.get(key).toString();
59: else
60: Logger.log(value);
61:
62: return value;
63:
64: }
65:
66: */
67: public static Monitor start(String locator) {
68: return MonitorFactory.getDebugFactory(MONITOR_PRIORITY_LEVEL)
69: .start(MONITOR_PREFIX + locator);
70: }
71:
72: }
|