*/
package jalview.jbgui;
+import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
+import jalview.bin.Cache;
+import jalview.gui.JvSwingUtils;
+import jalview.gui.Preferences;
import jalview.schemes.ColourSchemeProperty;
import jalview.util.MessageManager;
protected JMenu viewMenu = new JMenu();
+ protected JMenu annotationsMenu = new JMenu();
+
protected JMenu colourMenu = new JMenu();
protected JMenu calculateMenu = new JMenu();
public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem();
- JMenuItem chooseAnnotations = new JMenuItem();
-
JMenuItem deleteGroups = new JMenuItem();
JMenuItem createGroup = new JMenuItem();
JMenuItem createPNG = new JMenuItem();
+ JMenuItem createBioJS = new JMenuItem();
+
+ JMenuItem createSVG = new JMenuItem();
+
protected JMenuItem font = new JMenuItem();
public JCheckBoxMenuItem seqLimits = new JCheckBoxMenuItem();
JMenuItem showAllhidden = new JMenuItem();
- protected JMenu showAnnotations = new JMenu();
+ protected JMenuItem showAllSeqAnnotations = new JMenuItem();
+
+ protected JMenuItem hideAllSeqAnnotations = new JMenuItem();
- protected JMenu hideAnnotations = new JMenu();
+ protected JMenuItem showAllAlAnnotations = new JMenuItem();
+
+ protected JMenuItem hideAllAlAnnotations = new JMenuItem();
+
+ protected JCheckBoxMenuItem sortAnnBySequence = new JCheckBoxMenuItem();
+
+ protected JCheckBoxMenuItem sortAnnByLabel = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem hiddenMarkers = new JCheckBoxMenuItem();
protected JCheckBoxMenuItem applyAutoAnnotationSettings = new JCheckBoxMenuItem();
+ protected JRadioButtonMenuItem showAutoFirst = new JRadioButtonMenuItem();
+
+ protected JRadioButtonMenuItem showAutoLast = new JRadioButtonMenuItem();
+
private JMenuItem grpsFromSelection = new JMenuItem();
+ private SequenceAnnotationOrder annotationSortOrder;
+
+ private boolean showAutoCalculatedAbove = false;
+
public GAlignFrame()
{
try
});
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"));
}
});
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));
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);
+ }
+ });
+ showAllAlAnnotations.setText(MessageManager
+ .getString("label.show_all_al_annotations"));
+ final boolean isAnnotationPanelShown = annotationPanelMenuItem
+ .getState();
+ showAllAlAnnotations.setEnabled(isAnnotationPanelShown);
+ showAllAlAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showAllAnnotations_actionPerformed(false, true);
+ }
+ });
+ hideAllAlAnnotations.setText(MessageManager
+ .getString("label.hide_all_al_annotations"));
+ hideAllAlAnnotations.setEnabled(isAnnotationPanelShown);
+ hideAllAlAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hideAllAnnotations_actionPerformed(false, true);
+ }
+ });
+ showAllSeqAnnotations.setText(MessageManager
+ .getString("label.show_all_seq_annotations"));
+ showAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
+ showAllSeqAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ showAllAnnotations_actionPerformed(true, false);
+ }
+ });
+ hideAllSeqAnnotations.setText(MessageManager
+ .getString("label.hide_all_seq_annotations"));
+ hideAllSeqAnnotations.setEnabled(isAnnotationPanelShown);
+ hideAllSeqAnnotations.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ hideAllAnnotations_actionPerformed(true, false);
+ }
+ });
+ SequenceAnnotationOrder sortAnnotationsBy = SequenceAnnotationOrder
+ .valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
+ SequenceAnnotationOrder.NONE.name()));
+ sortAnnBySequence.setText(MessageManager
+ .getString("label.sort_annotations_by_sequence"));
+ sortAnnBySequence
+ .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.SEQUENCE_AND_LABEL);
+ sortAnnBySequence.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ boolean newState = sortAnnBySequence.getState();
+ sortAnnByLabel.setSelected(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.SEQUENCE_AND_LABEL
+ : SequenceAnnotationOrder.NONE);
+ sortAnnotations_actionPerformed();
+ }
+ });
+ sortAnnByLabel.setText(MessageManager
+ .getString("label.sort_annotations_by_label"));
+ sortAnnByLabel
+ .setSelected(sortAnnotationsBy == SequenceAnnotationOrder.LABEL_AND_SEQUENCE);
+ sortAnnByLabel.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ boolean newState = sortAnnByLabel.getState();
+ sortAnnBySequence.setSelected(false);
+ setAnnotationSortOrder(newState ? SequenceAnnotationOrder.LABEL_AND_SEQUENCE
+ : SequenceAnnotationOrder.NONE);
+ sortAnnotations_actionPerformed();
+ }
+ });
colourTextMenuItem.setText(MessageManager
.getString("label.colour_text"));
colourTextMenuItem
htmlMenuItem_actionPerformed(e);
}
});
+
+ // TODO uncomment when supported by MassageManager
+ // createBioJS.setText(MessageManager.getString("label.biojs_html_export"));
+ createBioJS.setText("BioJS");
+ createBioJS.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ bioJSMenuItem_actionPerformed(e);
+ }
+ });
+
overviewMenuItem.setText(MessageManager
.getString("label.overview_window"));
overviewMenuItem.addActionListener(new java.awt.event.ActionListener()
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
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
applyAutoAnnotationSettings.setVisible(true);
applyAutoAnnotationSettings.addActionListener(new ActionListener()
{
-
@Override
public void actionPerformed(ActionEvent e)
{
applyAutoAnnotationSettings_actionPerformed(e);
}
+ });
+ ButtonGroup buttonGroup = new ButtonGroup();
+ buttonGroup.add(showAutoFirst);
+ buttonGroup.add(showAutoLast);
+ showAutoFirst.setText(MessageManager.getString("label.show_first"));
+ showAutoFirst.setSelected(Cache.getDefault(
+ Preferences.SHOW_AUTOCALC_ABOVE,
+ false));
+ showAutoFirst.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ setShowAutoCalculatedAbove(showAutoFirst.isSelected());
+ sortAnnotations_actionPerformed();
+ }
+ });
+ showAutoLast.setText(MessageManager.getString("label.show_last"));
+ showAutoLast.setSelected(!showAutoFirst.isSelected());
+ showAutoLast.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ setShowAutoCalculatedAbove(!showAutoLast.isSelected());
+ sortAnnotations_actionPerformed();
+ }
});
nucleotideColour.setText(MessageManager.getString("label.nucleotide"));
}
});
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
createPNG.setActionCommand(MessageManager
.getString("label.save_png_image"));
createPNG.setText("PNG");
+
font.setText(MessageManager.getString("action.font"));
font.addActionListener(new java.awt.event.ActionListener()
{
font_actionPerformed(e);
}
});
-
seqLimits.setText(MessageManager
.getString("label.show_sequence_limits"));
seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true));
createEPS(null);
}
});
+
+ createSVG.setText("SVG");
+ createSVG.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ createSVG(null);
+ }
+ });
+
LoadtreeMenuItem.setActionCommand(MessageManager
.getString("label.load_tree_for_sequence_set"));
LoadtreeMenuItem.setText(MessageManager
sortByAnnotScore.setText(MessageManager
.getString("label.sort_by_score"));
sort.add(sortByAnnotScore);
- sortByAnnotScore.addMenuListener(new javax.swing.event.MenuListener()
+ sort.addMenuListener(new javax.swing.event.MenuListener()
{
@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()
alignFrameMenuBar.add(editMenu);
alignFrameMenuBar.add(selectMenu);
alignFrameMenuBar.add(viewMenu);
+ alignFrameMenuBar.add(annotationsMenu);
alignFrameMenuBar.add(formatMenu);
alignFrameMenuBar.add(colourMenu);
alignFrameMenuBar.add(calculateMenu);
viewMenu.add(hideMenu);
viewMenu.addSeparator();
viewMenu.add(followHighlightMenuItem);
- viewMenu.add(annotationPanelMenuItem);
+ annotationsMenu.add(annotationPanelMenuItem);
+ annotationsMenu.addSeparator();
+ annotationsMenu.add(showAllAlAnnotations);
+ annotationsMenu.add(hideAllAlAnnotations);
+ annotationsMenu.addSeparator();
+ annotationsMenu.add(showAllSeqAnnotations);
+ annotationsMenu.add(hideAllSeqAnnotations);
+ annotationsMenu.add(sortAnnBySequence);
+ annotationsMenu.add(sortAnnByLabel);
+ annotationsMenu.addSeparator();
+ autoAnnMenu.add(showAutoFirst);
+ autoAnnMenu.add(showAutoLast);
+ autoAnnMenu.addSeparator();
autoAnnMenu.add(applyAutoAnnotationSettings);
autoAnnMenu.add(showConsensusHistogram);
autoAnnMenu.add(showSequenceLogo);
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);
jMenu2.add(htmlMenuItem);
jMenu2.add(epsFile);
jMenu2.add(createPNG);
+ jMenu2.add(createBioJS);
+ jMenu2.add(createSVG);
addSequenceMenu.add(addFromFile);
addSequenceMenu.add(addFromText);
addSequenceMenu.add(addFromURL);
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 sort annotations by type.
+ *
+ * @param sortOrder
+ */
+ protected void sortAnnotations_actionPerformed()
+ {
+ }
+
+ /**
+ * Action on clicking Show all annotations.
+ *
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
*/
- protected void buildShowHideAnnotationMenus()
+ protected void showAllAnnotations_actionPerformed(boolean forSequences,
+ boolean forAlignment)
{
+ setAnnotationsVisibility(true, forSequences, forAlignment);
}
- protected void showHideAnnotation_actionPerformed(String type, boolean b)
+ /**
+ * Action on clicking Hide all annotations.
+ *
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
+ */
+ protected void hideAllAnnotations_actionPerformed(boolean forSequences,
+ boolean forAlignment)
{
+ setAnnotationsVisibility(false, forSequences, forAlignment);
}
/**
- * Action on menu item "Show/hide sequence annotations..."
+ * Set the visibility of annotations to true or false. Can act on
+ * sequence-related annotations, or alignment-related, or both.
+ *
+ * @param visible
+ * @param forSequences
+ * update sequence-related annotations
+ * @param forAlignment
+ * update non-sequence-related annotations
*/
- protected void chooseAnnotations_actionPerformed()
+ protected void setAnnotationsVisibility(boolean visible,
+ boolean forSequences, boolean forAlignment)
{
}
{
}
+ protected void bioJSMenuItem_actionPerformed(ActionEvent e)
+ {
+
+ }
+
protected void closeMenuItem_actionPerformed(boolean b)
{
}
{
}
+ public void createSVG(java.io.File f)
+ {
+
+ }
protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
}
+
+ protected boolean isShowAutoCalculatedAbove()
+ {
+ return showAutoCalculatedAbove;
+ }
+
+ protected void setShowAutoCalculatedAbove(boolean showAutoCalculatedAbove)
+ {
+ this.showAutoCalculatedAbove = showAutoCalculatedAbove;
+ }
+
+ protected SequenceAnnotationOrder getAnnotationSortOrder()
+ {
+ return annotationSortOrder;
+ }
+
+ protected void setAnnotationSortOrder(SequenceAnnotationOrder annotationSortOrder)
+ {
+ this.annotationSortOrder = annotationSortOrder;
+ }
}