From: jprocter Date: Thu, 3 Jun 2010 15:14:16 +0000 (+0000) Subject: patch re JAL-554 X-Git-Tag: Release_2_5_1~33 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=147f42322cf898d252a64cd4a5d24db35c618bd4;hp=ee5064ad5cba56f7b2423e8023e5c60204ba0878;p=jalview.git patch re JAL-554 --- diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 54b8a84..62ed93c 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -248,6 +248,13 @@ public class AnnotationLabels extends Panel implements ActionListener, MenuItem item = new MenuItem(ADDNEW); item.addActionListener(this); popup.add(item); + if (aa == null) + { + + popup.show(this, evt.getX(), evt.getY()); + return; + } + // add the rest if there are actually rows to show item = new MenuItem(EDITNAME); item.addActionListener(this); popup.add(item); diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 15b590e..e3ba18b 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -104,6 +104,10 @@ public class AnnotationPanel extends Panel implements AdjustmentListener, public void actionPerformed(ActionEvent evt) { AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + if (aa==null) + { + return; + } Annotation[] anot = aa[activeRow].annotations; if (anot.length < av.getColumnSelection().getMax()) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index 755b85a..f408400 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -199,6 +199,10 @@ public class AnnotationPanel extends JPanel implements MouseListener, public void actionPerformed(ActionEvent evt) { AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation(); + if (aa==null) + { + return; + } Annotation[] anot = aa[activeRow].annotations; if (anot.length < av.getColumnSelection().getMax()) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 4c40d2d..ba3cef2 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -2169,7 +2169,7 @@ public class Jalview2XML // newer files have an 'autoCalculated' flag and store calculation // state in viewport properties jaa.autoCalculated = true; // means annotation will be marked for - // update at end of load. + // update at end of load. } al.addAnnotation(jaa); } @@ -2698,85 +2698,91 @@ public class Jalview2XML else if (view.getBgColour().startsWith("Annotation")) { // int find annotation - for (int i = 0; i < af.viewport.alignment.getAlignmentAnnotation().length; i++) + if (af.viewport.alignment.getAlignmentAnnotation() != null) { - if (af.viewport.alignment.getAlignmentAnnotation()[i].label - .equals(view.getAnnotationColours().getAnnotation())) + for (int i = 0; i < af.viewport.alignment + .getAlignmentAnnotation().length; i++) { - if (af.viewport.alignment.getAlignmentAnnotation()[i] - .getThreshold() == null) + if (af.viewport.alignment.getAlignmentAnnotation()[i].label + .equals(view.getAnnotationColours().getAnnotation())) { - af.viewport.alignment.getAlignmentAnnotation()[i] - .setThreshold(new jalview.datamodel.GraphLine(view - .getAnnotationColours().getThreshold(), - "Threshold", java.awt.Color.black) - - ); - } + if (af.viewport.alignment.getAlignmentAnnotation()[i] + .getThreshold() == null) + { + af.viewport.alignment.getAlignmentAnnotation()[i] + .setThreshold(new jalview.datamodel.GraphLine(view + .getAnnotationColours().getThreshold(), + "Threshold", java.awt.Color.black) - if (view.getAnnotationColours().getColourScheme() - .equals("None")) - { - cs = new AnnotationColourGradient(af.viewport.alignment - .getAlignmentAnnotation()[i], new java.awt.Color(view - .getAnnotationColours().getMinColour()), - new java.awt.Color(view.getAnnotationColours() - .getMaxColour()), view.getAnnotationColours() - .getAboveThreshold()); - } - else if (view.getAnnotationColours().getColourScheme() - .startsWith("ucs")) - { - cs = new AnnotationColourGradient(af.viewport.alignment - .getAlignmentAnnotation()[i], GetUserColourScheme( - jms, view.getAnnotationColours().getColourScheme()), - view.getAnnotationColours().getAboveThreshold()); - } - else - { - cs = new AnnotationColourGradient(af.viewport.alignment - .getAlignmentAnnotation()[i], ColourSchemeProperty - .getColour(al, view.getAnnotationColours() - .getColourScheme()), view - .getAnnotationColours().getAboveThreshold()); - } + ); + } - // Also use these settings for all the groups - if (al.getGroups() != null) - { - for (int g = 0; g < al.getGroups().size(); g++) + if (view.getAnnotationColours().getColourScheme().equals( + "None")) + { + cs = new AnnotationColourGradient(af.viewport.alignment + .getAlignmentAnnotation()[i], new java.awt.Color( + view.getAnnotationColours().getMinColour()), + new java.awt.Color(view.getAnnotationColours() + .getMaxColour()), view + .getAnnotationColours().getAboveThreshold()); + } + else if (view.getAnnotationColours().getColourScheme() + .startsWith("ucs")) + { + cs = new AnnotationColourGradient(af.viewport.alignment + .getAlignmentAnnotation()[i], + GetUserColourScheme(jms, view + .getAnnotationColours().getColourScheme()), + view.getAnnotationColours().getAboveThreshold()); + } + else { - jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) al - .getGroups().elementAt(g); + cs = new AnnotationColourGradient(af.viewport.alignment + .getAlignmentAnnotation()[i], ColourSchemeProperty + .getColour(al, view.getAnnotationColours() + .getColourScheme()), view + .getAnnotationColours().getAboveThreshold()); + } - if (sg.cs == null) + // Also use these settings for all the groups + if (al.getGroups() != null) + { + for (int g = 0; g < al.getGroups().size(); g++) { - continue; - } + jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup) al + .getGroups().elementAt(g); - /* - * if - * (view.getAnnotationColours().getColourScheme().equals("None" - * )) { sg.cs = new AnnotationColourGradient( - * af.viewport.alignment.getAlignmentAnnotation()[i], new - * java.awt.Color(view.getAnnotationColours(). getMinColour()), - * new java.awt.Color(view.getAnnotationColours(). - * getMaxColour()), - * view.getAnnotationColours().getAboveThreshold()); } else - */ - { - sg.cs = new AnnotationColourGradient( - af.viewport.alignment.getAlignmentAnnotation()[i], - sg.cs, view.getAnnotationColours() - .getAboveThreshold()); - } + if (sg.cs == null) + { + continue; + } + + /* + * if + * (view.getAnnotationColours().getColourScheme().equals("None" + * )) { sg.cs = new AnnotationColourGradient( + * af.viewport.alignment.getAlignmentAnnotation()[i], new + * java.awt.Color(view.getAnnotationColours(). + * getMinColour()), new + * java.awt.Color(view.getAnnotationColours(). + * getMaxColour()), + * view.getAnnotationColours().getAboveThreshold()); } else + */ + { + sg.cs = new AnnotationColourGradient( + af.viewport.alignment.getAlignmentAnnotation()[i], + sg.cs, view.getAnnotationColours() + .getAboveThreshold()); + } + } } + + break; } - break; } - } } else