JAL-2944 methods to check existence and get a title for existing or to-be-created...
authorJim Procter <jprocter@issues.jalview.org>
Thu, 5 Apr 2018 13:27:29 +0000 (14:27 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 5 Apr 2018 13:27:29 +0000 (14:27 +0100)
src/jalview/gui/StructureViewer.java

index 8b501ad..b7767fa 100644 (file)
@@ -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();
+  }
+
 }