JAL-1482 feature renderer and manipulation code refactored to renderer and abstract...
[jalview.git] / src / jalview / gui / Jalview2XML_V1.java
index 3a92f80..f246fd3 100755 (executable)
@@ -1,19 +1,21 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
  * Copyright (C) 2014 The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
  * Jalview is free software: you can redistribute it and/or
  * modify it under the terms of the GNU General Public License 
- * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
  *  
  * Jalview is distributed in the hope that it will be useful, but 
  * WITHOUT ANY WARRANTY; without even the implied warranty 
  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
  * PURPOSE.  See the GNU General Public License for more details.
  * 
- * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
  * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.gui;
@@ -25,9 +27,12 @@ import java.util.jar.*;
 import javax.swing.*;
 
 import org.exolab.castor.xml.*;
+
 import jalview.binding.*;
 import jalview.schemes.*;
+import jalview.util.MessageManager;
 import jalview.util.jarInputStreamProvider;
+import jalview.viewmodel.seqfeatures.FeatureRendererSettings;
 
 /**
  * DOCUMENT ME!
@@ -136,7 +141,10 @@ public class Jalview2XML_V1
             System.err.println("Couldn't locate Jalview XML file : " + ex
                     + "\n");
             JOptionPane.showInternalMessageDialog(Desktop.desktop,
-                    "Couldn't locate " + file, "URL not found",
+                    MessageManager.formatMessage("label.couldnt_locate",
+                            new String[]
+                            { file }), MessageManager
+                            .getString("label.url_not_found"),
                     JOptionPane.WARNING_MESSAGE);
           }
         });
@@ -384,29 +392,31 @@ public class Jalview2XML_V1
     }
 
     af.viewport.setColourAppliesToAllGroups(true);
-    af.viewport.showSequenceFeatures = view.getShowSequenceFeatures();
+    af.viewport.setShowSequenceFeatures(view.getShowSequenceFeatures());
 
     if (jms.getFeatureSettings() != null)
     {
-      af.viewport.featuresDisplayed = new Hashtable();
+      Hashtable featuresDisplayed = new Hashtable();
+      Hashtable featureColours = new Hashtable();
       String[] renderOrder = new String[jms.getFeatureSettings()
               .getSettingCount()];
       for (int fs = 0; fs < jms.getFeatureSettings().getSettingCount(); fs++)
       {
         Setting setting = jms.getFeatureSettings().getSetting(fs);
 
-        af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(
+        featureColours.put(
                 setting.getType(), new java.awt.Color(setting.getColour()));
 
         renderOrder[fs] = setting.getType();
 
         if (setting.getDisplay())
         {
-          af.viewport.featuresDisplayed.put(setting.getType(), new Integer(
+          featuresDisplayed.put(setting.getType(), new Integer(
                   setting.getColour()));
         }
       }
-      af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;
+      FeatureRendererSettings frs = new FeatureRendererSettings(renderOrder, new Hashtable(), featureColours, 1.0f, null);
+      af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().transferSettings(frs);
     }
 
     af.setMenusFromViewport(af.viewport);