Merge branch 'JAL-1569_wuss_vienna_broke' into Release_2_8_2_Branch
authorJim Procter <jprocter@dundee.ac.uk>
Mon, 24 Nov 2014 22:17:25 +0000 (22:17 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Mon, 24 Nov 2014 22:17:25 +0000 (22:17 +0000)
src/jalview/appletgui/AnnotationPanel.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AnnotationPanel.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/schemes/AnnotationColourGradient.java
src/jalview/schemes/ColourSchemeProperty.java

index 4b9fa67..22996f7 100755 (executable)
@@ -256,7 +256,9 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI,
           anot[index] = new Annotation(label, "", type, 0);
         }
 
-        anot[index].secondaryStructure = type;
+        
+        anot[index].secondaryStructure = type != 'S' ? type : label
+                .length() == 0 ? ' ' : label.charAt(0);
         anot[index].displayCharacter = label;
       }
     }
index c77cbdb..e137225 100755 (executable)
@@ -119,6 +119,7 @@ public class AlignmentAnnotation
 
   private void _markRnaHelices()
   {
+    int mxval = 0;
     // Figure out number of helices
     // Length of rnasecstr is the number of pairs of positions that base pair
     // with each other in the secondary structure
@@ -134,6 +135,10 @@ public class AlignmentAnnotation
       try
       {
         val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
+        if (mxval < val)
+        {
+          mxval = val;
+        }
       } catch (NumberFormatException q)
       {
       }
@@ -145,6 +150,7 @@ public class AlignmentAnnotation
       // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
       // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
     }
+    setScore(mxval);
   }
   /**
    * map of positions in the associated annotation
index 684e7ac..03a3944 100644 (file)
@@ -5797,7 +5797,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
         aa.visible = visible;
       }
     }
-    this.alignPanel.paintAlignment(true);
+    alignPanel.validateAnnotationDimensions(false);
+    alignPanel.alignmentChanged();
   }
 
   /**
index 4adeb83..9f56206 100755 (executable)
  */
 package jalview.gui;
 
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.image.*;
-
-import javax.swing.*;
-
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.Annotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceI;
 import jalview.renderer.AnnotationRenderer;
 import jalview.renderer.AwtRenderPanelI;
 import jalview.util.MessageManager;
 
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.awt.image.BufferedImage;
+
+import javax.swing.JColorChooser;
+import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.Scrollable;
+import javax.swing.SwingUtilities;
+import javax.swing.ToolTipManager;
+
 /**
  * AnnotationPanel displays visible portion of annotation rows below unwrapped
  * alignment
@@ -289,7 +315,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
         int index = av.getColumnSelection().columnAt(i);
 
         if (!av.getColumnSelection().isVisible(index))
+        {
           continue;
+        }
 
         if (anot[index] == null)
         {
@@ -314,7 +342,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
         int index = av.getColumnSelection().columnAt(i);
 
         if (!av.getColumnSelection().isVisible(index))
+        {
           continue;
+        }
 
         if (anot[index] == null)
         {
@@ -373,14 +403,18 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
         int index = av.getColumnSelection().columnAt(i);
 
         if (!av.getColumnSelection().isVisible(index))
+        {
           continue;
+        }
 
         if (anot[index] == null)
         {
           anot[index] = new Annotation(label, "", type, 0);
         }
 
-        anot[index].secondaryStructure = type;
+        
+        anot[index].secondaryStructure = type != 'S' ? type : label
+                .length() == 0 ? ' ' : label.charAt(0);
         anot[index].displayCharacter = label;
 
       }
@@ -406,7 +440,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       int index = columnSelection.columnAt(i);
       // always check for current display state - just in case
       if (!viscols.isVisible(index))
+      {
         continue;
+      }
       String tlabel = null;
       if (anot[index] != null)
       { // LML added stem code
@@ -765,7 +801,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
     }
     imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
     if (imgWidth < 1)
+    {
       return;
+    }
     if (image == null || imgWidth != image.getWidth(this)
             || image.getHeight(this) != getHeight())
     {
@@ -984,6 +1022,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI,
       return bounds;
     }
     else
+    {
       return null;
+    }
   }
 }
index 77af496..387bb7f 100755 (executable)
@@ -1753,7 +1753,7 @@ public class GAlignFrame extends JInternalFrame
     sortByAnnotScore.setText(MessageManager
             .getString("label.sort_by_score"));
     sort.add(sortByAnnotScore);
-    sortByAnnotScore.addMenuListener(new javax.swing.event.MenuListener()
+    sort.addMenuListener(new javax.swing.event.MenuListener()
     {
 
       @Override
index ef77e4d..3cada8b 100755 (executable)
@@ -53,33 +53,6 @@ public class AnnotationColourGradient extends FollowerColourScheme
   private boolean predefinedColours = false;
 
   private boolean seqAssociated = false;
-  Color rnaHelices[] = null;
-  private void initRnaHelicesShading(int n)
-  {
-    int j = 0;
-    if (rnaHelices==null) 
-    {
-      rnaHelices = new Color[n + 1];
-    }
-    else
-    if (rnaHelices != null && rnaHelices.length <= n)
-    {
-      Color[] t = new Color[n + 1];
-      System.arraycopy(rnaHelices, 0, t, 0, rnaHelices.length);
-      j = rnaHelices.length;
-      rnaHelices = t;
-    }
-    else
-    {
-      return;
-    }
-    // Generate random colors and store
-    for (; j <= n; j++)
-    {
-      rnaHelices[j] = jalview.util.ColorUtils
-              .generateRandomColor(Color.white);
-    }
-  }
   /**
    * false if the scheme was constructed without a minColour and maxColour used
    * to decide if existing colours should be taken from annotation elements when
@@ -171,7 +144,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
     aamin = annotation.graphMin;
     if (annotation.isRNA())
     {
-      initRnaHelicesShading(1 + (int) aamax);
+      ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
     }
   }
 
@@ -220,7 +193,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
       }
       if (rna)
       {
-        initRnaHelicesShading(1 + (int) aamax);
+        ColourSchemeProperty.initRnaHelicesShading(1 + (int) aamax);
       }
     }
   }
@@ -331,7 +304,7 @@ public class AnnotationColourGradient extends FollowerColourScheme
               {
                 if (annotation.isRNA())
                 {
-                  currentColour = rnaHelices[(int) aj.value];
+                  currentColour = ColourSchemeProperty.rnaHelices[(int) aj.value];
                 }
                 else
                 {
index cc303d6..57a2dd9 100755 (executable)
@@ -597,4 +597,33 @@ public class ColourSchemeProperty
 
     return col;
   }
+
+  public static Color rnaHelices[] = null;
+
+  public static void initRnaHelicesShading(int n)
+  {
+    int j = 0;
+    if (rnaHelices == null)
+    {
+      rnaHelices = new Color[n + 1];
+    }
+    else if (rnaHelices != null && rnaHelices.length <= n)
+    {
+      Color[] t = new Color[n + 1];
+      System.arraycopy(rnaHelices, 0, t, 0, rnaHelices.length);
+      j = rnaHelices.length;
+      rnaHelices = t;
+    }
+    else
+    {
+      return;
+    }
+    // Generate random colors and store
+    for (; j <= n; j++)
+    {
+      rnaHelices[j] = jalview.util.ColorUtils
+              .generateRandomColor(Color.white);
+    }
+  }
+
 }