KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > data > fields > FieldTypes


1 //
2
// FieldTypes
3
// EV 18.11.2000
4
//
5
//
6

7 package org.jahia.data.fields;
8
9 import java.util.Hashtable JavaDoc;
10
11 public class FieldTypes {
12
13     public static final int UNDEFINED = 0;
14     public static final int INTEGER = 1;
15     public static final int SMALLTEXT = 2;
16     public static final int BIGTEXT = 3;
17     public static final int DATE = 4;
18     public static final int PAGE = 5;
19     public static final int FILE = 6;
20     // public static final int IMAGE = 7;
21
// public static final int AUDIOCLIP = 8;
22
// public static final int VIDEOCLIP = 9;
23
public static final int APPLICATION = 10;
24     public static final int FLOAT = 11;
25     public static final int BOOLEAN = 12;
26     public static final int COLOR = 13;
27
28     public static final int SMALLTEXT_SHARED_LANG = 20;
29
30
31     public static final String JavaDoc typeName[] = {
32         "Undefined",
33         "Integer",
34         "Small text",
35         "Big text",
36         "Date",
37         "Page",
38         "File",
39         "Image",
40         "Audio clip",
41         "Video clip",
42         "Application",
43         "Float",
44         "Boolean",
45         "Color",
46         "",
47         "",
48         "",
49         "",
50         "",
51         "",
52         "Small Text Shared Lang"};
53
54     private static FieldTypes theObject;
55
56     /**
57      * @associates Integer
58      */

59     private Hashtable JavaDoc fieldTypes;
60
61     /**
62      * @associates String
63      */

64     private Hashtable JavaDoc fieldClassNames;
65
66
67
68     /***
69         * constructor
70         *
71         */

72     protected FieldTypes()
73     {
74         fieldTypes = new Hashtable JavaDoc();
75         fieldTypes.put( "Undefined", new Integer JavaDoc(UNDEFINED));
76         fieldTypes.put( "Integer", new Integer JavaDoc(INTEGER) );
77         fieldTypes.put( "SmallText", new Integer JavaDoc(SMALLTEXT) );
78         fieldTypes.put( "BigText", new Integer JavaDoc(BIGTEXT) );
79         fieldTypes.put( "Date", new Integer JavaDoc(DATE) );
80         fieldTypes.put( "Page", new Integer JavaDoc(PAGE) );
81         fieldTypes.put( "File", new Integer JavaDoc(FILE) );
82         fieldTypes.put( "Application", new Integer JavaDoc(APPLICATION) );
83         fieldTypes.put( "Float", new Integer JavaDoc(FLOAT) );
84         fieldTypes.put( "Boolean", new Integer JavaDoc(BOOLEAN) );
85         fieldTypes.put( "Color", new Integer JavaDoc(COLOR) );
86         fieldTypes.put( "SharedSmallText", new Integer JavaDoc(SMALLTEXT_SHARED_LANG) );
87
88         fieldClassNames = new Hashtable JavaDoc();
89         fieldClassNames.put( new Integer JavaDoc(UNDEFINED), "org.jahia.data.fields.JahiaUndefinedField");
90         fieldClassNames.put( new Integer JavaDoc(INTEGER), "org.jahia.data.fields.JahiaIntegerField");
91         fieldClassNames.put( new Integer JavaDoc(SMALLTEXT), "org.jahia.data.fields.JahiaSmallTextField");
92         fieldClassNames.put( new Integer JavaDoc(BIGTEXT), "org.jahia.data.fields.JahiaBigTextField");
93         fieldClassNames.put( new Integer JavaDoc(PAGE), "org.jahia.data.fields.JahiaPageField");
94         fieldClassNames.put( new Integer JavaDoc(FILE), "org.jahia.data.fields.JahiaFileFieldWrapper");
95         fieldClassNames.put( new Integer JavaDoc(APPLICATION), "org.jahia.data.fields.JahiaApplicationField");
96         fieldClassNames.put( new Integer JavaDoc(FLOAT), "org.jahia.data.fields.JahiaFloatField");
97         fieldClassNames.put( new Integer JavaDoc(BOOLEAN), "org.jahia.data.fields.JahiaBooleanField");
98         fieldClassNames.put( new Integer JavaDoc(DATE), "org.jahia.data.fields.JahiaDateField");
99         fieldClassNames.put( new Integer JavaDoc(COLOR), "org.jahia.data.fields.JahiaColorField");
100         fieldClassNames.put( new Integer JavaDoc(SMALLTEXT_SHARED_LANG), "org.jahia.data.fields.JahiaSmallTextSharedLangField");
101
102     } // end constructor
103

104
105
106     /***
107         * returns a single instance of the object
108         *
109         */

110     public static synchronized FieldTypes getInstance()
111     {
112         if (theObject == null) {
113             theObject = new FieldTypes();
114         }
115         return theObject;
116     } // end getInstance
117

118
119
120     /***
121         * gets available field types
122         *
123         */

124     public Hashtable JavaDoc getFieldTypes()
125     {
126         Hashtable JavaDoc out = (Hashtable JavaDoc) fieldTypes.clone();
127         return out;
128     } // end getFieldTypes
129

130
131     /***
132         * gets fieldClassName
133         *
134         */

135     public Hashtable JavaDoc getFieldClassNames()
136     {
137         Hashtable JavaDoc ret = (Hashtable JavaDoc) fieldClassNames.clone();
138         return ret;
139     } // end getFieldTypes
140

141
142 } // end FieldTypes
143
Popular Tags