Merge develop to Release_2_8_3_Branch
[jalview.git] / src / jalview / gui / IdPanel.java
index 7f2e669..4ea35ca 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -25,6 +25,7 @@ import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceGroup;
 import jalview.datamodel.SequenceI;
 import jalview.io.SequenceAnnotationReport;
+import jalview.util.MessageManager;
 import jalview.util.UrlLink;
 
 import java.awt.BorderLayout;
@@ -51,7 +52,7 @@ import javax.swing.ToolTipManager;
 public class IdPanel extends JPanel implements MouseListener,
         MouseMotionListener, MouseWheelListener
 {
-  protected IdCanvas idCanvas;
+  private IdCanvas idCanvas;
 
   protected AlignViewport av;
 
@@ -80,11 +81,11 @@ public class IdPanel extends JPanel implements MouseListener,
   {
     this.av = av;
     alignPanel = parent;
-    idCanvas = new IdCanvas(av);
+    setIdCanvas(new IdCanvas(av));
     linkImageURL = getClass().getResource("/images/link.gif").toString();
     seqAnnotReport = new SequenceAnnotationReport(linkImageURL);
     setLayout(new BorderLayout());
-    add(idCanvas, BorderLayout.CENTER);
+    add(getIdCanvas(), BorderLayout.CENTER);
     addMouseListener(this);
     addMouseMotionListener(this);
     addMouseWheelListener(this);
@@ -101,7 +102,7 @@ public class IdPanel extends JPanel implements MouseListener,
   @Override
   public void mouseMoved(MouseEvent e)
   {
-    SeqPanel sp = alignPanel.seqPanel;
+    SeqPanel sp = alignPanel.getSeqPanel();
     int seq = Math.max(0, sp.findSeq(e));
     if (seq > -1 && seq < av.getAlignment().getHeight())
     {
@@ -109,8 +110,8 @@ public class IdPanel extends JPanel implements MouseListener,
       StringBuffer tip = new StringBuffer(64);
       seqAnnotReport
               .createSequenceAnnotationReport(tip, sequence,
-                      av.isShowDbRefs(), av.isShowNpFeats(),
-                      sp.seqCanvas.fr.minmax);
+              av.isShowDBRefs(), av.isShowNPFeats(),
+                      sp.seqCanvas.fr.getMinMax());
       setToolTipText("<html>" + sequence.getDisplayId(true) + " "
               + tip.toString() + "</html>");
     }
@@ -127,7 +128,7 @@ public class IdPanel extends JPanel implements MouseListener,
   {
     mouseDragging = true;
 
-    int seq = Math.max(0, alignPanel.seqPanel.findSeq(e));
+    int seq = Math.max(0, alignPanel.getSeqPanel().findSeq(e));
 
     if (seq < lastid)
     {
@@ -201,7 +202,7 @@ public class IdPanel extends JPanel implements MouseListener,
       return;
     }
 
-    int seq = alignPanel.seqPanel.findSeq(e);
+    int seq = alignPanel.getSeqPanel().findSeq(e);
     String url = null;
     int i = 0;
     String id = av.getAlignment().getSequenceAt(seq).getName();
@@ -246,9 +247,8 @@ public class IdPanel extends JPanel implements MouseListener,
       JOptionPane
               .showInternalMessageDialog(
                       Desktop.desktop,
-                      "Unixers: Couldn't find default web browser."
-                              + "\nAdd the full path to your browser in Preferences.",
-                      "Web browser not found", JOptionPane.WARNING_MESSAGE);
+                      MessageManager.getString("label.web_browser_not_found_unix"),
+                      MessageManager.getString("label.web_browser_not_found"), JOptionPane.WARNING_MESSAGE);
       ex.printStackTrace();
     }
   }
@@ -315,7 +315,7 @@ public class IdPanel extends JPanel implements MouseListener,
       return;
     }
 
-    int seq = alignPanel.seqPanel.findSeq(e);
+    int seq = alignPanel.getSeqPanel().findSeq(e);
 
     if (SwingUtilities.isRightMouseButton(e))
     {
@@ -323,8 +323,7 @@ public class IdPanel extends JPanel implements MouseListener,
       // build a new links menu based on the current links + any non-positional
       // features
       Vector nlinks = new Vector(Preferences.sequenceURLLinks);
-      SequenceFeature sf[] = sq == null ? null : sq.getDatasetSequence()
-              .getSequenceFeatures();
+      SequenceFeature sf[] = sq == null ? null : sq.getSequenceFeatures();
       for (int sl = 0; sf != null && sl < sf.length; sl++)
       {
         if (sf[sl].begin == sf[sl].end && sf[sl].begin == 0)
@@ -363,6 +362,9 @@ public class IdPanel extends JPanel implements MouseListener,
     {
       selectSeq(seq);
     }
+    // TODO is this addition ok here?
+    av.isSelectionGroupChanged(true);
+
     alignPanel.paintAlignment(true);
   }
 
@@ -443,7 +445,7 @@ public class IdPanel extends JPanel implements MouseListener,
    */
   public void highlightSearchResults(List<SequenceI> list)
   {
-    idCanvas.setHighlighted(list);
+    getIdCanvas().setHighlighted(list);
 
     if (list == null)
     {
@@ -459,6 +461,16 @@ public class IdPanel extends JPanel implements MouseListener,
     }
   }
 
+  public IdCanvas getIdCanvas()
+  {
+    return idCanvas;
+  }
+
+  public void setIdCanvas(IdCanvas idCanvas)
+  {
+    this.idCanvas = idCanvas;
+  }
+
   // this class allows scrolling off the bottom of the visible alignment
   class ScrollThread extends Thread
   {