01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
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;
18:
19: /**
20: * @javadoc
21: *
22: * @author Pierre van Rooden
23: * @version $Id: BasicField.java,v 1.33 2008/02/03 17:33:57 nklasens 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: @Override
41: public NodeManager getNodeManager() {
42: return nodeManager;
43: }
44:
45: @Override
46: public int getSearchPosition() {
47: return coreField.getSearchPosition();
48: }
49:
50: @Override
51: public int getListPosition() {
52: return coreField.getListPosition();
53: }
54:
55: @Override
56: public int getEditPosition() {
57: return coreField.getEditPosition();
58: }
59:
60: @Override
61: public int getStoragePosition() {
62: return coreField.getStoragePosition();
63: }
64:
65: public Collection validate(Object value) {
66: Collection<LocalizedString> errors = getDataType().validate(
67: value, null, this );
68: return LocalizedString.toStrings(errors, getNodeManager()
69: .getCloud().getLocale());
70: }
71:
72: @Override
73: public int getMaxLength() {
74: return coreField.getMaxLength();
75: }
76:
77: @Override
78: protected java.util.Locale getDefaultLocale() {
79: return nodeManager.getCloud().getLocale();
80: }
81:
82: // deprecated methods
83: @Override
84: public String getGUIType() {
85: return coreField.getGUIType();
86: }
87:
88: }
|