clargs documentation, new vamsas session import and join args. apply gpl development...
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index 2f3a312..47973d0 100644 (file)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
+ * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
  * 
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -586,4 +586,34 @@ public class StructureSelectionManager
   {
     modifySeqMappingList(true, codonFrames);
   }
+
+  Vector sel_listeners = new Vector();
+  public void addSelectionListener(SelectionListener selecter)
+  {
+    if (!sel_listeners.contains(selecter))
+    {
+      sel_listeners.addElement(selecter);
+    }
+  }
+  public void removeSelectionListener(SelectionListener toremove)
+  {
+    if (sel_listeners.contains(toremove))
+    {
+      sel_listeners.removeElement(toremove);
+    }
+  }
+  public synchronized void sendSelection(jalview.datamodel.SequenceGroup selection, jalview.datamodel.ColumnSelection colsel, SelectionSource source)
+  {
+    if (sel_listeners!=null && sel_listeners.size()>0)
+    {
+      Enumeration listeners = sel_listeners.elements();
+      while (listeners.hasMoreElements())
+      {
+        SelectionListener slis = ((SelectionListener) listeners.nextElement());
+        if (slis!=source) { 
+          slis.selection(selection, colsel, source); 
+        };
+      }
+    }
+  }
 }