JAL-2808 JAL-2069 FeatureTypeSettings (with new Filters tab) replaces FeatureColourCh...
[jalview.git] / src / jalview / viewmodel / seqfeatures / FeatureRendererModel.java
index 6afec67..4797675 100644 (file)
@@ -49,6 +49,17 @@ import java.util.concurrent.ConcurrentHashMap;
 public abstract class FeatureRendererModel
         implements jalview.api.FeatureRenderer
 {
+  /*
+   * column indices of fields in Feature Settings table
+   * todo: transfer valuers as data beans instead of Object[][]
+   */
+  public static final int TYPE_COLUMN = 0;
+
+  public static final int COLOUR_COLUMN = 1;
+
+  public static final int FILTER_COLUMN = 2;
+
+  public static final int SHOW_COLUMN = 3;
 
   /*
    * global transparency for feature
@@ -720,9 +731,9 @@ public abstract class FeatureRendererModel
     {
       for (int i = 0; i < data.length; i++)
       {
-        String type = data[i][0].toString();
-        setColour(type, (FeatureColourI) data[i][1]);
-        if (((Boolean) data[i][2]).booleanValue())
+        String type = data[i][TYPE_COLUMN].toString();
+        setColour(type, (FeatureColourI) data[i][COLOUR_COLUMN]);
+        if (((Boolean) data[i][SHOW_COLUMN]).booleanValue())
         {
           av_featuresdisplayed.setVisible(type);
         }
@@ -1124,8 +1135,13 @@ public abstract class FeatureRendererModel
   protected boolean featureMatchesFilters(SequenceFeature sf)
   {
     KeyedMatcherSetI filter = featureFilters.get(sf.getType());
-    return filter == null ? true : filter.matches(key -> sf
-            .getValueAsString(key));
+    // TODO temporary fudge for Score and Label
+    return filter == null ? true
+            : filter.matches(
+                    key -> "Label".equals(key[0]) ? sf.getDescription()
+                            : ("Score".equals(key[0])
+                                    ? String.valueOf(sf.getScore())
+                                    : sf.getValueAsString(key)));
   }
 
 }