From: gmungoc Date: Fri, 30 Sep 2016 08:08:17 +0000 (+0100) Subject: JAL-2236 fixes for desktop and applet implementation of 'append seqname' X-Git-Tag: Release_2_10_0~23^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=5873fba98bc2a645aaebef32da0cb7dddb9d9de5;p=jalview.git JAL-2236 fixes for desktop and applet implementation of 'append seqname' --- diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index 5a9cd55..79d2f1f 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -20,6 +20,7 @@ */ package jalview.appletgui; +import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.SequenceGroup; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.ColourSchemeI; @@ -96,7 +97,8 @@ public class AnnotationColourChooser extends Panel implements slider.addAdjustmentListener(this); slider.addMouseListener(this); - if (av.getAlignment().getAlignmentAnnotation() == null) + AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); + if (anns == null) { return; } @@ -117,11 +119,15 @@ public class AnnotationColourChooser extends Panel implements // seqAssociated.setState(acg.isSeqAssociated()); } - Vector list = new Vector(); + Vector list = new Vector(); int index = 1; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + for (int i = 0; i < anns.length; i++) { - String label = av.getAlignment().getAlignmentAnnotation()[i].label; + String label = anns[i].label; + if (anns[i].sequenceRef != null) + { + label = label + "_" + anns[i].sequenceRef.getName(); + } if (!list.contains(label)) { list.addElement(label); @@ -309,6 +315,7 @@ public class AnnotationColourChooser extends Panel implements Checkbox thresholdIsMin = new Checkbox(); + @Override public void actionPerformed(ActionEvent evt) { if (evt.getSource() == thresholdValue) @@ -351,6 +358,7 @@ public class AnnotationColourChooser extends Panel implements } } + @Override public void itemStateChanged(ItemEvent evt) { if (evt.getSource() == currentColours) @@ -368,6 +376,7 @@ public class AnnotationColourChooser extends Panel implements changeColour(); } + @Override public void adjustmentValueChanged(AdjustmentEvent evt) { if (!adjusting) @@ -552,23 +561,28 @@ public class AnnotationColourChooser extends Panel implements } + @Override public void mouseClicked(MouseEvent evt) { } + @Override public void mousePressed(MouseEvent evt) { } + @Override public void mouseReleased(MouseEvent evt) { ap.paintAlignment(true); } + @Override public void mouseEntered(MouseEvent evt) { } + @Override public void mouseExited(MouseEvent evt) { } diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java index e3def25..a8dff62 100644 --- a/src/jalview/appletgui/AnnotationColumnChooser.java +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -135,17 +135,22 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.addAdjustmentListener(this); slider.addMouseListener(this); - if (av.getAlignment().getAlignmentAnnotation() == null) + AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); + if (anns == null) { return; } setOldColumnSelection(av.getColumnSelection()); adjusting = true; - Vector list = new Vector(); + Vector list = new Vector(); int index = 1; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) + for (int i = 0; i < anns.length; i++) { - String label = av.getAlignment().getAlignmentAnnotation()[i].label; + String label = anns[i].label; + if (anns[i].sequenceRef != null) + { + label = label + "_" + anns[i].sequenceRef.getName(); + } if (!list.contains(label)) { list.addElement(label); @@ -273,6 +278,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements this.validate(); } + @Override @SuppressWarnings("unchecked") public void reset() { @@ -302,6 +308,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } + @Override public void adjustmentValueChanged(AdjustmentEvent evt) { if (!adjusting) @@ -343,6 +350,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements }); } + @Override public void valueChanged(boolean updateAllAnnotation) { if (slider.isEnabled()) @@ -866,6 +874,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } } + @Override public void actionPerformed(ActionEvent evt) { if (evt.getSource() == thresholdValue) diff --git a/src/jalview/appletgui/AnnotationRowFilter.java b/src/jalview/appletgui/AnnotationRowFilter.java index cd00fcf..8d67d71 100644 --- a/src/jalview/appletgui/AnnotationRowFilter.java +++ b/src/jalview/appletgui/AnnotationRowFilter.java @@ -85,55 +85,6 @@ public abstract class AnnotationRowFilter extends Panel } - public Vector getAnnotationItems(boolean isSeqAssociated) - { - Vector list = new Vector(); - int index = 1; - int[] anmap = new int[av.getAlignment().getAlignmentAnnotation().length]; - for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) - { - if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef == null) - { - if (isSeqAssociated) - { - continue; - } - } - else - { - enableSeqAss = true; - } - String label = av.getAlignment().getAlignmentAnnotation()[i].label; - // add associated sequence ID if available - if (!isSeqAssociated - && av.getAlignment().getAlignmentAnnotation()[i].sequenceRef != null) - { - label = label - + "_" - + av.getAlignment().getAlignmentAnnotation()[i].sequenceRef - .getName(); - } - // make label unique - if (!list.contains(label)) - { - anmap[list.size()] = i; - list.add(label); - - } - else - { - if (!isSeqAssociated) - { - anmap[list.size()] = i; - list.add(label + "_" + (index++)); - } - } - } - this.annmap = new int[list.size()]; - System.arraycopy(anmap, 0, this.annmap, 0, this.annmap.length); - return list; - } - protected int getSelectedThresholdItem(int indexValue) { int selectedThresholdItem = -1; diff --git a/src/jalview/gui/AnnotationRowFilter.java b/src/jalview/gui/AnnotationRowFilter.java index 0a5e96c..8335042 100644 --- a/src/jalview/gui/AnnotationRowFilter.java +++ b/src/jalview/gui/AnnotationRowFilter.java @@ -162,8 +162,7 @@ public abstract class AnnotationRowFilter extends JPanel } String label = av.getAlignment().getAlignmentAnnotation()[i].label; // add associated sequence ID if available - if (!isSeqAssociated - && av.getAlignment().getAlignmentAnnotation()[i].sequenceRef != null) + if (av.getAlignment().getAlignmentAnnotation()[i].sequenceRef != null) { label = label + "_" @@ -175,7 +174,6 @@ public abstract class AnnotationRowFilter extends JPanel { anmap[list.size()] = i; list.add(label); - } else {