KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > raptus > owxv3 > api > FieldDefinition


1 /*
2  * eAdmin/OWX
3  * Copyright (C) 1996-2003 OWX-Project Team <owx-team@gmx.net>
4  */

5
6 package com.raptus.owxv3.api;
7
8
9 import java.util.*;
10 import com.raptus.owxv3.*;
11
12
13 /**
14  *
15  * <hr>
16  * <table width="100%" border="0">
17  * <tr>
18  * <td width="24%"><b>Filename</b></td><td width="76%">FieldDefinition.java</td>
19  * </tr>
20  * <tr>
21  * <td width="24%"><b>Author</b></td><td width="76%">REEA</td>
22  * </tr>
23  * <tr>
24  * <td width="24%"><b>Date</b></td><td width="76%">22th of April 2002</td>
25  * </tr>
26  * </table>
27  * <hr>
28  * <table width="100%" border="0">
29  * <tr>
30  * <td width="24%"><b>Date / Author</b></td><td width="76%"><b>Changes</b></td>
31  * </tr>
32  * </table>
33  * <hr>
34  * This class holds a filed defintion form the config file
35  */

36 public class FieldDefinition extends Object JavaDoc
37 {
38     /**
39      *Boolean showing that this field is multilanguage or not
40      */

41     protected boolean multiLanguage;
42     
43     /**
44      *The type of this field
45      */

46     protected int type;
47     
48     /**
49      *The default value of this field def (Locale,String)
50      */

51     protected Hashtable defaultMLVal;
52     
53     /**
54      *Default value in case of locale insensitive field
55      */

56     protected String JavaDoc defaultVal;
57     
58     /**
59      *The label for this field to be displayed
60      */

61     protected Hashtable label;
62     
63     /**
64      *Is this field wysiwyg or not?
65      */

66     protected boolean wysiwyg;
67     
68      /**
69      *Can this field be empty?
70      */

71     protected boolean empty;
72     
73     /**
74      *
75      */

76     protected String JavaDoc name;
77     
78     public FieldDefinition()
79     {
80         multiLanguage=false;
81         wysiwyg=false;
82         type=Constants.FIELDTYPE_UNKNOWN;
83     }
84     
85     public void setType(String JavaDoc t)
86     {
87         if(t.equalsIgnoreCase("text"))
88         {
89             type=Constants.FIELDTYPE_TEXT;
90         }
91         else if(t.equalsIgnoreCase("number"))
92         {
93             type=Constants.FIELDTYPE_NUMBER;
94         }
95         else if(t.equalsIgnoreCase("date"))
96         {
97             type=Constants.FIELDTYPE_DATE;
98         }
99         else if(t.equalsIgnoreCase("price"))
100         {
101             type=Constants.FIELDTYPE_PRICE;
102         }
103     }
104     
105     public int getType()
106     {
107         return type;
108     }
109     
110     public void setDefaultVal(Hashtable h)
111     {
112         defaultMLVal=h;
113         multiLanguage=true;
114     }
115     
116     public void setDefaultVal(String JavaDoc s)
117     {
118         defaultVal=s;
119     }
120    
121     public String JavaDoc getDefaultVal(String JavaDoc locale)
122     {
123         if(multiLanguage) return (String JavaDoc)defaultMLVal.get(locale);
124         return defaultVal;
125     }
126     
127     public boolean getMultiLanguage()
128     {
129         return multiLanguage;
130     }
131     
132     public void setLabel(Hashtable h)
133     {
134         label=h;
135     }
136     
137     public String JavaDoc getLabel(String JavaDoc locale)
138     {
139         return (String JavaDoc)label.get(locale);
140     }
141     
142     public void setName(String JavaDoc n)
143     {
144         name=n;
145     }
146     
147     public String JavaDoc getName()
148     {
149         return name;
150     }
151     
152     public void setWysiwyg(boolean b)
153     {
154         wysiwyg=b;
155     }
156     
157     public boolean getWysiwyg()
158     {
159         return wysiwyg;
160     }
161     
162     public void setEmpty(boolean b)
163     {
164         empty=b;
165     }
166     
167     public boolean getEmpty()
168     {
169         return empty;
170     }
171     
172 }//end class
173

174     
175     
176
Popular Tags