From b927b6af7e5654e0df7e2dbaa337322f2b52940f Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Thu, 5 Apr 2018 14:27:29 +0100 Subject: [PATCH] JAL-2944 methods to check existence and get a title for existing or to-be-created StructureViewer --- src/jalview/gui/StructureViewer.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/jalview/gui/StructureViewer.java b/src/jalview/gui/StructureViewer.java index 8b501ad..b7767fa 100644 --- a/src/jalview/gui/StructureViewer.java +++ b/src/jalview/gui/StructureViewer.java @@ -75,6 +75,16 @@ public class StructureViewer sv.sview = display; return sv; } + + @Override + public String toString() + { + if (sview != null) + { + return sview.toString(); + } + return "New View"; + } public ViewerType getViewerType() { String viewType = Cache.getDefault(Preferences.STRUCTURE_DISPLAY, @@ -343,4 +353,24 @@ public class StructureViewer return false; } + /** + * + * @param pDBid + * @return true if view is already showing PDBid + */ + public boolean hasPdbId(String pDBid) + { + if (sview == null) + { + return false; + } + + return sview.getBinding().hasPdbId(pDBid); + } + + public boolean isVisible() + { + return sview != null && sview.isVisible(); + } + } -- 1.7.10.2