X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationColumnChooser.java;h=bbd01f6f5f950a42eb881460b1c30a2cd2369e08;hb=6849cc1cb983a45b4b8fd840f5ffc7d31ca80f33;hp=1a6868212ad88e2b4621bcb98c0d49d47d55eddf;hpb=17e77c3f2949a0729322b4a8d907f3f34b6a9914;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java index 1a68682..bbd01f6 100644 --- a/src/jalview/appletgui/AnnotationColumnChooser.java +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -49,7 +49,7 @@ import java.awt.event.TextListener; import java.util.Iterator; import java.util.Vector; -import javax.swing.JPanel; +//import javax.swing.JPanel; //import net.miginfocom.swing.MigLayout; @@ -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); @@ -199,6 +204,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements thresholdValue.setEnabled(false); thresholdValue.setColumns(7); + thresholdValue.setCaretPosition(0); ok.addActionListener(this); cancel.addActionListener(this); @@ -214,6 +220,9 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements // thresholdPanel.setFont(JvSwingUtils.getLabelFont()); // thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); + percentThreshold.setLabel("As percentage"); + percentThreshold.addItemListener(this); + actionPanel.setBackground(Color.white); // actionPanel.setFont(JvSwingUtils.getLabelFont()); @@ -234,6 +243,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements ngStructureFilterPanel = new StructureFilterPanel(this); thresholdPanel.setTitle("Threshold Filter"); + thresholdPanel.add(percentThreshold); thresholdPanel.add(getThreshold()); thresholdPanel.add(slider); thresholdPanel.add(thresholdValue); @@ -241,7 +251,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements actionPanel.add(ok); actionPanel.add(cancel); - JPanel staticPanel = new JPanel(); + Panel staticPanel = new Panel(); staticPanel.setLayout(new BorderLayout()); staticPanel.setBackground(Color.white); @@ -273,6 +283,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements this.validate(); } + @Override @SuppressWarnings("unchecked") public void reset() { @@ -302,6 +313,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } + @Override public void adjustmentValueChanged(AdjustmentEvent evt) { if (!adjusting) @@ -343,6 +355,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements }); } + @Override public void valueChanged(boolean updateAllAnnotation) { if (slider.isEnabled()) @@ -417,7 +430,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000)); slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); - thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); + setThresholdValueText(); // slider.setMajorTickSpacing((int) (range / 10f)); slider.setEnabled(true); thresholdValue.setEnabled(true); @@ -566,6 +579,14 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { threshold_actionPerformed(null); } + else if (e.getSource() == percentThreshold) + { + if (!adjusting) + { + percentageValue_actionPerformed(); + } + + } } public void selectedAnnotationChanged() @@ -866,6 +887,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } } + @Override public void actionPerformed(ActionEvent evt) { if (evt.getSource() == thresholdValue)