X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fappletgui%2FAnnotationPanel.java;h=a941ef27109d3c77e1af8452db97ef967e6b9ab9;hb=9eeb330290cb6227c1774b5a51ae1981a6187141;hp=f068a3cc35405cd9af13cf73ac7910a6536e0d5a;hpb=4e6c8d302a9df7012789e755e23d7a9b3f5d35bf;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index f068a3c..a941ef2 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -41,19 +41,24 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen Vector activeRes; - static String HELIX = "Helix"; + final String HELIX = "Helix"; - static String SHEET = "Sheet"; + final String SHEET = "Sheet"; + + /** + * For RNA secondary structure "stems" aka helices + */ + final String STEM = "RNA Helix"; - static String LABEL = "Label"; + final String LABEL = "Label"; - static String REMOVE = "Remove Annotation"; + final String REMOVE = "Remove Annotation"; - static String COLOUR = "Colour"; + final String COLOUR = "Colour"; - static Color HELIX_COLOUR = Color.red.darker(); + final Color HELIX_COLOUR = Color.red.darker(); - static Color SHEET_COLOUR = Color.green.darker().darker(); + final Color SHEET_COLOUR = Color.green.darker().darker(); Image image; @@ -113,7 +118,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen */ public void actionPerformed(ActionEvent evt) { - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); if (aa == null) { return; @@ -129,8 +134,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen } String label = ""; - if (av.colSel != null && av.colSel.size() > 0 - && anot[av.colSel.getMin()] != null) + if (av.getColumnSelection() != null && av.getColumnSelection().size() > 0 + && anot[av.getColumnSelection().getMin()] != null) label = anot[av.getColumnSelection().getMin()].displayCharacter; if (evt.getActionCommand().equals(REMOVE)) @@ -158,7 +163,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen { int index = av.getColumnSelection().columnAt(i); - if (!av.colSel.isVisible(index)) + if (!av.getColumnSelection().isVisible(index)) continue; if (anot[index] == null) @@ -180,7 +185,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen { int index = av.getColumnSelection().columnAt(i); - if (!av.colSel.isVisible(index)) + if (!av.getColumnSelection().isVisible(index)) continue; if (anot[index] == null) @@ -207,6 +212,13 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen symbol = "\u03B2"; } + // Added by LML to color stems + else if (evt.getActionCommand().equals(STEM)) + { + type = 'S'; + symbol = "\u03C3"; + } + if (!aa[activeRow].hasIcons) { aa[activeRow].hasIcons = true; @@ -228,7 +240,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen { int index = av.getColumnSelection().columnAt(i); - if (!av.colSel.isVisible(index)) + if (!av.getColumnSelection().isVisible(index)) continue; if (anot[index] == null) @@ -241,6 +253,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen } } + aa[activeRow].validateRangeAndDisplay(); + adjustPanelHeight(); repaint(); @@ -260,7 +274,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen public void mousePressed(MouseEvent evt) { - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); if (aa == null) { return; @@ -302,12 +316,23 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen } PopupMenu pop = new PopupMenu("Structure type"); - MenuItem item = new MenuItem(HELIX); - item.addActionListener(this); - pop.add(item); - item = new MenuItem(SHEET); - item.addActionListener(this); - pop.add(item); + MenuItem item; + /* + * Just display the needed structure options + */ + if (av.getAlignment().isNucleotide() == true) + { + item = new MenuItem(STEM); + item.addActionListener(this); + pop.add(item); + } else { + item = new MenuItem(HELIX); + item.addActionListener(this); + pop.add(item); + item = new MenuItem(SHEET); + item.addActionListener(this); + pop.add(item); + } item = new MenuItem(LABEL); item.addActionListener(this); pop.add(item); @@ -354,11 +379,11 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen { if (graphStretch > -1) { - av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY + av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - evt.getY(); - if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0) + if (av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight < 0) { - av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0; + av.getAlignment().getAlignmentAnnotation()[graphStretch].graphHeight = 0; } graphStretchY = evt.getY(); calcPanelHeight(); @@ -373,7 +398,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen public void mouseMoved(MouseEvent evt) { - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); if (aa == null) { return; @@ -398,7 +423,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen int res = evt.getX() / av.getCharWidth() + av.getStartRes(); - if (av.hasHiddenColumns) + if (av.hasHiddenColumns()) { res = av.getColumnSelection().adjustForHiddenColumns(res); } @@ -448,7 +473,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen public int calcPanelHeight() { // setHeight of panels - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); int height = 0; if (aa != null) @@ -498,7 +523,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen { if (activeRow == -1) { - AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); if (aa == null) { return; @@ -563,8 +588,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen public void fastPaint(int horizontal) { - if (horizontal == 0 || av.alignment.getAlignmentAnnotation() == null - || av.alignment.getAlignmentAnnotation().length < 1) + if (horizontal == 0 || av.getAlignment().getAlignmentAnnotation() == null + || av.getAlignment().getAlignmentAnnotation().length < 1) { repaint(); return; @@ -617,8 +642,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, Adjustmen fm = g.getFontMetrics(); } - if ((av.alignment.getAlignmentAnnotation() == null) - || (av.alignment.getAlignmentAnnotation().length < 1)) + if ((av.getAlignment().getAlignmentAnnotation() == null) + || (av.getAlignment().getAlignmentAnnotation().length < 1)) { g.setColor(Color.white); g.fillRect(0, 0, getSize().width, getSize().height);