JAL-574 added option to enable/disable 'follow selection' function but commenting...
authorjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 16 Sep 2011 15:09:10 +0000 (16:09 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Fri, 16 Sep 2011 15:09:10 +0000 (16:09 +0100)
src/jalview/gui/AlignFrame.java
src/jalview/jbgui/GAlignFrame.java

index 30026ef..3011393 100755 (executable)
@@ -701,7 +701,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     showDbRefsMenuitem.setSelected(av.isShowDbRefs());
     autoCalculate.setSelected(av.autoCalculateConsensus);
     sortByTree.setSelected(av.sortByTree);
-
+    listenToViewSelections.setSelected(av.followSelection);
+    
     setShowProductsEnabled();
 
     updateEditMenuBar();
@@ -3427,6 +3428,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
     viewport.sortByTree = sortByTree.isSelected();
   }
 
+  @Override
+  protected void listenToViewSelections_actionPerformed(ActionEvent e)
+  {
+    viewport.followSelection = listenToViewSelections.isSelected();
+  }
   /**
    * DOCUMENT ME!
    * 
index 22d27e9..44e34e2 100755 (executable)
@@ -223,6 +223,8 @@ public class GAlignFrame extends JInternalFrame
 
   protected JCheckBoxMenuItem sortByTree = new JCheckBoxMenuItem();
 
+  protected JCheckBoxMenuItem listenToViewSelections = new JCheckBoxMenuItem();
+
   JMenu addSequenceMenu = new JMenu();
 
   JMenuItem addFromFile = new JMenuItem();
@@ -1416,7 +1418,18 @@ public class GAlignFrame extends JInternalFrame
         sortByTreeOption_actionPerformed(e);
       }
     });
-    
+
+    listenToViewSelections.setText("Listen for selections");
+    listenToViewSelections.setToolTipText("<html>When selected, selections in this view will mirror<br>selections made on the same sequences in other views.");
+    listenToViewSelections.setState(false); 
+    listenToViewSelections.addActionListener(new ActionListener()
+    {
+      public void actionPerformed(ActionEvent e)
+      {
+        listenToViewSelections_actionPerformed(e);
+      }
+    });
+
     addSequenceMenu.setText("Add Sequences");
     addFromFile.setText("From File");
     addFromFile.addActionListener(new ActionListener()
@@ -1819,6 +1832,15 @@ public class GAlignFrame extends JInternalFrame
     selectMenu.add(invertColSel);
     selectMenu.add(deleteGroups);
     selectMenu.add(grpsFromSelection);
+    // TODO - determine if the listenToViewSelections button is needed : see bug JAL-754
+    //selectMenu.addSeparator();
+    //selectMenu.add(listenToViewSelections);
+  }
+
+  protected void listenToViewSelections_actionPerformed(ActionEvent e)
+  {
+    // TODO Auto-generated method stub
+    
   }
 
   protected void showAllhidden_actionPerformed(ActionEvent e)