JAL-958 normalise logo menu options in applet
authorjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 24 Sep 2012 16:51:26 +0000 (17:51 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 24 Sep 2012 16:51:26 +0000 (17:51 +0100)
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/AnnotationLabels.java

index 4948613..9fe2456 100644 (file)
@@ -133,6 +133,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     showGroupConservation.setState(viewport.isShowGroupConservation());\r
     showConsensusHistogram.setState(viewport.isShowConsensusHistogram());\r
     showSequenceLogo.setState(viewport.isShowSequenceLogo());\r
+    normSequenceLogo.setState(viewport.isNormaliseSequenceLogo());\r
 \r
     seqLimits.setState(viewport.showJVSuffix);\r
 \r
@@ -719,6 +720,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     {\r
       showSequenceLogo_actionPerformed();\r
     }\r
+    else if (evt.getSource() == normSequenceLogo)\r
+    {\r
+      normSequenceLogo_actionPerformed();\r
+    }\r
     else if (evt.getSource() == showConsensusHistogram)\r
     {\r
       showConsensusHistogram_actionPerformed();\r
@@ -929,6 +934,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     {\r
       showSequenceLogo_actionPerformed();\r
     }\r
+    else if (source == normSequenceLogo)\r
+    {\r
+      normSequenceLogo_actionPerformed();\r
+    }\r
     else if (source == showConsensusHistogram)\r
     {\r
       showConsensusHistogram_actionPerformed();\r
@@ -1833,6 +1842,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     viewport.setShowSequenceLogo(showSequenceLogo.getState());\r
     alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
   }\r
+  protected void normSequenceLogo_actionPerformed()\r
+  {\r
+    showSequenceLogo.setState(true);\r
+    viewport.setShowSequenceLogo(true);\r
+    viewport.setNormaliseSequenceLogo(normSequenceLogo.getState());\r
+    alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState());\r
+  }\r
 \r
   protected void applyAutoAnnotationSettings_actionPerformed()\r
   {\r
@@ -2878,6 +2894,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
   CheckboxMenuItem showConsensusHistogram = new CheckboxMenuItem();\r
   CheckboxMenuItem showGroupConsensus = new CheckboxMenuItem();\r
   CheckboxMenuItem showGroupConservation = new CheckboxMenuItem();\r
+  CheckboxMenuItem normSequenceLogo = new CheckboxMenuItem();\r
 \r
   private void jbInit() throws Exception\r
   {\r
@@ -3093,6 +3110,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     showGroupConservation.setLabel("Group Conservation");\r
     showConsensusHistogram.setLabel("Show Consensus Histogram");\r
     showSequenceLogo.setLabel("Show Consensus Logo");\r
+    normSequenceLogo.setLabel("Normalise Consensus Logo");\r
     applyAutoAnnotationSettings.setLabel("Apply to all groups");\r
     applyAutoAnnotationSettings.setState(true);\r
     autoAnnMenu.setLabel("Autocalculated Annotation");\r
@@ -3109,6 +3127,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     showGroupConservation.addItemListener(this);\r
     showConsensusHistogram.addItemListener(this);\r
     showSequenceLogo.addItemListener(this);\r
+    normSequenceLogo.addItemListener(this);\r
+    \r
     applyAutoAnnotationSettings.addItemListener(this);\r
     formatMenu.setLabel("Format");\r
     selectMenu.setLabel("Select");\r
@@ -3162,6 +3182,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,  ItemLis
     autoAnnMenu.add(applyAutoAnnotationSettings);\r
     autoAnnMenu.add(showConsensusHistogram);\r
     autoAnnMenu.add(showSequenceLogo);\r
+    autoAnnMenu.add(normSequenceLogo);\r
     autoAnnMenu.addSeparator();\r
     autoAnnMenu.add(showGroupConservation);\r
     autoAnnMenu.add(showGroupConsensus);\r
index 5393b07..03b4ed1 100755 (executable)
@@ -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);