From 5019d046ada4f11d4273f8e826961a90b4405947 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 23 Nov 2014 20:18:05 +0000 Subject: [PATCH] JAL-1569 interactive editing of secondary structure char for RNA secondary structure --- src/jalview/appletgui/AnnotationPanel.java | 4 +- src/jalview/gui/AnnotationPanel.java | 56 ++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 4b9fa67..22996f7 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -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; } } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 4adeb83..9f56206 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -20,17 +20,43 @@ */ 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; + } } } -- 1.7.10.2