indicate the database id source associated with the sequences being submitted.
[jalview.git] / src / jalview / structure / StructureSelectionManager.java
index e12e3ab..47973d0 100644 (file)
@@ -1,17 +1,17 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer
- * Copyright (C) 2007 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
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- *
+ * 
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- *
+ * 
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
@@ -278,9 +278,9 @@ public class StructureSelectionManager
             indexpos = mappings[j].getSeqPos(pdbResNum);
             results.addResult(mappings[j].sequence, indexpos, indexpos);
             // construct highlighted sequence list
-            if (seqmappings!=null)
+            if (seqmappings != null)
             {
-              
+
               Enumeration e = seqmappings.elements();
               while (e.hasMoreElements())
 
@@ -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); 
+        };
+      }
+    }
+  }
 }