From 4588e00924d46c0c1ca5ca1cb2a7acc79673c550 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 6 Feb 2015 10:52:08 +0000 Subject: [PATCH] JAL-1640 Desktop.getAlignmentPanel and Desktop.getViewports can now take a null argument to get all alignment panels or viewports in the Desktop --- src/jalview/gui/Desktop.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 70c8355..c737be8 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -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 -- 1.7.10.2