From b9fbdac95abae11673f09be76494032ec0bbca74 Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 24 Sep 2012 17:51:26 +0100 Subject: [PATCH] JAL-958 normalise logo menu options in applet --- src/jalview/appletgui/AlignFrame.java | 21 ++++++++++++++ src/jalview/appletgui/AnnotationLabels.java | 42 +++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 4948613..9fe2456 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -133,6 +133,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis showGroupConservation.setState(viewport.isShowGroupConservation()); showConsensusHistogram.setState(viewport.isShowConsensusHistogram()); showSequenceLogo.setState(viewport.isShowSequenceLogo()); + normSequenceLogo.setState(viewport.isNormaliseSequenceLogo()); seqLimits.setState(viewport.showJVSuffix); @@ -719,6 +720,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis { showSequenceLogo_actionPerformed(); } + else if (evt.getSource() == normSequenceLogo) + { + normSequenceLogo_actionPerformed(); + } else if (evt.getSource() == showConsensusHistogram) { showConsensusHistogram_actionPerformed(); @@ -929,6 +934,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis { showSequenceLogo_actionPerformed(); } + else if (source == normSequenceLogo) + { + normSequenceLogo_actionPerformed(); + } else if (source == showConsensusHistogram) { showConsensusHistogram_actionPerformed(); @@ -1833,6 +1842,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis viewport.setShowSequenceLogo(showSequenceLogo.getState()); alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); } + protected void normSequenceLogo_actionPerformed() + { + showSequenceLogo.setState(true); + viewport.setShowSequenceLogo(true); + viewport.setNormaliseSequenceLogo(normSequenceLogo.getState()); + alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); + } protected void applyAutoAnnotationSettings_actionPerformed() { @@ -2878,6 +2894,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem(); CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem(); CheckboxMenuItem showGroupConservation = new CheckboxMenuItem(); + CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem(); private void jbInit() throws Exception { @@ -3093,6 +3110,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis showGroupConservation.setLabel("Group Conservation"); showConsensusHistogram.setLabel("Show Consensus Histogram"); showSequenceLogo.setLabel("Show Consensus Logo"); + normSequenceLogo.setLabel("Normalise Consensus Logo"); applyAutoAnnotationSettings.setLabel("Apply to all groups"); applyAutoAnnotationSettings.setState(true); autoAnnMenu.setLabel("Autocalculated Annotation"); @@ -3109,6 +3127,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis showGroupConservation.addItemListener(this); showConsensusHistogram.addItemListener(this); showSequenceLogo.addItemListener(this); + normSequenceLogo.addItemListener(this); + applyAutoAnnotationSettings.addItemListener(this); formatMenu.setLabel("Format"); selectMenu.setLabel("Select"); @@ -3162,6 +3182,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemLis autoAnnMenu.add(applyAutoAnnotationSettings); autoAnnMenu.add(showConsensusHistogram); autoAnnMenu.add(showSequenceLogo); + autoAnnMenu.add(normSequenceLogo); autoAnnMenu.addSeparator(); autoAnnMenu.add(showGroupConservation); autoAnnMenu.add(showGroupConsensus); diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index 5393b07..03b4ed1 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -505,7 +505,27 @@ 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 +542,7 @@ 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 +561,32 @@ 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); -- 1.7.10.2