formatAdapter.formatSequences and maintain annotation after undo
authoramwaterhouse <Andrew Waterhouse>
Tue, 3 May 2005 12:49:40 +0000 (12:49 +0000)
committeramwaterhouse <Andrew Waterhouse>
Tue, 3 May 2005 12:49:40 +0000 (12:49 +0000)
src/jalview/gui/AlignFrame.java

index cabb24f..4fbdb72 100755 (executable)
@@ -94,7 +94,7 @@ public class AlignFrame extends GAlignFrame
     {\r
       String choice =  chooser.getSelectedFile().getPath();\r
       jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
-      String output = FormatAdapter.get(e.getActionCommand(), viewport.getAlignment().getSequences());\r
+      String output = FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences());\r
       try{\r
         java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileWriter( choice )  );\r
         out.println(output);\r
@@ -112,7 +112,7 @@ public class AlignFrame extends GAlignFrame
      cap.formatForOutput();\r
      frame.setContentPane(cap);\r
      Desktop.addInternalFrame(frame, "Alignment output - "+e.getActionCommand(), 600, 500);\r
-     cap.setText( FormatAdapter.get(e.getActionCommand(), viewport.getAlignment().getSequences()));\r
+     cap.setText( FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences()));\r
   }\r
 \r
   protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
@@ -232,9 +232,13 @@ public class AlignFrame extends GAlignFrame
     redoList.add(0, new Object[] {history[0], seq});\r
 \r
       seq = (SequenceI[]) history[1];\r
+      AlignmentAnnotation [] old = viewport.alignment.getAlignmentAnnotation();\r
       viewport.setAlignment( new Alignment(seq) );\r
       updateEditMenuBar();\r
+      for(int i=0; i<old.length; i++)\r
+        viewport.alignment.addAnnotation(old[i]);\r
       viewport.updateConsensus();\r
+      viewport.updateConservation();\r
       alignPanel.repaint();\r
   }\r
 \r
@@ -617,7 +621,7 @@ public class AlignFrame extends GAlignFrame
     viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
     if(viewport.showSequenceFeatures && !((Alignment)viewport.alignment).featuresAdded)\r
     {\r
-         AlignmentUtil.fetchSequenceFeatures( viewport.alignment , alignPanel);\r
+         SequenceFeatureFetcher sft = new SequenceFeatureFetcher(viewport.alignment, alignPanel);\r
          ((Alignment)viewport.alignment).featuresAdded = true;\r
     }\r
     alignPanel.repaint();\r