JAL-4023 use %g for distances (scientific notation for very small or large values)
[jalview.git] / src / jalview / gui / TreeCanvas.java
index baaec82..6f143db 100755 (executable)
@@ -259,7 +259,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
 
       if (showDistances && (node.dist > 0))
       {
-        nodeLabel = new Format("%-.2f").form(node.dist);
+        nodeLabel = new Format("%g").form(node.dist);
       }
 
       if (showBootstrap && node.bootstrap > -1)
@@ -347,7 +347,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
 
       if (showDistances && (node.dist > 0))
       {
-        nodeLabel = new Format("%-.2f").form(node.dist);
+        nodeLabel = new Format("%g").form(node.dist);
       }
 
       if (showBootstrap && node.bootstrap > -1)
@@ -381,7 +381,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
   {
     for (Entry<Object, Rectangle> entry : nameHash.entrySet())
     {
-      Rectangle rect = (Rectangle) nameHash.get(entry.getValue());
+      Rectangle rect = entry.getValue();
 
       if ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y)
               && (y <= (rect.y + rect.height)))
@@ -459,8 +459,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
     if ((node.left() == null) && (node.right() == null))
     {
       double height = node.height;
-//      double dist = node.dist;
-//      int xstart = (int) ((height - dist) * wscale) + offx;
+      // double dist = node.dist;
+      // int xstart = (int) ((height - dist) * wscale) + offx;
       int xend = (int) (height * wscale) + offx;
 
       int ypos = (int) (node.ycount * chunk) + offy;
@@ -826,7 +826,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
   void chooseSubtreeColour()
   {
     String ttl = MessageManager.getString("label.select_subtree_colour");
-    ColourChooserListener listener = new ColourChooserListener() {
+    ColourChooserListener listener = new ColourChooserListener()
+    {
       @Override
       public void colourSelected(Color c)
       {
@@ -835,7 +836,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         repaint();
       }
     };
-    JalviewColourChooser.showColourChooser(this, ttl,  highlightNode.color, listener);
+    JalviewColourChooser.showColourChooser(this, ttl, highlightNode.color,
+            listener);
   }
 
   @Override
@@ -914,7 +916,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
     if (ob instanceof SequenceI)
     {
       treeSelectionChanged((Sequence) ob);
-      PaintRefresher.Refresh(tp, getAssociatedPanel().av.getSequenceSetId());
+      PaintRefresher.Refresh(tp,
+              getAssociatedPanel().av.getSequenceSetId());
       repaint();
       av.sendSelection();
       return;
@@ -960,7 +963,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable,
         }
       }
 
-      PaintRefresher.Refresh(tp, getAssociatedPanel().av.getSequenceSetId());
+      PaintRefresher.Refresh(tp,
+              getAssociatedPanel().av.getSequenceSetId());
       repaint();
     }