X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fjbgui%2FGAlignFrame.java;h=5e60a858869824b6a3b427a87280c5af15bca0e1;hb=ec493e27abc6b3be84b3c8a873c295a3f589bd53;hp=3b8568c0d05a699b054a1352e4bd36622ab29032;hpb=76d3286a73053be49a8cfd6842fffba4db111e08;p=jalview.git diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 3b8568c..5e60a85 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -20,6 +20,8 @@ */ package jalview.jbgui; +import jalview.bin.Cache; +import jalview.gui.JvSwingUtils; import jalview.schemes.ColourSchemeProperty; import jalview.util.MessageManager; @@ -63,6 +65,8 @@ public class GAlignFrame extends JInternalFrame protected JMenu viewMenu = new JMenu(); + protected JMenu annotationsMenu = new JMenu(); + protected JMenu colourMenu = new JMenu(); protected JMenu calculateMenu = new JMenu(); @@ -186,8 +190,6 @@ public class GAlignFrame extends JInternalFrame public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem(); - JMenuItem chooseAnnotations = new JMenuItem(); - JMenuItem deleteGroups = new JMenuItem(); JMenuItem createGroup = new JMenuItem(); @@ -304,6 +306,14 @@ public class GAlignFrame extends JInternalFrame JMenuItem showAllhidden = new JMenuItem(); + protected JMenuItem showAllAnnotations = new JMenuItem(); + + protected JMenuItem hideAllAnnotations = new JMenuItem(); + + protected JMenuItem sortAnnBySequence = new JMenuItem(); + + protected JMenuItem sortAnnByType = new JMenuItem(); + protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem(); JMenuItem invertColSel = new JMenuItem(); @@ -384,6 +394,7 @@ public class GAlignFrame extends JInternalFrame } } catch (Exception e) { + System.err.println(e.toString()); } if (!new jalview.util.Platform().isAMac()) @@ -606,6 +617,7 @@ public class GAlignFrame extends JInternalFrame }); editMenu.setText(MessageManager.getString("action.edit")); viewMenu.setText(MessageManager.getString("action.view")); + annotationsMenu.setText(MessageManager.getString("action.annotations")); colourMenu.setText(MessageManager.getString("action.colour")); calculateMenu.setText(MessageManager.getString("action.calculate")); webService.setText(MessageManager.getString("action.web_service")); @@ -824,7 +836,7 @@ public class GAlignFrame extends JInternalFrame } }); removeRedundancyMenuItem.setText(MessageManager - .getString("action.remove_redundancy")); + .getString("action.remove_redundancy").concat("...")); removeRedundancyMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_D, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -1058,17 +1070,61 @@ 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(); + } + }); + sortAnnBySequence.setText(MessageManager + .getString("label.sort_annotations_by_sequence")); + sortAnnBySequence.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + sortAnnotationsBySequence_actionPerformed(); + } + }); + sortAnnByType.setText(MessageManager + .getString("label.sort_annotations_by_type")); + sortAnnByType.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent e) + { + sortAnnotationsByType_actionPerformed(); + } + }); colourTextMenuItem.setText(MessageManager .getString("label.colour_text")); colourTextMenuItem @@ -1182,6 +1238,8 @@ public class GAlignFrame extends JInternalFrame findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_F, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask(), false)); + findMenuItem.setToolTipText(JvSwingUtils.wrapTooltip(true, + MessageManager.getString("label.find_tip"))); findMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override @@ -1210,16 +1268,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 @@ -1412,8 +1460,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 @@ -1921,7 +1967,6 @@ public class GAlignFrame extends JInternalFrame showAllhidden_actionPerformed(e); } }); - hiddenMarkers.setText(MessageManager .getString("action.show_hidden_markers")); hiddenMarkers.addActionListener(new ActionListener() @@ -2083,6 +2128,7 @@ public class GAlignFrame extends JInternalFrame alignFrameMenuBar.add(editMenu); alignFrameMenuBar.add(selectMenu); alignFrameMenuBar.add(viewMenu); + alignFrameMenuBar.add(annotationsMenu); alignFrameMenuBar.add(formatMenu); alignFrameMenuBar.add(colourMenu); alignFrameMenuBar.add(calculateMenu); @@ -2132,7 +2178,11 @@ public class GAlignFrame extends JInternalFrame viewMenu.add(hideMenu); viewMenu.addSeparator(); viewMenu.add(followHighlightMenuItem); - viewMenu.add(annotationPanelMenuItem); + annotationsMenu.add(annotationPanelMenuItem); + annotationsMenu.add(showAllAnnotations); + annotationsMenu.add(hideAllAnnotations); + annotationsMenu.add(sortAnnBySequence); + annotationsMenu.add(sortAnnByType); autoAnnMenu.add(applyAutoAnnotationSettings); autoAnnMenu.add(showConsensusHistogram); autoAnnMenu.add(showSequenceLogo); @@ -2140,10 +2190,9 @@ public class GAlignFrame extends JInternalFrame autoAnnMenu.addSeparator(); autoAnnMenu.add(showGroupConservation); autoAnnMenu.add(showGroupConsensus); - viewMenu.add(autoAnnMenu); + annotationsMenu.add(autoAnnMenu); viewMenu.addSeparator(); viewMenu.add(showSeqFeatures); - viewMenu.add(chooseAnnotations); // viewMenu.add(showSeqFeaturesHeight); viewMenu.add(openFeatureSettings); @@ -2253,9 +2302,41 @@ public class GAlignFrame extends JInternalFrame } /** - * Action on menu item "Show/hide sequence annotations..." + * Action on clicking sort annotations by type. + */ + protected void sortAnnotationsByType_actionPerformed() + { + } + + /** + * Action on clicking sort annotations by sequence + */ + protected void sortAnnotationsBySequence_actionPerformed() + { + } + + /** + * Action on clicking Show all annotations. + */ + protected void showAllAnnotations_actionPerformed() + { + setAllAnnotationsVisibility(true); + } + + /** + * Action on clicking Hide all annotations. + */ + protected void hideAllAnnotations_actionPerformed() + { + setAllAnnotationsVisibility(false); + } + + /** + * Set the visibility of all annotations to true or false. + * + * @param visible */ - protected void chooseAnnotations_actionPerformed() + protected void setAllAnnotationsVisibility(boolean visible) { }