JAL-1569 interactive editing of secondary structure char for RNA secondary structure
authorJim Procter <jprocter@dundee.ac.uk>
Sun, 23 Nov 2014 20:18:05 +0000 (20:18 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Sun, 23 Nov 2014 20:18:05 +0000 (20:18 +0000)
src/jalview/appletgui/AnnotationPanel.java
src/jalview/gui/AnnotationPanel.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 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;
+    }
   }
 }