001: /*
002:
003: This software is OSI Certified Open Source Software.
004: OSI Certified is a certification mark of the Open Source Initiative.
005:
006: The license (Mozilla version 1.0) can be read at the MMBase site.
007: See http://www.MMBase.org/license
008:
009: */
010:
011: package org.mmbase.bridge.util;
012:
013: import java.util.Locale;
014: import java.util.Collection;
015: import org.mmbase.util.LocalizedString;
016: import org.mmbase.bridge.*;
017: import org.mmbase.datatypes.DataType;
018:
019: /**
020: * Wraps another Field. You can use this if you want to implement Field, and want to base that
021: * implementation on a existing <code>Field</code> instance.
022: *
023: * @author Michiel Meeuwissen
024: * @version $Id: FieldWrapper.java,v 1.4 2008/02/03 17:33:56 nklasens Exp $
025: * @since MMBase-1.8.1
026: */
027:
028: public abstract class FieldWrapper implements Field {
029: protected final Field field;
030:
031: public FieldWrapper(Field field) {
032: this .field = field;
033: }
034:
035: public abstract NodeManager getNodeManager();
036:
037: public int getState() {
038: return Field.STATE_VIRTUAL;
039: }
040:
041: public DataType<Object> getDataType() {
042: return field.getDataType();
043: }
044:
045: public boolean isUnique() {
046: return field.isUnique();
047: }
048:
049: public boolean hasIndex() {
050: return field.hasIndex();
051: }
052:
053: public int getType() {
054: return field.getType();
055: }
056:
057: public int getListItemType() {
058: return field.getListItemType();
059: }
060:
061: public int getSearchPosition() {
062: return field.getSearchPosition();
063: }
064:
065: public int getListPosition() {
066: return field.getListPosition();
067: }
068:
069: public int getEditPosition() {
070: return field.getEditPosition();
071: }
072:
073: public int getStoragePosition() {
074: return field.getStoragePosition();
075: }
076:
077: public String getGUIType() {
078: return field.getGUIType();
079: }
080:
081: public boolean isRequired() {
082: return field.isRequired();
083: }
084:
085: public int getMaxLength() {
086: return field.getMaxLength();
087: }
088:
089: public Collection validate(Object value) {
090: return field.validate(value);
091: }
092:
093: public boolean isVirtual() {
094: return true;
095: }
096:
097: public boolean isReadOnly() {
098: return true;
099: }
100:
101: public String getName() {
102: return field.getName();
103: }
104:
105: public String getGUIName() {
106: return field.getGUIName();
107: }
108:
109: public String getGUIName(Locale locale) {
110: return field.getGUIName(locale);
111: }
112:
113: public LocalizedString getLocalizedGUIName() {
114: return field.getLocalizedGUIName();
115: }
116:
117: public void setGUIName(String g, Locale locale) {
118: throw new UnsupportedOperationException();
119: }
120:
121: public void setGUIName(String g) {
122: throw new UnsupportedOperationException();
123: }
124:
125: public LocalizedString getLocalizedDescription() {
126: return field.getLocalizedDescription();
127: }
128:
129: public String getDescription(Locale locale) {
130: return field.getDescription(locale);
131: }
132:
133: public String getDescription() {
134: return field.getDescription();
135: }
136:
137: public void setDescription(String description, Locale locale) {
138: throw new UnsupportedOperationException();
139: }
140:
141: public void setDescription(String description) {
142: throw new UnsupportedOperationException();
143: }
144:
145: public Field getField() {
146: return field;
147: }
148: }
|