Allow for non graph annotations in combobox
authoramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:42:19 +0000 (17:42 +0000)
committeramwaterhouse <Andrew Waterhouse>
Fri, 3 Feb 2006 17:42:19 +0000 (17:42 +0000)
src/jalview/gui/AnnotationColourChooser.java

index 71582e5..c3e30fb 100755 (executable)
@@ -42,7 +42,7 @@ public class AnnotationColourChooser
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
     frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
-    Desktop.addInternalFrame(frame, "Colour by Annotation", 470, 110, false);\r
+    Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 110, false);\r
 \r
     try{\r
       jbInit();\r
@@ -65,7 +65,8 @@ public class AnnotationColourChooser
 \r
     for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)\r
     {\r
-      annotations.addItem(av.alignment.getAlignmentAnnotation()[i].label);\r
+      if(av.alignment.getAlignmentAnnotation()[i].graph>0)\r
+        annotations.addItem(av.alignment.getAlignmentAnnotation()[i].label);\r
     }\r
 \r
   }\r
@@ -106,11 +107,12 @@ public class AnnotationColourChooser
         maxColour_actionPerformed(e);\r
       }\r
     });\r
+    thresholdCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
     thresholdCheck.setOpaque(false);\r
     thresholdCheck.setHorizontalTextPosition(SwingConstants.LEADING);\r
     thresholdCheck.setSelectedIcon(null);\r
     thresholdCheck.setText("Above Threshold");\r
-    thresholdCheck.setBounds(new Rectangle(329, 6, 109, 23));\r
+    thresholdCheck.setBounds(new Rectangle(329, 6, 126, 23));\r
     thresholdCheck.addActionListener(new ActionListener()\r
     {\r
       public void actionPerformed(ActionEvent e)\r
@@ -193,7 +195,22 @@ public class AnnotationColourChooser
 \r
   void changeColour()\r
   {\r
-    jalview.datamodel.AlignmentAnnotation aa = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()];\r
+    // We removed the non-graph annotations when filling the combobox\r
+    // so allow for them again here\r
+    int nograph = 0, graph = -1;\r
+    for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++)\r
+    {\r
+      if (av.alignment.getAlignmentAnnotation()[i].graph == 0)\r
+        nograph ++;\r
+      else\r
+        graph ++;\r
+\r
+      if(graph==annotations.getSelectedIndex())\r
+        break;\r
+    }\r
+\r
+    jalview.datamodel.AlignmentAnnotation aa\r
+        = av.alignment.getAlignmentAnnotation()[graph+nograph];\r
 \r
     AnnotationColourGradient acg = new AnnotationColourGradient(aa,\r
      minColour.getBackground(),\r