JAL-2316 Added database name column to URL links table in preferences
[jalview.git] / src / jalview / util / UrlLink.java
index 186b682..d95edb2 100644 (file)
@@ -53,6 +53,8 @@ public class UrlLink
 
   private String label;
 
+  private String dbname;
+
   private String regexReplace;
 
   private boolean dynamic = false;
@@ -104,14 +106,19 @@ public class UrlLink
   }
 
   /**
-   * Alternative constructor for separate name and link
+   * Alternative constructor for separate name, link and description
    * 
    * @param name
+   *          The string used to match the link to a DB reference id
    * @param url
+   *          The url to link to
+   * @param desc
+   *          The description of the associated target DB
    */
-  public UrlLink(String name, String url)
+  public UrlLink(String name, String url, String desc)
   {
     this(name + SEP + url);
+    dbname = desc;
   }
 
   /**
@@ -146,6 +153,14 @@ public class UrlLink
     return label;
   }
 
+  /**
+   * @return the name of this link's associated database
+   */
+  public String getDBName()
+  {
+    return dbname;
+  }
+
   public String getUrlWithToken()
   {
     String var = (usesDBaccession ? DB_ACCESSION : SEQUENCE_ID);
@@ -212,6 +227,16 @@ public class UrlLink
   }
 
   /**
+   * Set the description
+   * 
+   * @param desc
+   */
+  public void setDescription(String desc)
+  {
+    this.dbname = desc;
+  }
+
+  /**
    * return one or more URL strings by applying regex to the given idstring
    * 
    * @param idstring