JAL-1333 allow reuse of existing chimera for new or additional structures
[jalview.git] / src / jalview / gui / FeatureRenderer.java
old mode 100755 (executable)
new mode 100644 (file)
index 9df0b28..eb64dee
@@ -1,19 +1,22 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
- * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle
+ * 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;
 
@@ -30,6 +33,7 @@ import javax.swing.*;
 
 import jalview.datamodel.*;
 import jalview.schemes.GraduatedColor;
+import jalview.util.MessageManager;
 
 /**
  * DOCUMENT ME!
@@ -80,6 +84,11 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
   {
     this.ap = ap;
     this.av = ap.av;
+    if (ap != null && ap.seqPanel != null && ap.seqPanel.seqCanvas != null
+            && ap.seqPanel.seqCanvas.fr != null)
+    {
+      transferSettings(ap.seqPanel.seqCanvas.fr);
+    }
   }
 
   public class FeatureRendererSettings implements Cloneable
@@ -164,6 +173,12 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     this.featureOrder = fr.featureOrder;
   }
 
+  /**
+   * update from another feature renderer
+   * 
+   * @param fr
+   *          settings to copy
+   */
   public void transferSettings(FeatureRenderer fr)
   {
     FeatureRendererSettings frs = new FeatureRendererSettings(fr);
@@ -1053,7 +1068,7 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     {
       panel = new JPanel(new GridLayout(4, 1));
       tmp = new JPanel();
-      tmp.add(new JLabel("Select Feature: "));
+      tmp.add(new JLabel(MessageManager.getString("label.select_feature")));
       overlaps = new JComboBox();
       for (int i = 0; i < features.length; i++)
       {
@@ -1103,17 +1118,19 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
 
     tmp = new JPanel();
     panel.add(tmp);
-    tmp.add(new JLabel("Name: ", JLabel.RIGHT));
+    tmp.add(new JLabel(MessageManager.getString("label.name"), JLabel.RIGHT));
     tmp.add(name);
 
     tmp = new JPanel();
     panel.add(tmp);
-    tmp.add(new JLabel("Group: ", JLabel.RIGHT));
+    tmp.add(new JLabel(MessageManager.getString("label.group") + ":",
+            JLabel.RIGHT));
     tmp.add(source);
 
     tmp = new JPanel();
     panel.add(tmp);
-    tmp.add(new JLabel("Colour: ", JLabel.RIGHT));
+    tmp.add(new JLabel(MessageManager.getString("label.colour"),
+            JLabel.RIGHT));
     tmp.add(colour);
     colour.setPreferredSize(new Dimension(150, 15));
     colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9));
@@ -1125,7 +1142,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
     bigPanel.add(panel, BorderLayout.NORTH);
 
     panel = new JPanel();
-    panel.add(new JLabel("Description: ", JLabel.RIGHT));
+    panel.add(new JLabel(MessageManager.getString("label.description"),
+            JLabel.RIGHT));
     description.setFont(JvSwingUtils.getTextAreaFont());
     description.setLineWrap(true);
     panel.add(new JScrollPane(description));
@@ -1135,9 +1153,11 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer
       bigPanel.add(panel, BorderLayout.SOUTH);
 
       panel = new JPanel();
-      panel.add(new JLabel(" Start:", JLabel.RIGHT));
+      panel.add(new JLabel(MessageManager.getString("label.start"),
+              JLabel.RIGHT));
       panel.add(start);
-      panel.add(new JLabel("  End:", JLabel.RIGHT));
+      panel.add(new JLabel(MessageManager.getString("label.end"),
+              JLabel.RIGHT));
       panel.add(end);
       bigPanel.add(panel, BorderLayout.CENTER);
     }