| 1 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 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 validate(Object value) { 61 Collection 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 getDefaultLocale() { 71 return nodeManager.getCloud().getLocale(); 72 } 73 74 public String getGUIType() { 76 return coreField.getGUIType(); 77 } 78 79 } 80 | Popular Tags |