From: gmungoc Date: Fri, 3 Oct 2014 11:08:09 +0000 (+0100) Subject: JAL-1264 show/hide annotations; JAL-1481 Find tooltip X-Git-Tag: Jalview_2_9~169^2~22^2~20 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=2a7662654294c090754af3eab70f1b65fcf36a14;p=jalview.git JAL-1264 show/hide annotations; JAL-1481 Find tooltip --- diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 0fad6cf..edda142 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -20,6 +20,7 @@ */ package jalview.jbgui; +import jalview.bin.Cache; import jalview.schemes.ColourSchemeProperty; import jalview.util.MessageManager; @@ -186,8 +187,6 @@ public class GAlignFrame extends JInternalFrame public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem(); - JMenuItem chooseAnnotations = new JMenuItem(); - JMenuItem deleteGroups = new JMenuItem(); JMenuItem createGroup = new JMenuItem(); @@ -304,9 +303,9 @@ public class GAlignFrame extends JInternalFrame JMenuItem showAllhidden = new JMenuItem(); - protected JMenu showAnnotations = new JMenu(); + protected JMenuItem showAllAnnotations = new JMenuItem(); - protected JMenu hideAnnotations = new JMenu(); + protected JMenuItem hideAllAnnotations = new JMenuItem(); protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem(); @@ -1063,17 +1062,41 @@ public class GAlignFrame extends JInternalFrame annotationPanelMenuItem.setActionCommand(""); annotationPanelMenuItem.setText(MessageManager .getString("label.show_annotations")); - annotationPanelMenuItem.setState(jalview.bin.Cache.getDefault( - "SHOW_ANNOTATIONS", true)); - annotationPanelMenuItem - .addActionListener(new java.awt.event.ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - annotationPanelMenuItem_actionPerformed(e); - } - }); + annotationPanelMenuItem.setState(Cache.getDefault("SHOW_ANNOTATIONS", + true)); + annotationPanelMenuItem.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + annotationPanelMenuItem_actionPerformed(e); + } + }); + /* + * Show/hide all annotations only enabled if annotation panel is shown + */ + showAllAnnotations.setText(MessageManager + .getString("label.show_all_annotations")); + showAllAnnotations.setEnabled(annotationPanelMenuItem.getState()); + showAllAnnotations.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + showAllAnnotations_actionPerformed(); + } + }); + hideAllAnnotations.setText(MessageManager + .getString("label.hide_all_annotations")); + hideAllAnnotations.setEnabled(annotationPanelMenuItem.getState()); + hideAllAnnotations.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + hideAllAnnotations_actionPerformed(); + } + }); colourTextMenuItem.setText(MessageManager .getString("label.colour_text")); colourTextMenuItem @@ -1187,6 +1210,7 @@ public class GAlignFrame extends JInternalFrame findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_F, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask(), false)); + findMenuItem.setToolTipText(MessageManager.getString("label.find_tip")); findMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override @@ -1215,16 +1239,6 @@ public class GAlignFrame extends JInternalFrame showSeqFeatures_actionPerformed(actionEvent); } }); - chooseAnnotations.setText(MessageManager - .getString("label.choose_annotations") + "..."); - chooseAnnotations.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent actionEvent) - { - chooseAnnotations_actionPerformed(); - } - }); /* * showSeqFeaturesHeight.setText("Vary Sequence Feature Height"); * showSeqFeaturesHeight.addActionListener(new ActionListener() { public @@ -1417,8 +1431,6 @@ public class GAlignFrame extends JInternalFrame } }); delete.setText(MessageManager.getString("action.delete")); - delete.setAccelerator(javax.swing.KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_BACK_SPACE, 0, false)); delete.addActionListener(new java.awt.event.ActionListener() { @Override @@ -1926,25 +1938,6 @@ public class GAlignFrame extends JInternalFrame showAllhidden_actionPerformed(e); } }); - showAnnotations.setText(MessageManager.getString("label.annotations")); - showAnnotations.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - buildShowHideAnnotationMenus(); - } - }); - hideAnnotations.setText(MessageManager.getString("label.annotations")); - hideAnnotations.addMouseListener(new MouseAdapter() - { - @Override - public void mouseEntered(MouseEvent e) - { - buildShowHideAnnotationMenus(); - } - }); - hiddenMarkers.setText(MessageManager .getString("action.show_hidden_markers")); hiddenMarkers.addActionListener(new ActionListener() @@ -2156,6 +2149,8 @@ public class GAlignFrame extends JInternalFrame viewMenu.addSeparator(); viewMenu.add(followHighlightMenuItem); viewMenu.add(annotationPanelMenuItem); + viewMenu.add(showAllAnnotations); + viewMenu.add(hideAllAnnotations); autoAnnMenu.add(applyAutoAnnotationSettings); autoAnnMenu.add(showConsensusHistogram); autoAnnMenu.add(showSequenceLogo); @@ -2166,7 +2161,6 @@ public class GAlignFrame extends JInternalFrame viewMenu.add(autoAnnMenu); viewMenu.addSeparator(); viewMenu.add(showSeqFeatures); - viewMenu.add(chooseAnnotations); // viewMenu.add(showSeqFeaturesHeight); viewMenu.add(openFeatureSettings); @@ -2238,12 +2232,10 @@ public class GAlignFrame extends JInternalFrame jMenu3.add(showAllColumns); jMenu3.add(showAllSeqs); jMenu3.add(showAllhidden); - jMenu3.add(showAnnotations); hideMenu.add(hideSelColumns); hideMenu.add(hideSelSequences); hideMenu.add(hideAllSelection); hideMenu.add(hideAllButSelection); - hideMenu.add(hideAnnotations); formatMenu.add(font); formatMenu.addSeparator(); @@ -2278,20 +2270,27 @@ public class GAlignFrame extends JInternalFrame } /** - * Dynamically build list of annotation types to show or hide. + * Action on clicking Show all annotations. */ - protected void buildShowHideAnnotationMenus() + protected void showAllAnnotations_actionPerformed() { + setAllAnnotationsVisibility(true); } - protected void showHideAnnotation_actionPerformed(String type, boolean b) + /** + * Action on clicking Hide all annotations. + */ + protected void hideAllAnnotations_actionPerformed() { + setAllAnnotationsVisibility(false); } /** - * Action on menu item "Show/hide sequence annotations..." + * Set the visibility of all annotations to true or false. + * + * @param visible */ - protected void chooseAnnotations_actionPerformed() + protected void setAllAnnotationsVisibility(boolean visible) { }