X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationColumnChooser.java;h=a8dff62e59045a0abb18408d4bda11ac2d0709c3;hb=c355d0f7a994d0d064078d363e612eb8c89581f1;hp=496d4a4619a5f08b4e53b8b2db8a641ce5301454;hpb=1d4b37e9bd54c095aa00e643b741c931eb61c58b;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationColumnChooser.java b/src/jalview/appletgui/AnnotationColumnChooser.java index 496d4a4..a8dff62 100644 --- a/src/jalview/appletgui/AnnotationColumnChooser.java +++ b/src/jalview/appletgui/AnnotationColumnChooser.java @@ -1,8 +1,27 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.appletgui; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.ColumnSelection; -import jalview.gui.JvSwingUtils; import jalview.schemes.AnnotationColourGradient; import jalview.util.MessageManager; import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; @@ -30,7 +49,9 @@ import java.awt.event.TextListener; import java.util.Iterator; import java.util.Vector; -import net.miginfocom.swing.MigLayout; +//import javax.swing.JPanel; + +//import net.miginfocom.swing.MigLayout; public class AnnotationColumnChooser extends AnnotationRowFilter implements ActionListener, AdjustmentListener, ItemListener, MouseListener @@ -55,6 +76,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements private BorderLayout borderLayout1 = new BorderLayout(); + private BorderLayout gBorderLayout = new BorderLayout(); + + private BorderLayout ngBorderLayout = new BorderLayout(); + private Choice threshold = new Choice(); private StructureFilterPanel gStructureFilterPanel; @@ -110,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); @@ -186,20 +216,20 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setPreferredSize(new Dimension(100, 32)); thresholdPanel.setBackground(Color.white); - thresholdPanel.setFont(JvSwingUtils.getLabelFont()); - thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); + // thresholdPanel.setFont(JvSwingUtils.getLabelFont()); + // thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); actionPanel.setBackground(Color.white); - actionPanel.setFont(JvSwingUtils.getLabelFont()); + // actionPanel.setFont(JvSwingUtils.getLabelFont()); - graphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); + graphFilterView.setLayout(gBorderLayout); graphFilterView.setBackground(Color.white); - noGraphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); + noGraphFilterView.setLayout(ngBorderLayout); noGraphFilterView.setBackground(Color.white); annotationComboBoxPanel.setBackground(Color.white); - annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont()); + // annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont()); gSearchPanel = new SearchPanel(this); ngSearchPanel = new SearchPanel(this); @@ -209,21 +239,29 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements ngStructureFilterPanel = new StructureFilterPanel(this); thresholdPanel.setTitle("Threshold Filter"); - thresholdPanel.add(getThreshold(), "grow"); - thresholdPanel.add(thresholdValue, "grow, wrap"); - thresholdPanel.add(slider, "grow, span, wrap"); + thresholdPanel.add(getThreshold()); + thresholdPanel.add(slider); + thresholdPanel.add(thresholdValue); actionPanel.add(ok); actionPanel.add(cancel); - graphFilterView.add(gSearchPanel, "grow, span, wrap"); - graphFilterView.add(gStructureFilterPanel, "grow, span, wrap"); - graphFilterView.add(thresholdPanel, "grow, span, wrap"); - graphFilterView.add(gFurtherActionPanel); + Panel staticPanel = new Panel(); + staticPanel.setLayout(new BorderLayout()); + staticPanel.setBackground(Color.white); + + staticPanel.add(gSearchPanel, java.awt.BorderLayout.NORTH); + staticPanel.add(gStructureFilterPanel, java.awt.BorderLayout.SOUTH); + + graphFilterView.add(staticPanel, java.awt.BorderLayout.NORTH); + graphFilterView.add(thresholdPanel, java.awt.BorderLayout.CENTER); + graphFilterView.add(gFurtherActionPanel, java.awt.BorderLayout.SOUTH); - noGraphFilterView.add(ngSearchPanel, "grow, span, wrap"); - noGraphFilterView.add(ngStructureFilterPanel, "grow, span, wrap"); - noGraphFilterView.add(ngFurtherActionPanel); + noGraphFilterView.add(ngSearchPanel, java.awt.BorderLayout.PAGE_START); + noGraphFilterView.add(ngStructureFilterPanel, + java.awt.BorderLayout.CENTER); + noGraphFilterView.add(ngFurtherActionPanel, + java.awt.BorderLayout.CENTER); annotationComboBoxPanel.add(getAnnotations()); switchableViewsPanel.add(noGraphFilterView, @@ -240,6 +278,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements this.validate(); } + @Override @SuppressWarnings("unchecked") public void reset() { @@ -269,6 +308,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } + @Override public void adjustmentValueChanged(AdjustmentEvent evt) { if (!adjusting) @@ -310,6 +350,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements }); } + @Override public void valueChanged(boolean updateAllAnnotation) { if (slider.isEnabled()) @@ -556,8 +597,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements updateView(); } - public class FurtherActionPanel extends Panel implements - ItemListener + public class FurtherActionPanel extends Panel implements ItemListener { private AnnotationColumnChooser aColChooser; @@ -643,7 +683,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements this.setBackground(Color.white); this.setTitle("Structure Filter"); - this.setFont(JvSwingUtils.getLabelFont()); + // this.setFont(JvSwingUtils.getLabelFont()); this.add(all); this.add(alphaHelix); @@ -770,7 +810,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements }); - displayName.setLabel(MessageManager.getString("label.display_name")); + displayName.setLabel(MessageManager.getString("label.label")); displayName.setEnabled(false); displayName.addItemListener(this); @@ -778,7 +818,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements description.setEnabled(false); description.addItemListener(this); this.setTitle("Search Filter"); - this.setFont(JvSwingUtils.getLabelFont()); + // this.setFont(JvSwingUtils.getLabelFont()); syncState(); this.add(searchBox); @@ -834,6 +874,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements } } + @Override public void actionPerformed(ActionEvent evt) { if (evt.getSource() == thresholdValue)