JAL-1640 Desktop.getAlignmentPanel and Desktop.getViewports can now take a null argum...
authorJim Procter <jprocter@dundee.ac.uk>
Fri, 6 Feb 2015 10:52:08 +0000 (10:52 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Fri, 6 Feb 2015 10:52:08 +0000 (10:52 +0000)
src/jalview/gui/Desktop.java

index 70c8355..c737be8 100644 (file)
@@ -1677,6 +1677,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
   /**
    * 
    * @param alignmentId
+   *          - if null, all sets are returned
    * @return all AlignmentPanels concerning the alignmentId sequence set
    */
   public static AlignmentPanel[] getAlignmentPanels(String alignmentId)
@@ -1697,7 +1698,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         AlignFrame af = (AlignFrame) frames[t];
         for (int a = 0; a < af.alignPanels.size(); a++)
         {
-          if (alignmentId.equals(((AlignmentPanel) af.alignPanels
+          if (alignmentId == null
+                  || alignmentId.equals(((AlignmentPanel) af.alignPanels
                   .elementAt(a)).av.getSequenceSetId()))
           {
             aps.add(af.alignPanels.elementAt(a));
@@ -1721,7 +1723,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
    * get all the viewports on an alignment.
    * 
    * @param sequenceSetId
-   *          unique alignment id
+   *          unique alignment id (may be null - all viewports returned in that
+   *          case)
    * @return all viewports on the alignment bound to sequenceSetId
    */
   public static AlignViewport[] getViewports(String sequenceSetId)
@@ -1736,13 +1739,17 @@ public class Desktop extends jalview.jbgui.GDesktop implements
         if (frames[t] instanceof AlignFrame)
         {
           AlignFrame afr = ((AlignFrame) frames[t]);
-          if (afr.getViewport().getSequenceSetId().equals(sequenceSetId))
+          if (sequenceSetId == null
+                  || afr.getViewport().getSequenceSetId()
+                          .equals(sequenceSetId))
           {
             if (afr.alignPanels != null)
             {
               for (int a = 0; a < afr.alignPanels.size(); a++)
               {
-                if (sequenceSetId.equals(((AlignmentPanel) afr.alignPanels
+                if (sequenceSetId == null
+                        || sequenceSetId
+                                .equals(((AlignmentPanel) afr.alignPanels
                         .elementAt(a)).av.getSequenceSetId()))
                 {
                   viewp.addElement(((AlignmentPanel) afr.alignPanels