From 085a3b6d348e6bd8fdff75d9e33d832fa709cf49 Mon Sep 17 00:00:00 2001
From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04>
Date: Tue, 27 Feb 2007 15:50:39 +0000
Subject: [PATCH] set correct min/max scores

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@5537 ee4ac58c-ac51-4696-9907-e4b3aa274f04
---
 .../artemis/components/FeaturePopup.java      | 27 ++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/uk/ac/sanger/artemis/components/FeaturePopup.java b/uk/ac/sanger/artemis/components/FeaturePopup.java
index a5dc02722..5697a17f0 100644
--- a/uk/ac/sanger/artemis/components/FeaturePopup.java
+++ b/uk/ac/sanger/artemis/components/FeaturePopup.java
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  *
- * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/FeaturePopup.java,v 1.16 2007-02-21 10:54:29 tjc Exp $
+ * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/FeaturePopup.java,v 1.17 2007-02-27 15:50:39 tjc Exp $
  */
 
 package uk.ac.sanger.artemis.components;
@@ -38,7 +38,7 @@ import javax.swing.*;
  *  FeaturePopup class
  *
  *  @author Kim Rutherford
- *  @version $Id: FeaturePopup.java,v 1.16 2007-02-21 10:54:29 tjc Exp $
+ *  @version $Id: FeaturePopup.java,v 1.17 2007-02-27 15:50:39 tjc Exp $
  *
  **/
 
@@ -94,6 +94,8 @@ public class FeaturePopup extends JPopupMenu
   private FeatureSegmentVector selection_segments;
   private BasePlotGroup base_plot_group = null;
   private JMenuItem feature_display_menus[] = null;
+  private int SCORE_MINIMUM = Integer.MAX_VALUE;
+  private int SCORE_MAXIMUM = Integer.MIN_VALUE;
 
   /**
    *  Create a new FeaturePopup object.
@@ -457,10 +459,29 @@ public class FeaturePopup extends JPopupMenu
             }
           };
 
+        FeatureVector features = getEntryGroup().getAllFeatures();
+        int score;
+        for(int i=0; i<features.size(); i++)
+        {
+          score = features.elementAt(i).getScore();
+          if(score > -1)
+          {
+            if(score < SCORE_MINIMUM)
+              SCORE_MINIMUM = score;
+            else if(score > SCORE_MAXIMUM)
+              SCORE_MAXIMUM = score;
+          }
+        }
+        
+        if(SCORE_MINIMUM == Integer.MAX_VALUE)
+          SCORE_MINIMUM = 0;
+        if(SCORE_MAXIMUM == Integer.MIN_VALUE)
+          SCORE_MAXIMUM = 100;
+        
         final ScoreChanger score_changer =
           new ScoreChanger("Score Cutoffs",
                             minimum_listener, maximum_listener,
-                            0, 100);
+                            SCORE_MINIMUM, SCORE_MAXIMUM);
 
         score_changer.setVisible(true);
       }
-- 
GitLab