dont show redundant menuitems
authoramwaterhouse <Andrew Waterhouse>
Thu, 19 May 2005 17:54:30 +0000 (17:54 +0000)
committeramwaterhouse <Andrew Waterhouse>
Thu, 19 May 2005 17:54:30 +0000 (17:54 +0000)
src/jalview/gui/PopupMenu.java

index aed4a33..66b29a0 100755 (executable)
@@ -12,10 +12,7 @@ import MCview.*;
 public class PopupMenu extends JPopupMenu\r
 {\r
   JMenu groupMenu = new JMenu();\r
-  JMenuItem analyze = new JMenuItem();\r
-  JMenu defineMenu = new JMenu();\r
   JMenuItem groupName = new JMenuItem();\r
-  JMenuItem groupAnnotation = new JMenuItem();\r
   protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
@@ -35,9 +32,6 @@ public class PopupMenu extends JPopupMenu
   AlignmentPanel ap;\r
   JMenu sequenceMenu = new JMenu();\r
   JMenuItem sequenceName = new JMenuItem();\r
-  JMenu residueMenu = new JMenu();\r
-  JMenuItem annotateResidue = new JMenuItem();\r
-\r
   Sequence sequence;\r
   JMenuItem unGroupMenuItem = new JMenuItem();\r
   JMenuItem pdbMenuItem = new JMenuItem();\r
@@ -109,25 +103,17 @@ public class PopupMenu extends JPopupMenu
         conservationMenuItem.setSelected(true);\r
     }\r
 \r
+    if( !ap.av.alignment.getGroups().contains(sg))\r
+        unGroupMenuItem.setVisible(false);\r
 \r
-    if(seq!=null)\r
-      residueMenu.setVisible(false);\r
-    else\r
-      sequenceMenu.setVisible(false);\r
+    if(seq==null)\r
+       sequenceMenu.setVisible(false);\r
 \r
   }\r
   private void jbInit() throws Exception\r
   {\r
     groupMenu.setText("Group");\r
-    analyze.setText("Analyze");\r
-    analyze.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        analyze_actionPerformed(e);\r
-      }\r
-    });\r
-    defineMenu.setText("Define");\r
+    groupMenu.setText("Define");\r
     groupName.setText("Name");\r
     groupName.addActionListener(new java.awt.event.ActionListener()\r
     {\r
@@ -136,15 +122,6 @@ public class PopupMenu extends JPopupMenu
         groupName_actionPerformed(e);\r
       }\r
     });\r
-    groupAnnotation.setEnabled(false);\r
-    groupAnnotation.setText("Annotation");\r
-    groupAnnotation.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        groupAnnotation_actionPerformed(e);\r
-      }\r
-    });\r
     sequenceMenu.setText("Sequence");\r
     sequenceName.setText("Edit name");\r
     sequenceName.addActionListener(new java.awt.event.ActionListener()\r
@@ -154,10 +131,6 @@ public class PopupMenu extends JPopupMenu
         sequenceName_actionPerformed(e);\r
       }\r
     });\r
-    residueMenu.setText("Residue");\r
-    annotateResidue.setEnabled(false);\r
-    annotateResidue.setActionCommand("annotate residue");\r
-    annotateResidue.setText("annotate residue???");\r
     PIDColour.setFocusPainted(false);\r
     unGroupMenuItem.setText("Remove Group");\r
     unGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
@@ -192,41 +165,35 @@ public class PopupMenu extends JPopupMenu
       }\r
     });\r
     add(groupMenu);\r
-    this.add(sequenceMenu);\r
-    this.add(residueMenu);\r
-    groupMenu.add(defineMenu);\r
+    add(sequenceMenu);\r
+    groupMenu.add(groupName);\r
+    groupMenu.addSeparator();\r
     groupMenu.add(unGroupMenuItem);\r
     groupMenu.addSeparator();\r
-    groupMenu.add(analyze);\r
-    defineMenu.add(groupName);\r
-    defineMenu.add(groupAnnotation);\r
-    defineMenu.addSeparator();\r
-    defineMenu.add(outline);\r
-    defineMenu.addSeparator();\r
-    defineMenu.add(noColourmenuItem);\r
-    defineMenu.add(clustalColour);\r
-    defineMenu.add(BLOSUM62Colour);\r
-    defineMenu.add(PIDColour);\r
-\r
-    defineMenu.add(zappoColour);\r
-    defineMenu.add(taylorColour);\r
-    defineMenu.add(hydrophobicityColour);\r
-    defineMenu.add(helixColour);\r
-    defineMenu.add(strandColour);\r
-    defineMenu.add(turnColour);\r
-    defineMenu.add(buriedColour);\r
-    defineMenu.add(nucleotideMenuItem);\r
-\r
-    defineMenu.add(userDefinedColour);\r
-\r
-    defineMenu.addSeparator();\r
-    defineMenu.add(abovePIDColour);\r
-    defineMenu.add(conservationMenuItem);\r
+    groupMenu.add(outline);\r
+    groupMenu.addSeparator();\r
+    groupMenu.add(noColourmenuItem);\r
+    groupMenu.add(clustalColour);\r
+    groupMenu.add(BLOSUM62Colour);\r
+    groupMenu.add(PIDColour);\r
+\r
+    groupMenu.add(zappoColour);\r
+    groupMenu.add(taylorColour);\r
+    groupMenu.add(hydrophobicityColour);\r
+    groupMenu.add(helixColour);\r
+    groupMenu.add(strandColour);\r
+    groupMenu.add(turnColour);\r
+    groupMenu.add(buriedColour);\r
+    groupMenu.add(nucleotideMenuItem);\r
+\r
+    groupMenu.add(userDefinedColour);\r
+\r
+    groupMenu.addSeparator();\r
+    groupMenu.add(abovePIDColour);\r
+    groupMenu.add(conservationMenuItem);\r
 \r
     sequenceMenu.add(sequenceName);\r
     sequenceMenu.add(pdbMenuItem);\r
-    residueMenu.add(annotateResidue);\r
-\r
     noColourmenuItem.setText("None");\r
     noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
     {\r
@@ -609,6 +576,7 @@ public class PopupMenu extends JPopupMenu
     Color col = JColorChooser.showDialog(this, "Select Outline Colour", Color.BLUE);\r
     if(col!=null)\r
       sg.setOutlineColour(col);\r
+    ap.repaint();\r
   }\r
 \r
 }\r