JAL-1503 update version in GPL header
[jalview.git] / src / jalview / gui / AppVarna.java
index 27c28ad..f047199 100644 (file)
@@ -1,19 +1,20 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
- * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
+ * 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.
- * 
+ *  
  * 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/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
  */
 package jalview.gui;
 
@@ -23,24 +24,14 @@ import java.util.regex.Pattern;
 import java.awt.*;
 
 import javax.swing.*;
-import javax.swing.event.*;
-
-import java.awt.event.*;
-import java.io.*;
 
-import jalview.api.AlignViewportI;
-import jalview.api.AlignmentViewPanel;
-import jalview.api.SequenceStructureBinding;
 import jalview.bin.Cache;
 import jalview.datamodel.*;
-import jalview.gui.ViewSelectionMenu.ViewSetProvider;
 import jalview.structure.*;
-import jalview.io.*;
-import jalview.schemes.*;
+import jalview.util.MessageManager;
 import jalview.util.ShiftList;
 import fr.orsay.lri.varna.VARNAPanel;
 import fr.orsay.lri.varna.exceptions.ExceptionFileFormatOrSyntax;
-import fr.orsay.lri.varna.exceptions.ExceptionNonEqualLength;
 import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses;
 import fr.orsay.lri.varna.interfaces.InterfaceVARNAListener;
 import fr.orsay.lri.varna.interfaces.InterfaceVARNASelectionListener;
@@ -48,7 +39,6 @@ import fr.orsay.lri.varna.models.BaseList;
 import fr.orsay.lri.varna.models.VARNAConfig;
 import fr.orsay.lri.varna.models.annotations.HighlightRegionAnnotation;
 import fr.orsay.lri.varna.models.rna.ModeleBase;
-import fr.orsay.lri.varna.models.rna.ModeleBaseNucleotide;
 import fr.orsay.lri.varna.models.rna.RNA;
 
 public class AppVarna extends JInternalFrame implements
@@ -73,8 +63,8 @@ public class AppVarna extends JInternalFrame implements
 
   AlignmentPanel ap;
 
-  public AppVarna(String sname, SequenceI seq, String strucseq, String struc,
-          String name, AlignmentPanel ap)
+  public AppVarna(String sname, SequenceI seq, String strucseq,
+          String struc, String name, AlignmentPanel ap)
   {
     this.ap = ap;
     ArrayList<RNA> rnaList = new ArrayList<RNA>();
@@ -89,12 +79,12 @@ public class AppVarna extends JInternalFrame implements
     {
       e3.printStackTrace();
     }
-    RNA trim = trimRNA(rna1);
+    RNA trim = trimRNA(rna1, "trimmed " + sname);
     rnaList.add(trim);
     rnaList.add(rna1);
     rnas.put(seq, rna1);
     rnas.put(seq, trim);
-    rna1.setName(sname+" (with gaps)");
+    rna1.setName(sname + " (with gaps)");
 
     {
       seqs.put(trim, seq);
@@ -110,7 +100,7 @@ public class AppVarna extends JInternalFrame implements
     vab = new AppVarnaBinding(rnaList);
     // vab = new AppVarnaBinding(seq,struc);
     // System.out.println("Hallo: "+name);
-    this.name = name;
+    this.name = sname + " trimmed to " + name;
     initVarna();
     ssm = ap.getStructureSelectionManager();
     ssm.addStructureViewerListener(this);
@@ -129,7 +119,7 @@ public class AppVarna extends JInternalFrame implements
     // getContentPane().add(vab.getTools(), BorderLayout.NORTH);
     varnaPanel.addVARNAListener(this);
     varnaPanel.addSelectionListener(this);
-    jalview.gui.Desktop.addInternalFrame(this, "VARNA -" + name,
+    jalview.gui.Desktop.addInternalFrame(this, MessageManager.formatMessage("label.varna_params", new String[]{name}),
             getBounds().width, getBounds().height);
     this.pack();
     showPanel(true);
@@ -145,10 +135,10 @@ public class AppVarna extends JInternalFrame implements
     return newStr;
   }
 
-  public RNA trimRNA(RNA rna)
+  public RNA trimRNA(RNA rna, String name)
   {
     ShiftList offset = new ShiftList();
-    RNA rnaTrim = new RNA("trim_" + rna.getName());
+    RNA rnaTrim = new RNA(name);
     try
     {
       rnaTrim.setRNA(rna.getSeq(), replaceOddGaps(rna.getStructDBN()));
@@ -333,9 +323,9 @@ public class AppVarna extends JInternalFrame implements
       ShiftList shift = offsets.get(rna);
       if (shift != null)
       {
-   //      System.err.print("Orig pos:"+index);
-         index = shift.shift(index);
-   //      System.err.println("\nFinal pos:"+index);
+        // System.err.print("Orig pos:"+index);
+        index = shift.shift(index);
+        // System.err.println("\nFinal pos:"+index);
       }
       mouseOverHighlighter.highlightRegion(rna, index, index);
       vab.updateSelectedRNA(rna);
@@ -392,7 +382,7 @@ public class AppVarna extends JInternalFrame implements
       if (shift != null)
       {
         int i = shift.shift(arg1.getIndex());
- //       System.err.println("shifted "+(arg1.getIndex())+" to "+i);
+        // System.err.println("shifted "+(arg1.getIndex())+" to "+i);
         ssm.mouseOverVamsasSequence(seq, i, this);
       }
       else