From ef06b969ecfe1544324c7058d607376f18453478 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 12 Feb 2020 17:09:12 +0000 Subject: [PATCH] =?utf8?q?JAL-3187=20convenience=20method=20on=20SplitContai?= =?utf8?q?nerI=20to=20retrieve=20a=20complement=E2=80=99s=20alignFrame?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/api/SplitContainerI.java | 10 ++++++++++ src/jalview/gui/SplitFrame.java | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) 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 -- 1.7.10.2