Changeset 5546 for branches/OmeroEditor/src/fields/AbstractParam.java
- Timestamp:
- 07/23/08 15:32:07 (4 months ago)
- Files:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/OmeroEditor/src/fields/AbstractParam.java
r5543 r5546 23 23 package fields; 24 24 25 import java.util.HashMap;26 27 import tree.DataFieldConstants;28 25 29 26 //Java imports 27 import java.util.HashMap; 30 28 31 29 //Third-party libraries … … 33 31 //Application-internal dependencies 34 32 33 import tree.DataFieldConstants; 34 35 35 36 /** 36 * 37 * An abstract example 37 38 * 38 39 * @author William Moore … … 44 45 * @since OME3.0 45 46 */ 46 public abstract class Abstract ValueObject47 public abstract class AbstractParam 47 48 implements 48 I FieldValue{49 IParam { 49 50 50 private String fieldType; 51 public static final String PARAM_TYPE = "paramType"; 52 53 public static final String PARAM_NAME = "paramName"; 54 51 55 52 56 private HashMap<String, String> valueAttributesMap; 53 57 54 58 55 public AbstractValueObject(String fieldType) { 56 this.fieldType = fieldType; 59 public AbstractParam(String fieldType) { 57 60 valueAttributesMap = new HashMap<String, String>(); 61 valueAttributesMap.put(PARAM_TYPE, fieldType); 58 62 } 59 63 64 /** 65 * This method returns a list of the names of attributes. 66 * These attributes represent the experimental "value" of this 67 * parameter (rather than other attributes such as name or default 68 * values that represent the "template" part of the parameter. 69 * This method is used for eg. clearing the value of a parameter by 70 * setting all value attributes to null. 71 */ 60 72 public abstract String[] getValueAttributes(); 61 73 62 public abstract boolean isFieldFilled();63 64 74 /** 65 * A convenience method to test whether the attribute is included in 66 * the list of value attributes. 75 * Unless specified by subclasses, parameter has no default values. 76 * If a list of default values is given, these should be given in the 77 * same order as the value attributes to which they apply 67 78 * 68 * @param attributeName The name of the attribute to test. 69 * @return True if the attribute is a value attribute. 79 * @see getValueAttributes(); 70 80 */ 71 public boolean isValueAttribute(String attributeName) { 72 73 if (attributeName == null) return false; 74 75 String[] attributes = getValueAttributes(); 76 for (int i=0; i<attributes.length; i++) { 77 if (attributeName.equals(attributes[i])) 78 return true; 79 } 80 return false; 81 public String[] getDefaultAttributes() { 82 return new String[] {}; 81 83 } 82 84 85 public abstract boolean isParamFilled(); 86 87 88 83 89 public String getFieldType() { 84 return fieldType;90 return getAttribute(PARAM_TYPE); 85 91 } 86 92
