JAL-2808 JAL-2069 record feature attributes descriptions and min-max
[jalview.git] / src / jalview / datamodel / SequenceFeature.java
index ffbd497..2110632 100755 (executable)
@@ -442,10 +442,31 @@ public class SequenceFeature implements FeatureLocationI
       }
 
       otherDetails.put(key, value);
-      FeatureAttributes.getInstance().addAttribute(this.type, key);
+      recordAttribute(key, value);
     }
   }
 
+  /**
+   * Notifies the addition of a feature attribute. This lets us keep track of
+   * which attributes are present on each feature type, and also the range of
+   * numerical-valued attributes.
+   * 
+   * @param key
+   * @param value
+   */
+  protected void recordAttribute(String key, Object value)
+  {
+    String attDesc = null;
+    if (source != null)
+    {
+      attDesc = FeatureSources.getInstance().getSource(source)
+              .getAttributeName(key);
+    }
+
+    FeatureAttributes.getInstance().addAttribute(this.type, key, attDesc,
+            value.toString());
+  }
+
   /*
    * The following methods are added to maintain the castor Uniprot mapping file
    * for the moment.