reinstate links on features
authorjprocter <Jim Procter>
Fri, 12 Jun 2009 15:56:21 +0000 (15:56 +0000)
committerjprocter <Jim Procter>
Fri, 12 Jun 2009 15:56:21 +0000 (15:56 +0000)
src/jalview/io/vamsas/Sequencefeature.java

index 1348227..55db09d 100644 (file)
@@ -158,7 +158,10 @@ public class Sequencefeature extends Rangetype
       dsSeq.deleteFeature(feature);\r
       replaceJvObjMapping(feature, newsf);\r
       dsSeq.addSequenceFeature(newsf);\r
-      feature.otherDetails.clear();\r
+      if (feature.otherDetails!=null) {\r
+        // TODO later: leave this to finalise method ? \r
+        feature.otherDetails.clear();\r
+      }\r
     }\r
   }\r
 \r
@@ -197,15 +200,14 @@ public class Sequencefeature extends Rangetype
       {\r
         String link = (String) feature.links.elementAt(i);\r
         UrlLink ulink = new UrlLink(link);\r
-        /*\r
-         * int sep = link.indexOf('|'); if (sep > -1) { Link vLink = new Link();\r
-         * if (sep > 0) { vLink.setContent(link.substring(0, sep - 1)); } else {\r
-         * vLink.setContent(""); } vLink.setHref(link.substring(sep + 1)); //\r
-         * TODO: validate href. dsa.addLink(vLink); }\r
-         */\r
-        Link vLink = new Link();\r
-        vLink.setContent(ulink.getLabel());\r
-        vLink.setHref(ulink.getUrl_prefix());\r
+        if (ulink.isValid())\r
+        {\r
+          // We only add static links to the document.\r
+          Link vLink = new Link();\r
+          vLink.setContent(ulink.getLabel());\r
+          vLink.setHref(ulink.getTarget());\r
+          dsa.addLink(vLink);\r
+        }\r
       }\r
     }\r
     dsa.setGroup(feature.getFeatureGroup());\r
@@ -275,7 +277,8 @@ public class Sequencefeature extends Rangetype
     {\r
       Link[] links = dseta.getLink();\r
       for (int i = 0; i < links.length; i++)\r
-      {\r
+      { \r
+        // TODO: use URLLink parsing/validation here.\r
         sf.addLink(links[i].getContent() + "|" + links[i].getHref());\r
       }\r
     }\r