*/
package jalview.jbgui;
+import jalview.bin.Cache;
import jalview.schemes.ColourSchemeProperty;
import jalview.util.MessageManager;
public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
- JMenuItem chooseAnnotations = new JMenuItem();
-
JMenuItem deleteGroups = new JMenuItem();
JMenuItem createGroup = new JMenuItem();
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();
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
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
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
}
});
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
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()
viewMenu.addSeparator();
viewMenu.add(followHighlightMenuItem);
viewMenu.add(annotationPanelMenuItem);
+ viewMenu.add(showAllAnnotations);
+ viewMenu.add(hideAllAnnotations);
autoAnnMenu.add(applyAutoAnnotationSettings);
autoAnnMenu.add(showConsensusHistogram);
autoAnnMenu.add(showSequenceLogo);
viewMenu.add(autoAnnMenu);
viewMenu.addSeparator();
viewMenu.add(showSeqFeatures);
- viewMenu.add(chooseAnnotations);
// viewMenu.add(showSeqFeaturesHeight);
viewMenu.add(openFeatureSettings);
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();
}
/**
- * 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)
{
}