Merge remote-tracking branch 'origin/develop' into bug/JAL-2591 bug/JAL-2591
authorkiramt <k.mourao@dundee.ac.uk>
Thu, 15 Jun 2017 10:54:40 +0000 (11:54 +0100)
committerkiramt <k.mourao@dundee.ac.uk>
Thu, 15 Jun 2017 10:54:40 +0000 (11:54 +0100)
1  2 
src/jalview/appletgui/AnnotationColumnChooser.java
src/jalview/gui/AnnotationColumnChooser.java

@@@ -46,7 -46,7 +46,7 @@@ import java.awt.event.MouseEvent
  import java.awt.event.MouseListener;
  import java.awt.event.TextEvent;
  import java.awt.event.TextListener;
 -import java.util.Iterator;
 +import java.util.ArrayList;
  import java.util.Vector;
  
  //import javax.swing.JPanel;
@@@ -142,7 -142,7 +142,7 @@@ public class AnnotationColumnChooser ex
      }
      setOldHiddenColumns(av.getAlignment().getHiddenColumns());
      adjusting = true;
 -    Vector<String> list = new Vector<String>();
 +    Vector<String> list = new Vector<>();
      int index = 1;
      for (int i = 0; i < anns.length; i++)
      {
          HiddenColumns oldHidden = av
                  .getAnnotationColumnSelectionState()
                  .getOldHiddenColumns();
 -        if (oldHidden != null && oldHidden.getHiddenRegions() != null
 -                && !oldHidden.getHiddenRegions().isEmpty())
 +        if (oldHidden != null)
          {
 -          for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
 -                  .iterator(); itr.hasNext();)
 +          ArrayList<int[]> regions = oldHidden.getHiddenColumnsCopy();
 +          for (int[] positions : regions)
            {
              av.hideColumns(positions[0], positions[1]);
            }
          }
 +        // TODO not clear why we need to hide all the columns (above) if we are
 +        // going to copy the hidden columns over wholesale anyway
          av.getAlignment().setHiddenColumns(oldHidden);
        }
+       av.sendSelection();
        ap.paintAlignment(true);
      }
  
        }
  
        adjusting = true;
-       float range = getCurrentAnnotation().graphMax * 1000
-               - getCurrentAnnotation().graphMin * 1000;
+       // float range = getCurrentAnnotation().graphMax * 1000
+       // - getCurrentAnnotation().graphMin * 1000;
  
        slider.setMinimum((int) (getCurrentAnnotation().graphMin * 1000));
        slider.setMaximum((int) (getCurrentAnnotation().graphMax * 1000));
        }
      }
  
+     // show hidden columns here, before changing the column selection in
+     // filterAnnotations, because showing hidden columns has the side effect of
+     // adding them to the selection
+     av.showAllHiddenColumns();
      av.getColumnSelection().filterAnnotations(
              getCurrentAnnotation().annotations, filterParams);
  
-     av.showAllHiddenColumns();
      if (getActionOption() == ACTION_OPTION_HIDE)
      {
        av.hideSelectedColumns();
  
      filterParams = null;
      av.setAnnotationColumnSelectionState(this);
+     av.sendSelection();
      ap.paintAlignment(true);
    }
  
@@@ -36,7 -36,7 +36,7 @@@ import java.awt.event.ActionListener
  import java.awt.event.ItemEvent;
  import java.awt.event.ItemListener;
  import java.awt.event.KeyEvent;
 -import java.util.Iterator;
 +import java.util.ArrayList;
  
  import javax.swing.ButtonGroup;
  import javax.swing.JCheckBox;
@@@ -244,21 -244,21 +244,21 @@@ public class AnnotationColumnChooser ex
          HiddenColumns oldHidden = av
                  .getAnnotationColumnSelectionState()
                  .getOldHiddenColumns();
 -        if (oldHidden != null && oldHidden.getHiddenRegions() != null
 -                && !oldHidden.getHiddenRegions().isEmpty())
 +        if (oldHidden != null)
          {
 -          for (Iterator<int[]> itr = oldHidden.getHiddenRegions()
 -                  .iterator(); itr.hasNext();)
 +          ArrayList<int[]> regions = oldHidden.getHiddenColumnsCopy();
 +          for (int[] positions : regions)
            {
              av.hideColumns(positions[0], positions[1]);
            }
          }
 +        // TODO not clear why we need to hide all the columns (above) if we are
 +        // going to copy the hidden columns over wholesale anyway
          av.getAlignment().setHiddenColumns(oldHidden);
        }
+       av.sendSelection();
        ap.paintAlignment(true);
      }
    }
  
    @Override
      {
        av.hideSelectedColumns();
      }
+     av.sendSelection();
  
      filterParams = null;
      av.setAnnotationColumnSelectionState(this);
  
      private static final String FILTER_BY_ANN_CACHE_KEY = "CACHE.SELECT_FILTER_BY_ANNOT";
  
 -    public JvCacheableInputBox<String> searchBox = new JvCacheableInputBox<String>(
 +    public JvCacheableInputBox<String> searchBox = new JvCacheableInputBox<>(
              FILTER_BY_ANN_CACHE_KEY);
  
      public SearchPanel(AnnotationColumnChooser aColChooser)