From: Jim Procter Date: Wed, 12 Feb 2020 17:09:12 +0000 (+0000) Subject: JAL-3187 convenience method on SplitContainerI to retrieve a complement’s alignFrame X-Git-Tag: Develop-2_11_2_0-d20201215~101^2~19 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=ef06b969ecfe1544324c7058d607376f18453478;p=jalview.git JAL-3187 convenience method on SplitContainerI to retrieve a complement’s alignFrame --- diff --git a/src/jalview/api/SplitContainerI.java b/src/jalview/api/SplitContainerI.java index 46f5f44..2a09475 100644 --- a/src/jalview/api/SplitContainerI.java +++ b/src/jalview/api/SplitContainerI.java @@ -55,4 +55,14 @@ public interface SplitContainerI */ String getComplementTitle(Object af); + /** + * get the 'other' alignFrame in the SplitFrame + * + * @param alignFrame + * @return the complement alignFrame - or null if alignFrame wasn't held by this + * frame + */ + AlignViewControllerGuiI getComplementAlignFrame( + AlignViewControllerGuiI alignFrame); + } diff --git a/src/jalview/gui/SplitFrame.java b/src/jalview/gui/SplitFrame.java index 25dedc5..396e3b3 100644 --- a/src/jalview/gui/SplitFrame.java +++ b/src/jalview/gui/SplitFrame.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.api.AlignViewControllerGuiI; import jalview.api.SplitContainerI; import jalview.datamodel.AlignmentI; import jalview.jbgui.GAlignFrame; @@ -763,6 +764,22 @@ public class SplitFrame extends GSplitFrame implements SplitContainerI { (AlignFrame) getTopFrame(), (AlignFrame) getBottomFrame() }); } + @Override + public AlignFrame getComplementAlignFrame( + AlignViewControllerGuiI alignFrame) + { + if (getTopFrame() == alignFrame) + { + return (AlignFrame) getBottomFrame(); + } + if (getBottomFrame() == alignFrame) + { + return (AlignFrame) getTopFrame(); + } + // we didn't know anything about this frame... + return null; + } + /** * Replace Cmd-F Find action with our version. This is necessary because the * 'default' Finder searches in the first AlignFrame it finds. We need it to