X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAnnotationColumnChooser.java;h=96299e7ce9a405bac8d704cdfa89ab7fd1c76da0;hb=1499d3297cf70ff34df05362449dbf36873c5bc1;hp=1efc5699440c23773ca42d8915a65cfc7c77f5fe;hpb=3ba37699f5f799d357e0cb6f041f32fc490b6eda;p=jalview.git diff --git a/src/jalview/gui/AnnotationColumnChooser.java b/src/jalview/gui/AnnotationColumnChooser.java index 1efc569..96299e7 100644 --- a/src/jalview/gui/AnnotationColumnChooser.java +++ b/src/jalview/gui/AnnotationColumnChooser.java @@ -21,7 +21,7 @@ package jalview.gui; -import jalview.datamodel.ColumnSelection; +import jalview.datamodel.HiddenColumns; import jalview.schemes.AnnotationColourGradient; import jalview.util.MessageManager; import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; @@ -29,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; @@ -85,7 +86,11 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements private int actionOption = ACTION_OPTION_SELECT; - private ColumnSelection oldColumnSelection; + private HiddenColumns oldHiddenColumns; + + protected int MIN_WIDTH = 420; + + protected int MIN_HEIGHT = 430; public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap) { @@ -96,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(); @@ -104,25 +110,28 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements { return; } - setOldColumnSelection(av.getColumnSelection()); + setOldHiddenColumns(av.getAlignment().getHiddenColumns()); adjusting = true; 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 @@ -227,26 +236,26 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements @Override protected void reset() { - if (this.getOldColumnSelection() != null) + if (this.getOldHiddenColumns() != null) { av.getColumnSelection().clear(); if (av.getAnnotationColumnSelectionState() != null) { - ColumnSelection oldSelection = av + HiddenColumns oldHidden = av .getAnnotationColumnSelectionState() - .getOldColumnSelection(); - if (oldSelection != null && oldSelection.getHiddenColumns() != null - && !oldSelection.getHiddenColumns().isEmpty()) + .getOldHiddenColumns(); + if (oldHidden != null && oldHidden.getHiddenRegions() != null + && !oldHidden.getHiddenRegions().isEmpty()) { - for (Iterator itr = oldSelection.getHiddenColumns() + for (Iterator itr = oldHidden.getHiddenRegions() .iterator(); itr.hasNext();) { int positions[] = itr.next(); av.hideColumns(positions[0], positions[1]); } } - av.setColumnSelection(oldSelection); + av.getAlignment().setHiddenColumns(oldHidden); } ap.paintAlignment(true); } @@ -314,16 +323,7 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000)); slider.setValue((int) (getCurrentAnnotation().threshold.value * 1000)); - if (percentThreshold.isSelected()) - { - thresholdValue - .setText("" - + ((getCurrentAnnotation().threshold.value - getCurrentAnnotation().graphMin) * 100f / (getCurrentAnnotation().graphMax - getCurrentAnnotation().graphMin))); - } - else - { - thresholdValue.setText(getCurrentAnnotation().threshold.value + ""); - } + setThresholdValueText(); slider.setMajorTickSpacing((int) (range / 10f)); slider.setEnabled(true); @@ -408,17 +408,16 @@ public class AnnotationColumnChooser extends AnnotationRowFilter implements ap.paintAlignment(true); } - - public ColumnSelection getOldColumnSelection() + public HiddenColumns getOldHiddenColumns() { - return oldColumnSelection; + return oldHiddenColumns; } - public void setOldColumnSelection(ColumnSelection currentColumnSelection) + public void setOldHiddenColumns(HiddenColumns currentHiddenColumns) { - if (currentColumnSelection != null) + if (currentHiddenColumns != null) { - this.oldColumnSelection = new ColumnSelection(currentColumnSelection); + this.oldHiddenColumns = new HiddenColumns(currentHiddenColumns); } }