JAL-1641 updated applet version
[jalview.git] / src / jalview / appletgui / CutAndPasteTransfer.java
index d33e0cc..5b699a6 100644 (file)
@@ -41,7 +41,10 @@ import jalview.datamodel.PDBEntry;
 import jalview.datamodel.SequenceI;
 import jalview.io.AnnotationFile;
 import jalview.io.AppletFormatAdapter;
+import jalview.io.FileParse;
+import jalview.io.HtmlFile;
 import jalview.io.IdentifyFile;
+import jalview.io.JSONFile;
 import jalview.io.NewickFile;
 import jalview.io.TCoffeeScoreFile;
 import jalview.schemes.TCoffeeColourScheme;
@@ -60,6 +63,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
 
   AlignFrame alignFrame;
 
+  FileParse source = null;
+
   public CutAndPasteTransfer(boolean forImport, AlignFrame alignFrame)
   {
     try
@@ -163,7 +168,7 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
     }
     else if (alignFrame != null)
     {
-      loadAlignment(text, newWindow);
+      loadAlignment(text, newWindow, alignFrame.getAlignViewport());
     }
 
     // TODO: dialog should indicate if data was parsed correctly or not - see
@@ -212,16 +217,18 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
    * @param text
    * @param newWindow
    */
-  protected void loadAlignment(String text, boolean newWindow)
+  protected void loadAlignment(String text, boolean newWindow,
+          AlignViewport viewport)
   {
     Alignment al = null;
 
     String format = new IdentifyFile().Identify(text,
             AppletFormatAdapter.PASTE);
+    AppletFormatAdapter afa = new AppletFormatAdapter(viewport);
     try
     {
-      al = new AppletFormatAdapter().readFile(text,
-              AppletFormatAdapter.PASTE, format);
+      al = afa.readFile(text, AppletFormatAdapter.PASTE, format);
+      source = afa.getAlignFile();
     } catch (java.io.IOException ex)
     {
       ex.printStackTrace();
@@ -247,6 +254,15 @@ public class CutAndPasteTransfer extends Panel implements ActionListener,
         af.statusBar
                 .setText(MessageManager
                         .getString("label.successfully_pasted_annotation_to_alignment"));
+
+        if (source instanceof HtmlFile)
+        {
+          ((HtmlFile) source).applySettingsToAlignmentView(af);
+        }
+        else if (source instanceof JSONFile)
+        {
+          ((JSONFile) source).applySettingsToAlignmentView(af);
+        }
       }
       else
       {