X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColumnChooser.java;h=0483aa60daea3b3549b5b9c004d4ce584f0d0cd0;hb=ca160187a050f6d4e50158cd5b51f75c83a7179e;hp=699a79e5dabf395d617572615fdb069ecdfa1751;hpb=c1f5dd54ab8caa7e76ca50f9c3a85f2731b66862;p=jalview.git diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 699a79e..0483aa6 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -42,6 +42,7 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.border.TitledBorder; +import jalview.bin.Console; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.HiddenColumns; import jalview.io.cache.JvCacheableInputBox; @@ -95,6 +96,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) { + this(av,ap,null); + } + public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap, AlignmentAnnotation selectedAnnotation) + { super(av, ap); frame = new JInternalFrame(); frame.setFrameIcon(null); @@ -115,7 +120,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter } setOldHiddenColumns(av.getAlignment().getHiddenColumns()); adjusting = true; - + setAnnotations(new JComboBox<>(getAnnotationItems(false))); populateThresholdComboBox(threshold); AnnotationColumnChooser lastChooser = av @@ -134,6 +139,16 @@ public class AnnotationColumnChooser extends AnnotationRowFilter percentThreshold .setSelected(lastChooser.percentThreshold.isSelected()); } + if (selectedAnnotation!=null) + { + try { + setCurrentAnnotation(selectedAnnotation); + annotations.setSelectedItem(getAnnotationMenuLabel(selectedAnnotation)); + } catch (Exception x) + { + Console.error("Couldn't select annotation in column chooser",x); + } + } try { @@ -376,7 +391,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter // filterAnnotations, because showing hidden columns has the side effect of // adding them to the selection av.showAllHiddenColumns(); - av.getColumnSelection().filterAnnotations(currentAnnotation.annotations, + av.getColumnSelection().filterAnnotations(currentAnnotation, filterParams); boolean hideCols = getActionOption() == ACTION_OPTION_HIDE; @@ -850,4 +865,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter gSearchPanel.searchBox.updateCache(); ngSearchPanel.searchBox.updateCache(); } + + public static void displayFor(AlignViewport av, AlignmentPanel ap, + AlignmentAnnotation alignmentAnnotation) + { + AnnotationColumnChooser colchooser = new AnnotationColumnChooser(av, ap, alignmentAnnotation); + } }