Maintain numbering if remove left is undone
authoramwaterhouse <Andrew Waterhouse>
Thu, 11 May 2006 14:06:16 +0000 (14:06 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 11 May 2006 14:06:16 +0000 (14:06 +0000)
src/jalview/datamodel/HistoryItem.java

index 0520bc0..09e87f3 100755 (executable)
@@ -75,7 +75,9 @@ public class HistoryItem
       SequenceI seq = al.getSequenceAt(i);\r
       sequences.addElement(seq);\r
       alignIndex.addElement(i + "");\r
-      seqAsString.addElement(seq.getSequence().toString());\r
+      seqAsString.addElement(seq.getStart()\r
+                             +" "+seq.getEnd()\r
+                             +" "+seq.getSequence().toString());\r
     }\r
 \r
     if(alignment.getHiddenSequences()!=null\r
@@ -115,22 +117,23 @@ public class HistoryItem
     }\r
     else\r
     {\r
-\r
+      StringTokenizer st;\r
       for (int i = 0; i < sequences.size(); i++)\r
       {\r
         SequenceI restore = (SequenceI) sequences.elementAt(i);\r
 \r
+\r
         if (restore.getLength() == 0)\r
         {\r
           //This is for edits which remove all residues in a sequence\r
-          restore.setSequence(seqAsString.elementAt(i).toString());\r
           alignment.getSequences().insertElementAt(restore,\r
               Integer.parseInt(alignIndex.elementAt(i).toString()));\r
         }\r
-        else\r
-        {\r
-          restore.setSequence(seqAsString.elementAt(i).toString());\r
-        }\r
+\r
+        st = new StringTokenizer(seqAsString.elementAt(i).toString());\r
+        restore.setStart(Integer.parseInt(st.nextToken()));\r
+        restore.setEnd(Integer.parseInt(st.nextToken()));\r
+        restore.setSequence(st.nextToken());\r
       }\r
 \r
       if(hiddenSeqs!=null)\r