1 7 package org.jahia.data.fields; 8 9 import java.util.Hashtable ; 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 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 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 59 private Hashtable fieldTypes; 60 61 64 private Hashtable fieldClassNames; 65 66 67 68 72 protected FieldTypes() 73 { 74 fieldTypes = new Hashtable (); 75 fieldTypes.put( "Undefined", new Integer (UNDEFINED)); 76 fieldTypes.put( "Integer", new Integer (INTEGER) ); 77 fieldTypes.put( "SmallText", new Integer (SMALLTEXT) ); 78 fieldTypes.put( "BigText", new Integer (BIGTEXT) ); 79 fieldTypes.put( "Date", new Integer (DATE) ); 80 fieldTypes.put( "Page", new Integer (PAGE) ); 81 fieldTypes.put( "File", new Integer (FILE) ); 82 fieldTypes.put( "Application", new Integer (APPLICATION) ); 83 fieldTypes.put( "Float", new Integer (FLOAT) ); 84 fieldTypes.put( "Boolean", new Integer (BOOLEAN) ); 85 fieldTypes.put( "Color", new Integer (COLOR) ); 86 fieldTypes.put( "SharedSmallText", new Integer (SMALLTEXT_SHARED_LANG) ); 87 88 fieldClassNames = new Hashtable (); 89 fieldClassNames.put( new Integer (UNDEFINED), "org.jahia.data.fields.JahiaUndefinedField"); 90 fieldClassNames.put( new Integer (INTEGER), "org.jahia.data.fields.JahiaIntegerField"); 91 fieldClassNames.put( new Integer (SMALLTEXT), "org.jahia.data.fields.JahiaSmallTextField"); 92 fieldClassNames.put( new Integer (BIGTEXT), "org.jahia.data.fields.JahiaBigTextField"); 93 fieldClassNames.put( new Integer (PAGE), "org.jahia.data.fields.JahiaPageField"); 94 fieldClassNames.put( new Integer (FILE), "org.jahia.data.fields.JahiaFileFieldWrapper"); 95 fieldClassNames.put( new Integer (APPLICATION), "org.jahia.data.fields.JahiaApplicationField"); 96 fieldClassNames.put( new Integer (FLOAT), "org.jahia.data.fields.JahiaFloatField"); 97 fieldClassNames.put( new Integer (BOOLEAN), "org.jahia.data.fields.JahiaBooleanField"); 98 fieldClassNames.put( new Integer (DATE), "org.jahia.data.fields.JahiaDateField"); 99 fieldClassNames.put( new Integer (COLOR), "org.jahia.data.fields.JahiaColorField"); 100 fieldClassNames.put( new Integer (SMALLTEXT_SHARED_LANG), "org.jahia.data.fields.JahiaSmallTextSharedLangField"); 101 102 } 104 105 106 110 public static synchronized FieldTypes getInstance() 111 { 112 if (theObject == null) { 113 theObject = new FieldTypes(); 114 } 115 return theObject; 116 } 118 119 120 124 public Hashtable getFieldTypes() 125 { 126 Hashtable out = (Hashtable ) fieldTypes.clone(); 127 return out; 128 } 130 131 135 public Hashtable getFieldClassNames() 136 { 137 Hashtable ret = (Hashtable ) fieldClassNames.clone(); 138 return ret; 139 } 141 142 } | Popular Tags |