From: amwaterhouse Date: Fri, 27 Apr 2007 09:54:58 +0000 (+0000) Subject: ThresholdIsMin available in applet X-Git-Tag: Release_2_3~142 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=136cfe6c2bede95a91ee16bd4093e71848a97be5;p=jalview.git ThresholdIsMin available in applet --- diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index 430bf65..2853b6b 100755 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -25,6 +25,7 @@ import java.awt.event.*; import jalview.datamodel.*; import jalview.schemes.*; +import java.awt.Rectangle; public class AnnotationColourChooser extends Panel implements ActionListener, @@ -83,12 +84,21 @@ public class AnnotationColourChooser } adjusting = true; + + Vector list = new Vector(); + int index = 1; for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++) { - if (av.alignment.getAlignmentAnnotation()[i].graph > 0) - { - annotations.addItem(av.alignment.getAlignmentAnnotation()[i].label); - } + String label = av.alignment.getAlignmentAnnotation()[i].label; + if (!list.contains(label)) + list.addElement(label); + else + list.addElement(label+"_"+(index++)); + } + + for (int i = 0; i < list.size(); i++) + { + annotations.addItem(list.elementAt(i).toString()); } threshold.addItem("No Threshold"); @@ -128,6 +138,7 @@ public class AnnotationColourChooser maxColour.setLabel("Max Colour"); maxColour.addActionListener(this); + thresholdIsMin.addItemListener(this); ok.setLabel("OK"); ok.addActionListener(this); @@ -146,16 +157,19 @@ public class AnnotationColourChooser slider.setBackground(Color.white); slider.setEnabled(false); - slider.setBounds(new Rectangle(172, 7, 120, 16)); + slider.setBounds(new Rectangle(125, 6, 82, 16)); thresholdValue.setEnabled(false); - thresholdValue.setBounds(new Rectangle(295, 4, 83, 22)); - thresholdValue.setColumns(10); + thresholdValue.setBounds(new Rectangle(211, 4, 56, 22)); + thresholdValue.setColumns(5); jPanel3.setBackground(Color.white); currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); currentColours.setLabel("Use Original Colours"); currentColours.addItemListener(this); - threshold.setBounds(new Rectangle(19, 4, 141, 22)); + threshold.setBounds(new Rectangle(11, 3, 113, 22)); + thresholdIsMin.setBackground(Color.white); + thresholdIsMin.setLabel("Threshold is min/max"); + thresholdIsMin.setBounds(new Rectangle(270, 3, 135, 23)); jPanel1.add(ok); jPanel1.add(cancel); jPanel2.add(annotations); @@ -165,6 +179,7 @@ public class AnnotationColourChooser jPanel3.add(threshold); jPanel3.add(slider); jPanel3.add(thresholdValue); + jPanel3.add(thresholdIsMin); this.add(jPanel2, java.awt.BorderLayout.NORTH); this.add(jPanel3, java.awt.BorderLayout.CENTER); this.add(jPanel1, java.awt.BorderLayout.SOUTH); @@ -184,6 +199,7 @@ public class AnnotationColourChooser TextField thresholdValue = new TextField(20); Checkbox currentColours = new Checkbox(); BorderLayout borderLayout1 = new BorderLayout(); + Checkbox thresholdIsMin = new Checkbox(); public void actionPerformed(ActionEvent evt) { @@ -297,27 +313,9 @@ public class AnnotationColourChooser return; } - // We removed the non-graph annotations when filling the combobox - // so allow for them again here - int nograph = 0, graph = -1; - for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++) - { - if (av.alignment.getAlignmentAnnotation()[i].graph == 0) - { - nograph++; - } - else - { - graph++; - } - - if (graph == annotations.getSelectedIndex()) - { - break; - } - } - currentAnnotation = av.alignment.getAlignmentAnnotation()[graph + nograph]; + currentAnnotation = av.alignment.getAlignmentAnnotation() + [annotations.getSelectedIndex()]; int aboveThreshold = -1; if (threshold.getSelectedItem().equals("Above Threshold")) @@ -378,6 +376,13 @@ public class AnnotationColourChooser aboveThreshold); } + if (currentAnnotation.graphMin == 0f && currentAnnotation.graphMax == 0f) + { + acg.predefinedColours = true; + } + + acg.thresholdIsMinMax = thresholdIsMin.getState(); + av.setGlobalColourScheme(acg); if (av.alignment.getGroups() != null)