KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > bridge > implementation > BasicField


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10
11 package org.mmbase.bridge.implementation;
12
13 import org.mmbase.bridge.*;
14 import org.mmbase.core.AbstractField;
15 import org.mmbase.core.CoreField;
16 import org.mmbase.util.LocalizedString;
17 import java.util.Collection JavaDoc;
18
19 /**
20  * @javadoc
21  *
22  * @author Pierre van Rooden
23  * @version $Id: BasicField.java,v 1.31 2006/07/11 09:30:26 michiel Exp $
24  */

25 public class BasicField extends AbstractField implements Field {
26
27     private final NodeManager nodeManager;
28     protected final CoreField coreField;
29
30     public BasicField(Field field, NodeManager nodeManager) {
31         super(field.getName(), field);
32         this.nodeManager = nodeManager;
33         if (field instanceof CoreField) {
34             this.coreField = (CoreField) field;
35         } else {
36             this.coreField = new CoreField(field);
37         }
38     }
39
40     public NodeManager getNodeManager() {
41         return nodeManager;
42     }
43
44     public int getSearchPosition(){
45         return coreField.getSearchPosition();
46     }
47
48     public int getListPosition(){
49         return coreField.getListPosition();
50     }
51
52     public int getEditPosition(){
53         return coreField.getEditPosition();
54     }
55
56     public int getStoragePosition(){
57         return coreField.getStoragePosition();
58     }
59
60     public Collection JavaDoc validate(Object JavaDoc value) {
61         Collection JavaDoc errors = getDataType().validate(value, null, this);
62         return LocalizedString.toStrings(errors, getNodeManager().getCloud().getLocale());
63     }
64
65     public int getMaxLength() {
66         return coreField.getMaxLength();
67     }
68
69
70     protected java.util.Locale JavaDoc getDefaultLocale() {
71         return nodeManager.getCloud().getLocale();
72     }
73
74     // deprecated methods
75
public String JavaDoc getGUIType() {
76         return coreField.getGUIType();
77     }
78
79 }
80
Popular Tags