X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FAnnotationColumnChooser.java;h=96299e7ce9a405bac8d704cdfa89ab7fd1c76da0;hb=1499d3297cf70ff34df05362449dbf36873c5bc1;hp=fa63e0dfd1d13658be592efeb7973743f75d21e7;hpb=d1707d4c26db76cfeb640f0dbeb3e3427fd40eb7;p=jalview.git diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index fa63e0d..96299e7 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -21,7 +21,6 @@ package jalview.gui; -import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.HiddenColumns; import jalview.schemes.AnnotationColourGradient; import jalview.util.MessageManager; @@ -30,6 +29,7 @@ import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Color; +import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; @@ -88,6 +88,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements private HiddenColumns oldHiddenColumns; + protected int MIN_WIDTH = 420; + + protected int MIN_HEIGHT = 430; + public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) { super(av, ap); @@ -97,6 +101,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements Desktop.addInternalFrame(frame, MessageManager.getString("label.select_by_annotation"), 520, 215); + frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); addSliderChangeListener(); addSliderMouseListeners(); @@ -110,20 +115,23 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements setAnnotations(new JComboBox(getAnnotationItems(false))); populateThresholdComboBox(threshold); - + AnnotationColumnChooser lastChooser = av + .getAnnotationColumnSelectionState(); // restore Object state from the previous session if one exists - if (av.getAnnotationColumnSelectionState() != null) + if (lastChooser != null) { - currentSearchPanel = av.getAnnotationColumnSelectionState() + currentSearchPanel = lastChooser .getCurrentSearchPanel(); - currentStructureFilterPanel = av.getAnnotationColumnSelectionState() + currentStructureFilterPanel = lastChooser .getCurrentStructureFilterPanel(); - annotations.setSelectedIndex(av.getAnnotationColumnSelectionState() + annotations.setSelectedIndex(lastChooser .getAnnotations().getSelectedIndex()); - threshold.setSelectedIndex(av.getAnnotationColumnSelectionState() + threshold.setSelectedIndex(lastChooser .getThreshold().getSelectedIndex()); - actionOption = av.getAnnotationColumnSelectionState() + actionOption = lastChooser .getActionOption(); + percentThreshold.setSelected(lastChooser.percentThreshold + .isSelected()); } try @@ -151,6 +159,9 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements thresholdPanel.setFont(JvSwingUtils.getLabelFont()); thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]")); + percentThreshold.setBackground(Color.white); + percentThreshold.setFont(JvSwingUtils.getLabelFont()); + JPanel actionPanel = new JPanel(); actionPanel.setBackground(Color.white); actionPanel.setFont(JvSwingUtils.getLabelFont()); @@ -174,8 +185,9 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements ngStructureFilterPanel = new StructureFilterPanel(this); thresholdPanel.add(getThreshold()); - thresholdPanel.add(thresholdValue, "wrap"); - thresholdPanel.add(slider, "grow, span, wrap"); + thresholdPanel.add(percentThreshold, "wrap"); + thresholdPanel.add(slider, "grow"); + thresholdPanel.add(thresholdValue, "span, wrap"); actionPanel.add(ok); actionPanel.add(cancel); @@ -233,10 +245,10 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements HiddenColumns oldHidden = av .getAnnotationColumnSelectionState() .getOldHiddenColumns(); - if (oldHidden != null && oldHidden.getListOfCols() != null - && !oldHidden.getListOfCols().isEmpty()) + if (oldHidden != null && oldHidden.getHiddenRegions() != null + && !oldHidden.getHiddenRegions().isEmpty()) { - for (Iterator itr = oldHidden.getListOfCols() + for (Iterator itr = oldHidden.getHiddenRegions() .iterator(); itr.hasNext();) { int positions[] = itr.next(); @@ -282,12 +294,14 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setEnabled(true); thresholdValue.setEnabled(true); + percentThreshold.setEnabled(true); if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) { slider.setEnabled(false); thresholdValue.setEnabled(false); thresholdValue.setText(""); + percentThreshold.setEnabled(false); // build filter params } else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) @@ -308,7 +322,9 @@ 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); @@ -317,7 +333,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements // build filter params filterParams .setThresholdType(AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); - if (getCurrentAnnotation().graph != AlignmentAnnotation.NO_GRAPH) + if (getCurrentAnnotation().isQuantitative()) { filterParams .setThresholdValue(getCurrentAnnotation().threshold.value); @@ -477,8 +493,9 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements public void selectedAnnotationChanged() { String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW; - if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() - .getSelectedIndex()]].graph != AlignmentAnnotation.NO_GRAPH) + if (av.getAlignment() + .getAlignmentAnnotation()[annmap[getAnnotations() + .getSelectedIndex()]].isQuantitative()) { currentView = AnnotationColumnChooser.GRAPH_VIEW; }