X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAnnotationLabels.java;h=3d54ae1b429067d07ae13e8310a8d34f9f427f64;hb=4608f763ad15fdb8b093d205985fb3b4d7077471;hp=635535c052cdbfe21a5b5429f4300010066c6757;hpb=d053a3c980cf4318b9a19a255f9fc870e74de989;p=jalview.git diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 635535c..3d54ae1 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -1,13 +1,13 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) + * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR @@ -21,7 +21,6 @@ import java.util.*; import java.awt.*; import java.awt.event.*; -import java.awt.image.BufferedImage; import jalview.datamodel.*; import jalview.util.ParseHtmlBodyAndLinks; @@ -107,7 +106,8 @@ public class AnnotationLabels extends Panel implements ActionListener, int getSelectedRow(int y) { int row = -2; - AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] aa = ap.av.getAlignment() + .getAlignmentAnnotation(); if (aa == null) { @@ -228,7 +228,10 @@ public class AnnotationLabels extends Panel implements ActionListener, if (row > -1) { - ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks(av.getAlignment().getAlignmentAnnotation()[row].getDescription(true), true, "\n"); + ParseHtmlBodyAndLinks phb = new ParseHtmlBodyAndLinks( + av.getAlignment().getAlignmentAnnotation()[row] + .getDescription(true), + true, "\n"); if (tooltip == null) { tooltip = new Tooltip(phb.getNonHtmlContent(), this); @@ -290,7 +293,7 @@ public class AnnotationLabels extends Panel implements ActionListener, ap.annotationPanelHolder.setSize(new Dimension(d.width, d.height - dif)); ap.apvscroll.setValues(ap.apvscroll.getValue(), d.height - dif, 0, - ap.annotationPanel.calcPanelHeight()); + av.calcPanelHeight()); f.height += dif; ap.seqPanelHolder.setPreferredSize(f); ap.setScrollValues(av.getStartRes(), av.getStartSeq()); @@ -334,7 +337,7 @@ public class AnnotationLabels extends Panel implements ActionListener, int end = getSelectedRow(evt.getY() + scrollOffset); - if (start>-1 && start != end) + if (start > -1 && start != end) { // Swap these annotations AlignmentAnnotation startAA = ap.av.getAlignment() @@ -391,11 +394,12 @@ public class AnnotationLabels extends Panel implements ActionListener, { return; } - dragCancelled=false; + dragCancelled = false; // todo: move below to mouseClicked ? selectedRow = getSelectedRow(evt.getY() + scrollOffset); - AlignmentAnnotation[] aa = ap.av.getAlignment().getAlignmentAnnotation(); + AlignmentAnnotation[] aa = ap.av.getAlignment() + .getAlignmentAnnotation(); // DETECT RIGHT MOUSE BUTTON IN AWT if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) @@ -505,7 +509,28 @@ public class AnnotationLabels extends Panel implements ActionListener, // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); } }); + popup.add(cprofl); + final CheckboxMenuItem cprofn = new CheckboxMenuItem( + "Normalise Group Logo", + aa[selectedRow].groupRef.isNormaliseSequenceLogo()); + cprofn.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + aaa.groupRef.setshowSequenceLogo(true); + aaa.groupRef.setNormaliseSequenceLogo(cprofn.getState()); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + popup.add(cprofn); } else { @@ -522,6 +547,10 @@ public class AnnotationLabels extends Panel implements ActionListener, // can be // updated. av.setShowConsensusHistogram(chist.getState()); + ap.alignFrame.showConsensusHistogram.setState(chist + .getState()); // TODO: implement + // ap.updateGUI()/alignFrame.updateGUI + // for applet ap.repaint(); // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); } @@ -540,11 +569,40 @@ public class AnnotationLabels extends Panel implements ActionListener, // can be // updated. av.setShowSequenceLogo(cprof.getState()); + ap.alignFrame.showSequenceLogo.setState(cprof.getState()); // TODO: + // implement + // ap.updateGUI()/alignFrame.updateGUI + // for + // applet ap.repaint(); // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); } }); popup.add(cprof); + final CheckboxMenuItem cprofn = new CheckboxMenuItem( + "Normalise Logo", av.isNormaliseSequenceLogo()); + cprofn.addItemListener(new ItemListener() + { + public void itemStateChanged(ItemEvent e) + { + // TODO: pass on reference + // to ap + // so the + // view + // can be + // updated. + av.setShowSequenceLogo(true); + ap.alignFrame.normSequenceLogo.setState(cprofn.getState()); // TODO: + // implement + // ap.updateGUI()/alignFrame.updateGUI + // for + // applet + av.setNormaliseSequenceLogo(cprofn.getState()); + ap.repaint(); + // ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + popup.add(cprofn); } item = new MenuItem(COPYCONS_SEQ); @@ -646,7 +704,8 @@ public class AnnotationLabels extends Panel implements ActionListener, { int w = getSize().width; int h = getSize().height; - if (image == null || w != image.getWidth(this) || h!=image.getHeight(this) ) + if (image == null || w != image.getWidth(this) + || h != image.getHeight(this)) { image = createImage(w, ap.annotationPanel.getSize().height); } @@ -703,7 +762,7 @@ public class AnnotationLabels extends Panel implements ActionListener, dragEvent.getY()); } - if ((aa == null) || (aa.length < 1)) + if (!av.wrapAlignment && ((aa == null) || (aa.length < 1))) { g.setColor(Color.black); g.drawString("Right click", 2, 8);