From 0807c11f57a68ab740e9f33a29ec66280065991e Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 3 Feb 2006 17:42:19 +0000 Subject: [PATCH] Allow for non graph annotations in combobox --- src/jalview/gui/AnnotationColourChooser.java | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 71582e5..c3e30fb 100755 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -42,7 +42,7 @@ public class AnnotationColourChooser frame = new JInternalFrame(); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); - Desktop.addInternalFrame(frame, "Colour by Annotation", 470, 110, false); + Desktop.addInternalFrame(frame, "Colour by Annotation", 480, 110, false); try{ jbInit(); @@ -65,7 +65,8 @@ public class AnnotationColourChooser for (int i = 0; i < av.alignment.getAlignmentAnnotation().length; i++) { - annotations.addItem(av.alignment.getAlignmentAnnotation()[i].label); + if(av.alignment.getAlignmentAnnotation()[i].graph>0) + annotations.addItem(av.alignment.getAlignmentAnnotation()[i].label); } } @@ -106,11 +107,12 @@ public class AnnotationColourChooser maxColour_actionPerformed(e); } }); + thresholdCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); thresholdCheck.setOpaque(false); thresholdCheck.setHorizontalTextPosition(SwingConstants.LEADING); thresholdCheck.setSelectedIcon(null); thresholdCheck.setText("Above Threshold"); - thresholdCheck.setBounds(new Rectangle(329, 6, 109, 23)); + thresholdCheck.setBounds(new Rectangle(329, 6, 126, 23)); thresholdCheck.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -193,7 +195,22 @@ public class AnnotationColourChooser void changeColour() { - jalview.datamodel.AlignmentAnnotation aa = av.alignment.getAlignmentAnnotation()[annotations.getSelectedIndex()]; + // 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; + } + + jalview.datamodel.AlignmentAnnotation aa + = av.alignment.getAlignmentAnnotation()[graph+nograph]; AnnotationColourGradient acg = new AnnotationColourGradient(aa, minColour.getBackground(), -- 1.7.10.2